Pureli

A purely functional, dynamically typed, parallel evaluated, lisp-like programming language

Pureli

Pureli is a parallel programming language inspired by Haskell and Lisp.

Pureli is dynamically typed and has a lisp-like syntax, but is also purely functional like Haskell.

Pureli is a proof of concept made to show that using the purely functional paradigm, it is possible to automatically, implicitly and deterministically parallelize programs.

Pureli is my final project as part of my bachelor degree in computer science.

Docs

Read the manual.

Download

Examples

Hello World

(module main)

(define main
  (println! "Hello World!"))
        

Echo

;The program will repeat anything the user writes until ^C
(module main)

(module "stdlib/std.pli" io (bind!))

(define main
  (do!
    [println! "echo program"]
    [letrec ([go!
      (lambda ()
        (do!
          [io/bind! (read!) println!]
          [go!]))])
      (go!)]))

Exponent

(module main)

(require "stdlib/std.pli" list)
(require "stdlib/std.pli" std)


(define main
  (do!
    (println! "calculating 2^10000 + 2^10001 + ... + 2^10030")
    (let! result (pure calculation))
    (println! result)))


(define calculation
  (list/reduce +
    (list/map
      (std/curry exponent 2)
      (list/map +
                (list/replicate 30 10000)
                (list/range 1 30)))))


(define exponent (n expn)
  (if (<= expn 0)
      1
      (* n (exponent n (- expn 1)))))

A Pureli REPL

(module main)

(define main
  (do!
    (println! "Pureli REPL made in Pureli")
    (repl)))

(define repl ()
  (do!
    (let! input (read!))
    (print! "=> ")
    (let! result
          (try (pure (eval (read-str input)))
               (eval (read-str input))
               (pure "Error in expression")))
    (if
      (nil? result)
      (pure nil)
      (println! result))
    (repl)))

Video

Workflow Demonstration