Monday, October 13, 2008

push in scheme


01 (define push
02 (lambda (element stack)
03 (append stack (cons element '()))))
04
05 (push 'd '(a b c)) ; => (a b c d)


Though putting element before stack is a little weird XD.

 

No comments: