mirror of
https://github.com/lloeki/wasp.git
synced 2025-12-06 10:44:39 +01:00
rply parser + historical implementation
This commit is contained in:
parent
93796389e0
commit
12da94d927
4 changed files with 169 additions and 0 deletions
13
factorial.py
Normal file
13
factorial.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from lysssp import _eval, globs
|
||||
|
||||
_eval(['setq', 'factorial', ['lambda', ['x'],
|
||||
['cond', [
|
||||
[ ['equal?', 'x', 0], 1 ],
|
||||
[ True, [ '*', 'x', ['factorial', ['-', 'x', 1]]]]]]]], globs)
|
||||
|
||||
def test():
|
||||
print _eval(['factorial', 10], globs)
|
||||
|
||||
import timeit
|
||||
|
||||
print timeit.Timer(test).timeit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue