Listok is a project mainly written in SCALA and SHELL, based on the View license.
Listok is a dialect of LISP (Scala-based)
Useful as an embedded scripting language or as stand-alone app. It's a Scala-based and need in scala-library.jar to run.
eq, not, eval, apply, load, exit, error,
break, trace, untrace
curry, current-time, current-directory, json-parse
display, format
gensym, macroexpand
to-str, to-char, to-int, to-float, to-number, to-list, to-vector
atom, listp, null, sequencep, keywordp, numberp, symbolp, functionp
stringp, vectorp, charp, streamp, regexp, bytep, blobp
hashtablep, hashmapp threadp, mailslotp, structp, lazyseqp, pairp
list, vector, string, range, pair
length, head, first, last, tail rest
cons, append, reverse, elt, set-elt, subseq,
find, find-if, position, position-if, count, count-if,
remove, remove-if, sort, take, drop,
foreach, reduce, fold, map, flatmap, filter, partition,
hashmap, hm-get, hm-add, hm-del
hash-table, gethash, sethash, remhash, clrhash, maphash
lazyseq, lazyseq-from, lazyseq-range, lazyseq-force
(match s
((#/(\w+):(\d+)/ name id)
(display "name=%s id=%s\n" name id)))
(let ((x 1))
(spawn worker ((x) (m (mailslot)))
(send m (+ 1 x))))
(first (receive)) ; 2
(defun evenp (n)
(declare :tco)
(if (eq n 0)
t
(oddp (- n 1))))
(defun oddp (n)
(declare :tco)
(if (eq n 0)
nil
(evenp (- n 1))))
(evenp 10002)
(defun sieve (s)
(lazyseq (head s)
(lambda (n)
(sieve
(filter
(lambda (x) (/= 0 (rem x n)))
(tail s))))))
(def primes (sieve (lazyseq-from 2)))
(to-list (take primes 10))
(def s (open (string (current-directory) "/src/test/resources/test.file" )))
(assert s)
(print (collect (dowhile (<< (read-line s)))))
(close s)
(interop "java.io.File" 'make-file :constructor)
(interop "java.io.File.getAbsolutePath" 'file/path)
(file/path (make-file "."))
Listok uses sbt to build.
Get sbt at http://code.google.com/p/simple-build-tool/
To build:
cd listok
sbt update test package
To run REPL:
cd examples
./listok
To run examples:
cd examples
./queens.lok all
./gtranslate.lok en ru hello
./digest.lok digest.lok sha
./test.lok 256
./traffic.lok 100