website icon indicating copy to clipboard operation
website copied to clipboard

Nim homepage -- example is identical as in features

Open StefanSalewski opened this issue 5 years ago • 4 comments

And one more, sorry

import strformat

type
  Person = object
    name: string
    age: Natural # Ensures the age is positive

let people = [
  Person(name: "John", age: 45),
  Person(name: "Kate", age: 30)
]

for person in people:
  # Type-safe string interpolation,
  # evaluated at compile time.
  echo(fmt"{person.name} is {person.age} years old")

That example is fine, but identical to first example on Features page. That is a bit boring and not very good advertising.

StefanSalewski avatar Aug 24 '19 08:08 StefanSalewski

Ok, can you think of a better example that would go either on the homepage or in the features page?

narimiran avatar Aug 24 '19 16:08 narimiran

For features page maybe a sort algo, insertionSort() or recursive quickSort() (We all know the problems of recursive quicksort, but should be ok for example.)

https://rosettacode.org/wiki/Sorting_algorithms/Insertion_sort#Nim

https://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Nim

StefanSalewski avatar Aug 24 '19 19:08 StefanSalewski

Well the example on features page is not fully identical, it has an additional bug: name is marked with an export marker, but object Person is not exported. That makes no sense.

StefanSalewski avatar Aug 24 '19 19:08 StefanSalewski

Thinking more about it, a small async, threading or GUI example would be nice for features page too.

StefanSalewski avatar Aug 25 '19 11:08 StefanSalewski