Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

l3kn/EulerLisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EulerLisp

Code Samples

(~>
  (range~ 1 1000)
  (select~ &(or (divides? 3 &1) (divides? 5 &1)))
  sum~
  (println "Solution: "))

Special Syntax

  1. fst/rst instead of car/cdr, incl. chained versions ffst, ... (cadr)
  2. ~> pipeline operator, (~> 1 (+ 2) (* 3) = (* 3 (+ 2 1))
  3. lambda shorthand, &(+ &1 (* &2 2)) = (fn (a b) (+ a (* b 2)))
  4. 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 as priority-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)

Favourite Problems

References

Background

Algorithms & Data Structures

Implementation

Specs

About

Lisp compiler & bytecode VM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published