view samples/slist.tp @ 206:b4a9d4e405c5

Implemented a simple interpreter to be used for macro expansion and a driver for testing it
author Mike Pavone <pavone@retrodev.com>
date Wed, 23 Oct 2013 19:10:03 -0700
parents 18598163e3ef
children
line wrap: on
line source

#{
	sum <- :l {
		l fold: 0 with: :acc el {
			acc + el
		}
	}
	main <- {
		print: (string: (sum: [])) . "\n"
		print: (string: (sum: [1 2 3 4])) . "\n"
		print: (string: (sum: 1 | 2 | 3 | 4 | [])) . "\n"
		print: (string: (sum: [1 2] . [3 4])) . "\n"
	}
}