Hi folks, i'm looking for recommendations for declarative programming that can run in embedded context, mostly for simple home automation. Lisp would be a plus, but I'm interested in anything that's not python or C-like. Has anyone here used something like this?
A lot depends on what you mean by "embedded context". Clojure will certainly run on something like a pi. But for anything more towards the microcontroller end of the spectrum you'll have trouble finding a jvm
I have a few cheap MCUs laying around, they are either esp32 or arduinos (mostly ATmega328P) i had a pi but i made it into a retro pi station as a gift for a friend
I'm not very experienced with embedded stuff, but there is Janet, which looks like clojure and transparently compiles to C, so I think that might suit your boards in the vein of clojure-dialects that aren't actually clojure-dialects, there's also Fennel, which compiles to Lua (which is actually also from the creator of Janet)
Both have not had updates in quite a while, and in the interest of something fun to play with: • https://github.com/mfikes/esprit - ClojureScript on top of https://en.wikipedia.org/wiki/Espruino • https://ferret-lang.org - and as a side note, a wonderful full example of literate programming. The full source is indeed in this repo, in an .org file! https://github.com/nakkaya/ferret
Also saw this a while ago: https://github.com/bellard/mquickjs (and if you did not know, Fabrice Bellard can do, and has done, All The Programming Things)
there are ML variants (eg. OCaml) which are declarative (default immutable data structures, functional programming style is the default) and compile to small fast machine code. even Rust, though it looks like C, can be used in a way that looks and acts more like ML
fennel is a lot like clojure (without the immutability though), and it is pretty close to the lua runtime it is built on (similar to how easy jvm interop is in clojure). lua runs great on esp32
if you are looking for a real project https://arxiv.org/abs/1909.00043 is neat, dedalus on arduinos, how much more declarative than datalog can you get?
ah also, i would be remiss if I didn't link an effort of the good people here; compiling a list of clojure dialects/clojure-likes https://clojure.cc/dialects/ [#C0B655S3R19]
it probably isn't the best choice for a functional style, but uLisp is worth a look for its usability in pretty limited devices.
thanks you all, i'll explore those options and make something :D