Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (27 sloc) 901 Bytes
@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]) })
}
Jump to Line
Something went wrong with that request. Please try again.