Permalink
Browse files

fixed and renamed list example

  • Loading branch information...
1 parent c7f7369 commit 9a06cdd645c50df5e81ca70759cd743460bf15e9 @marianoguerra committed Jun 21, 2010
Showing with 28 additions and 28 deletions.
  1. +0 −28 examples/example_l.fn
  2. +28 −0 examples/lst_example.fn
View
@@ -1,28 +0,0 @@
-@public
-run = fn () {
- # create a list with the numbers from 1 to 10
- l.range(2, 10)->
- # increment each item by 1
- l.map(fn (X) { X + 1 })->
- # keep the even numbers on the list
- l.keep(fn (X) { X % 2 == 0 })->
- # print the result
- l.print()->
- # reverse the list
- l.reverse()->
- # print the result again
- l.print()->
- # call some method with the list as parameter
- # (tap doesn't modify the list)
- l.tap(fn (List) { io.format("the list is: ~p~n", [List]) })->
- # append some items
- l.append([30, 31, 32])->
- # do something with each item
- l.each(fn (Item) { io.format("double: ~p~n", [Item * 2]) })->
- # remove the values above 20
- l.remove(fn (Item) { Item > 20 })->
- # print it
- l.print()
-
- 3->l.times(fn (Count) { io.format("~p: hello world!~n", [Count]) })
-}
@@ -0,0 +1,28 @@
+@public
+run = fn () {
+ # create a list with the numbers from 1 to 10
+ lst.range(2, 10)->
+ # increment each item by 1
+ lst.map(fn (X) { X + 1 })->
+ # keep the even numbers on the list
+ lst.keep(fn (X) { X % 2 == 0 })->
+ # print the result
+ lst.print()->
+ # reverse the list
+ lst.reverse()->
+ # print the result again
+ lst.print()->
+ # call some method with the list as parameter
+ # (tap doesn't modify the list)
+ lst.tap(fn (List) { io.format("the list is: ~p~n", [List]) })->
+ # append some items
+ lst.append([30, 31, 32])->
+ # do something with each item
+ lst.each(fn (Item) { io.format("double: ~p~n", [Item * 2]) })->
+ # remove the values above 20
+ lst.remove(fn (Item) { Item > 20 })->
+ # print it
+ lst.print()
+
+ 3->lst.times(fn (Count) { io.format("~p: hello world!~n", [Count]) })
+}

0 comments on commit 9a06cdd

Please sign in to comment.