Adding in an rPython example.
This commit is contained in:
parent
7288164309
commit
004c50124d
14
eg/rpython/Makefile
Normal file
14
eg/rpython/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
RPY_WRAP = python -m hy
|
||||
RPY_FLAGS = -O2
|
||||
RPY = ~/pypy/rpython/bin/rpython
|
||||
|
||||
all: clean build
|
||||
|
||||
clear:
|
||||
@clear
|
||||
|
||||
clean:
|
||||
@echo "fixme"
|
||||
|
||||
build:
|
||||
$(RPY_WRAP) $(RPY) $(RPY_FLAGS) target.py
|
2
eg/rpython/THANKS
Normal file
2
eg/rpython/THANKS
Normal file
@ -0,0 +1,2 @@
|
||||
Thanks so much for Romain Guillebert for sitting down and hacking
|
||||
this out with me. A true hacker in every sense of the word. Thank you!
|
15
eg/rpython/target.py
Normal file
15
eg/rpython/target.py
Normal file
@ -0,0 +1,15 @@
|
||||
import hy
|
||||
import sys
|
||||
import test
|
||||
|
||||
|
||||
def entry_point(argv):
|
||||
return test.main(argv)
|
||||
|
||||
|
||||
def target(driver, args):
|
||||
return entry_point, None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
entry_point(sys.argv)
|
12
eg/rpython/test.hy
Normal file
12
eg/rpython/test.hy
Normal file
@ -0,0 +1,12 @@
|
||||
; hello, rHy!
|
||||
|
||||
|
||||
(defn fib [n]
|
||||
(if (<= n 2) n
|
||||
(+ (fib (- n 1)) (fib (- n 2)))))
|
||||
|
||||
|
||||
(defn main [argv]
|
||||
(for [x [1 2 3 4 5 6 7 8]]
|
||||
(print (fib x)))
|
||||
0)
|
Loading…
x
Reference in New Issue
Block a user