comparison samples/slist.tp @ 170:18598163e3ef

Add linked list implementation and cons operator
author Mike Pavone <pavone@retrodev.com>
date Tue, 13 Aug 2013 21:58:03 -0700
parents
children
comparison
equal deleted inserted replaced
153:075b1e71feff 170:18598163e3ef
1 #{
2 sum <- :l {
3 l fold: 0 with: :acc el {
4 acc + el
5 }
6 }
7 main <- {
8 print: (string: (sum: [])) . "\n"
9 print: (string: (sum: [1 2 3 4])) . "\n"
10 print: (string: (sum: 1 | 2 | 3 | 4 | [])) . "\n"
11 print: (string: (sum: [1 2] . [3 4])) . "\n"
12 }
13 }