Skip to content

Instantly share code, notes, and snippets.

@nyuichi
Created March 5, 2012 14:25
Show Gist options
  • Save nyuichi/1978519 to your computer and use it in GitHub Desktop.
Save nyuichi/1978519 to your computer and use it in GitHub Desktop.
(def sum (list)
(if (nilp list)
0
(+ (car list)
(sum (cdr list)))))
(sum '(1 2 3))
-----------------------------------------------
[0] const 0x???????? ; '(1 2 3)
[5] call 6 ; sum
[10] halt
sum:
[11] lref -1 ; list
[16] nilp
[17] jnz 11
[22] const 0x01 ; fixnum(0)
[27] ret
[28] lref -1 ; list
[33] cdr
[34] call -23 ; sum
[39] lref -1 ; list
[44] car
[45] add
[46] ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment