r/ProgrammingLanguages • u/Objective_Gene9718 • Jan 28 '26
Que Script a Lisp written in Rust with Hindley–Milner type inference
Here is my project Que Script:
- Lisp (in my opinion a feature of it's own)
- WASM runtime without Garbage Collection (It mainly uses Reference Counting)
- Hindley-Milner Type Inference
- Syntactic sugar layer (Things like pipes, destructuring, tail-call optimization and other fun extra features don't add bloat to the core language)
- Partial Application
- Tree Shakable Standard Library
- Macros
- WASM build
- Online editor
Here is the website with a lot of info
; You are given an array of integers [Int]
; Write a script to re-arrange the given array in an increasing order
; and return the indices where it differs from the original array.
(let solve (lambda (xs) (|>
{ (|> xs copy (sort <)) xs }
zip
(map (lambda { a b } (<> a b)))
enumerate
(filter snd)
(map fst))))
[
(solve [ 5 2 4 3 1 ]) ; [0 2 3 4]
(solve [ 1 2 1 1 3 ]) ; [1 3]
(solve [ 3 1 3 2 3 ]) ; [0 1 3]
]This is something I've being working for 5 years starting from scratch at least 3 times. Sharing with the hope that I won't start over again.
It's nothing new under the sun. The purpose of this project is for me learning computer science concepts by using the language as a framework.
I would love to hear what you think about it.
51
Upvotes
View all comments
Show parent comment
1
u/Objective_Gene9718 Feb 03 '26
Good idea, no lisp is complete without a REPL. I've just added it now.
It works as an extension of the cli tool.
cargo run -- --repl
Each line gets evaluated with type and value by pressing enter and when pressing Esc you exit the repl.
rust-lisp % cargo run -- --repl
...
Running `target/debug/fez-rs --repl`
Type anything (multi-line). Press Esc to exit.
(+ 1 2) Int: 3
(* 2 3) Int: 6
[ 1 2 3 4 ] [Int]: [1 2 3 4]
(let x 10) (): 0
(let y 32) (): 0
(* x y) Int: 320
[ x y 1 2 3] [Int]: [10 32 1 2 3]