r/ProgrammingLanguages • u/KN_9296 • May 02 '26
Language announcement Reduct: A functional, immutable, S-expression based configuration and scripting language, beating Lua (non-JIT) in benchmarks, with easy C integration.
https://github.com/KaiNorberg/ReductI've been working on this language for some number of months now. It started as just a basic configuration language for a hobby OS project I've been working on, but I became a bit obsessed with benchmarking it so here we are.
So far Reduct manages to beat Lua on several Benchmarks, while also attempting to make Lisp-like syntax more accessible:
Lisp
(let ((x 10)
(y 20))
(let ((z (+ x y)))
(* z 2)))Reduct
(do
(def x 10)
(def y 20)
(def z {x + y})
{z * 2}
)The language also provides C Modules for easy integration with C, for example:
// my_module.c
#include "reduct/reduct.h"
reduct_handle_t my_native(reduct_t* reduct, reduct_size_t argc, reduct_handle_t* argv)
{
return REDUCT_HANDLE_FROM_INT(52);
}
reduct_handle_t reduct_module_init(reduct_t* reduct)
{
return REDUCT_HANDLE_PAIRS(reduct, 1,
"my-native", REDUCT_HANDLE_NATIVE(reduct, my_native)
);
}
// my_reduct.rdt
(def my-module (import "my_module.rdt.so"))
(my-module.my-native)For more, please see the README.
I would highly appreciate any feedback on the language so far, along with gladly answering any questions.
•
u/yorickpeterse Inko May 03 '26
/u/KN_9296 I'm looking at the project and it seems based on the commits you're using an LLM as part of this project's development. Some examples:
Please clarify if and what exactly you are using an LLM, and if so why that meets the subreddit rules. Until then I've removed the post.
3
u/no_brains101 May 03 '26
Is it embeddable in C and rust in a nice fashion like lua is? Or is the comparison just for speed?
1
u/Difficult-Value-3145 May 04 '26 edited May 04 '26
The thing is lua userdata with meta methods makes it a language that is very adaptable I never really used a functional programing language but since nothing is concrete OOP in either lua or C which is what lua uses natively. Lua can in fact be a functional language or used as such it has. -First class functions -Upvalues/closures -Anonymous functions -Tailcalls
And things like mapcan be implemented easily
Also a easy ffi for rust and golang would make it useful.
-2
u/busres May 03 '26
I suggest "4-space tab stops" as your guideline. Tabs over spaces is critical for visual accessibility for some people (they require more or less, and can easily adjust tab display to their needs).