distZip task has been added

This commit is contained in:
Sameer Rahmani 2020-01-02 17:25:33 +00:00
parent fe8d100059
commit 9287dec83a
4 changed files with 37 additions and 2 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@ graalvm/
component/sl-component.jar
language/dependency-reduced-pom.xml
native/slnative
tmp/

View File

@ -1,8 +1,12 @@
all:
./gradlew clean
./gradlew distZip
repl:
gradle compileJava && rlwrap java -cp build/classes/java/main/ serene.simple.Main
./gradlew compileJava && rlwrap java -cp build/classes/java/main/ serene.simple.Main
run:
gradle compileJava && java -cp build/classes/java/main/ serene.simple.Main ${PWD}/test.srns
./gradlew compileJava && java -cp build/classes/java/main/ serene.simple.Main ${PWD}/test.srns
docs:
npx docco src/**/*.java

8
benchmarks/fib.srns Normal file
View File

@ -0,0 +1,8 @@
(def fib
(fn (n)
(if (< n 2)
1
(+ (fib (- n 1))
(fib (- n 2))))))
(println (fib 10))

22
test.srns Normal file
View File

@ -0,0 +1,22 @@
(def reduce
(fn (f xs initial-value)
(cond
((first xs) (reduce f (rest xs) (f initial-value (first xs))))
(true initial-value))))
(def map
(fn (f xs)
(reduce (fn (acc x) (cons acc (f x))) xs (list))))
;; Since SereneSimple only have List data structure and
;; it is effecient from the start. So the following function
;; will return (6 5 4 3 2)
(println (map (fn (x) (+ 1 x))
(list 1 2 3 4 5)))
(println
(reduce (fn (y x)
(cons y (* x x)))
(list 1 2 3 4)
(list)))