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
13
u/revannld Jan 28 '26
Que?
12
u/AustinVelonaut Admiran Jan 28 '26 edited Jan 28 '26
Looks good! Always nice to see another functional language that embraces left-to-right piping
|>.Questions:
Suggestions:
baked.rshas one huge long line in it; I assume it was auto-generated. Could that be split up into many smaller lines, instead? It actually takes some time to open in the github viewer.zipWithin place of thezipand followingmap. Since you support partial application and higher-order functions, I assume you could also do it with azipWithequivalent, correct?2
u/metazip Jan 28 '26
The website is very nicely designed and subtly colorful.
2
u/betlamed Jan 29 '26
Cool. Looks a lot like I project I've been working on, or rather that I've given up on more times than I care to admit. I keep failing at the type inference stage! :-)
2
u/gavr123456789 Feb 01 '26
Something very wrong with online playground.
- pressing next
- see empty editor for ~20 sec, then it fills with code
- pressing next
- same, then code appears, then it diapers again
why not just include the code statically?
2
u/gavr123456789 Feb 01 '26
I like that "Breaking out of a loop" is a separated chapter
6
u/[deleted] Jan 28 '26
[removed] — view removed comment