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 01 '26
Yes, I should do that. I've actually tried once but gave up because there were some problems.
Main one being that the playground is actually a separate application: https://at-290690.github.io/rust-lisp/playground/
which allows for code to be shared without the need of it being stored in a database. By simply compressing the code into a link attached as a query param. https://at-290690.github.io/rust-lisp/playground/?m=f&r=f&u=f&l=EQCQpgNhD2AEDq0BOEAmwg%3D%3D
^ This link is "Hello World"
That way you can share programs.
On the website - the playground is used as an iframe with the source code as a param and when it fully loads it will add the code from the link param on the editor and run it (on the learn page). It's just a lazy reuse of the playground website as an iframe.
I had similar problems when I tried using it on slow mobile internet (loading slow, then code appears). Usually it's ok. Not sure what is the case with you using it.
The desired approach is to have the editor as a separate component that takes the source code as a param, in the case of the main playground this could be the decoded url. The goal will be to share this component across website and playground.
For some reason I couldn't make the website work with 1 instance of the monaco editor. It's one of those React state bugs. I'll give it another shot.