EulerLisp
EulerLisp copied to clipboard
Lisp compiler & bytecode VM
trafficstars
EulerLisp

Code Samples
(~>
(range~ 1 1000)
(select~ &(or (divides? 3 &1) (divides? 5 &1)))
sum~
(println "Solution: "))
Special Syntax
fst/rstinstead ofcar/cdr, incl. chained versionsffst, ... (cadr)~>pipeline operator,(~> 1 (+ 2) (* 3)=(* 3 (+ 2 1))- lambda shorthand,
&(+ &1 (* &2 2))=(fn (a b) (+ a (* b 2))) - streams (lazy iterators),
range~,map~,select~, ...
Advanced Data Structures
Note: Some of these could (and should) be implemented in the target language at some later time.
Priority Queues
(make-priority-queue pairs), create a (max-)priority queue from a list of (element, priority) pairs(make-min-priority-queue pairs), create a (min-)priority queue from a list of (element, priority) pairs(priority-queue-insert! pq element priority), insert a new element(priority-queue-max pq), get the (element, priority) pair with the highest (or lowest, if the queue is a min-priority queue) priorty(priority-queue-pop! pq), same aspriority-queue-max, but removes the element
>> (def pq (make-priority-queue (list (cons "foo" 1) (cons "bar" 5) (cons "baz" 7))))
>> (priority-queue-insert! pq "qux" 20)
>> (priority-queue-max pq)
=> ("qux" . 20)
>> (priority-queue-pop! pq)
=> ("qux" . 20)
>> (priority-queue-pop! pq)
=> ("baz" . 7)
>> (priority-queue-pop! pq)
=> ("bar" . 5)
>> (priority-queue-pop! pq)
=> ("foo" . 1)