diff options
-rw-r--r-- | haskell.html.markdown | 6 | ||||
-rw-r--r-- | nim.html.markdown | 14 | ||||
-rw-r--r-- | perl6.html.markdown | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown index 52433aaa..79fbf09f 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -80,6 +80,9 @@ not False -- True [5..1] -- This doesn't work because Haskell defaults to incrementing. [5,4..1] -- [5, 4, 3, 2, 1] +-- indexing into a list +[0..] !! 5 -- 5 + -- You can also have infinite lists in Haskell! [1..] -- a list of all the natural numbers @@ -99,9 +102,6 @@ not False -- True -- adding to the head of a list 0:[1..5] -- [0, 1, 2, 3, 4, 5] --- indexing into a list -[0..] !! 5 -- 5 - -- more list operations head [1..5] -- 1 tail [1..5] -- [2, 3, 4, 5] diff --git a/nim.html.markdown b/nim.html.markdown index c74fece7..aa15e591 100644 --- a/nim.html.markdown +++ b/nim.html.markdown @@ -3,14 +3,15 @@ language: Nim filename: learnNim.nim contributors: - ["Jason J. Ayala P.", "http://JasonAyala.com"] + - ["Dennis Felsing", "http://felsin9.de/nnis/"] --- -Nim (formally Nimrod) is a statically typed, imperative programming language +Nim (formerly Nimrod) is a statically typed, imperative programming language that gives the programmer power without compromises on runtime efficiency. Nim is efficient, expressive, and elegant. -```ruby +```nimrod var # Declare (and assign) variables, letter: char = 'n' # with or without type annotations lang = "N" & "im" @@ -60,6 +61,13 @@ var drinks = @["Water", "Juice", "Chocolate"] # @[V1,..,Vn] is the sequence literal +drinks.add("Milk") + +if "Milk" in drinks: + echo "We have Milk and ", drinks.len - 1, " other drinks" + +let myDrink = drinks[2] + # # Defining Types # @@ -261,5 +269,5 @@ performance, and compile-time features. * [FAQ](http://nimrod-lang.org/question.html) * [Documentation](http://nimrod-lang.org/documentation.html) * [Manual](http://nimrod-lang.org/manual.html) -* [Standard Libray](http://nimrod-lang.org/lib.html) +* [Standard Library](http://nimrod-lang.org/lib.html) * [Rosetta Code](http://rosettacode.org/wiki/Category:Nimrod) diff --git a/perl6.html.markdown b/perl6.html.markdown index 72faecb6..85ab1d79 100644 --- a/perl6.html.markdown +++ b/perl6.html.markdown @@ -201,7 +201,7 @@ sub mutate($n is rw) { my $x = 42; sub x-store() is rw { $x } x-store() = 52; # in this case, the parentheses are mandatory - # (else Perl 6 thinks `mod` is an identifier) + # (else Perl 6 thinks `x-store` is an identifier) say $x; #=> 52 @@ -283,7 +283,7 @@ for @array -> $variable { } # As we saw with given, for's default "current iteration" variable is `$_`. -# That means you can use `when` in a `for` just like you were in a when. +# That means you can use `when` in a `for` just like you were in a `given`. for @array { say "I've got $_"; |