1 /** This file is part of Shapes.
3 ** Shapes is free software: you can redistribute it and/or modify
4 ** it under the terms of the GNU General Public License as published by
5 ** the Free Software Foundation, either version 3 of the License, or
8 ** Shapes is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ** GNU General Public License for more details.
13 ** You should have received a copy of the GNU General Public License
14 ** along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 ** Copyright 2013 Henrik Tidefelt
20 ##lookin ..Shapes..Data
23 lst2: [cons 1 [cons 2 [cons 3 nil]]]
26 lst5: [cons 1 [range 2 3]]
27 lst6: 1 ; [cons 2 [list 3]]
29 /** All lists have the same fields and methods. **/
30 IO..•stdout << lst1.car << ` ´ << lst2.car << ` ´ << lst3.car << ` ´ << lst4.car << ` ´ << lst5.car << ` ´ << lst6.car << "{n}
31 IO..•stdout << lst1.cdr << ` ´ << lst2.cdr << ` ´ << lst3.cdr << ` ´ << lst4.cdr << ` ´ << lst5.cdr << ` ´ << lst6.cdr << "{n}
32 opl: \ p e → p + (String..newString << e)
33 IO..•stdout << [lst1.foldl opl `0´] << ` ´ << [lst2.foldl opl `0´] << ` ´ << [lst3.foldl opl `0´] << ` ´ << [lst4.foldl opl `0´] << ` ´ << [lst5.foldl opl `0´] << ` ´ << [lst6.foldl opl `0´] << "{n}
34 opr: \ e p → (String..newString << e) + p
35 IO..•stdout << [lst1.foldr opr `4´] << ` ´ << [lst2.foldr opr `4´] << ` ´ << [lst3.foldr opr `4´] << ` ´ << [lst4.foldr opr `4´] << ` ´ << [lst5.foldr opr `4´] << ` ´ << [lst6.foldr opr `4´] << "{n}