4 days ago by dang

Some past threads:

Lisp Badge: A single-board computer that you can program in uLisp - https://news.ycombinator.com/item?id=23729970 - July 2020 (25 comments)

A new RISC-V version of uLisp - https://news.ycombinator.com/item?id=22640980 - March 2020 (35 comments)

uLisp – ARM Assembler in Lisp - https://news.ycombinator.com/item?id=22117241 - Jan 2020 (49 comments)

Ray tracing with uLisp - https://news.ycombinator.com/item?id=20565559 - July 2019 (10 comments)

uLisp: Lisp for microcontrollers - https://news.ycombinator.com/item?id=18882335 - Jan 2019 (16 comments)

GPS mapping application in uLisp - https://news.ycombinator.com/item?id=18466566 - Nov 2018 (4 comments)

Tiny Lisp Computer 2 - https://news.ycombinator.com/item?id=16347048 - Feb 2018 (2 comments)

uLisp – Lisp for the Arduino - https://news.ycombinator.com/item?id=11777662 - May 2016 (33 comments)

4 days ago by turbinerneiter

I think its hilarious that this project is basically a 5k-line .ino file + immeasurable awesomeness: https://github.com/technoblogy/ulisp/blob/master/ulisp.ino

This is something that is accessible to read and modify in a weekend. Really cool.

4 days ago by ynniv

For a similarly accessible lisp implementation, see Scheme48 which was originally written in two days.


4 days ago by deckard1

There are actually a few of these.


And Scheme in one defun (SIOD), although it seems the recent version of this has been split into multiple files.

The video game Abuse also had a simple embedded Lisp: https://github.com/videogamepreservation/abuse/blob/master/a...

4 days ago by iainctduncan

Another is s7, one C file to embed. I use it for computer music, I love it. It's a Scheme that is heavily influenced by Common Lisp.

4 days ago by moonchild

s7 is amazing, but at ~100k loc it's hardly at the same scale

4 days ago by iainctduncan

ha, I guess thats true. Instead of a SIOD, it's a SIOBFD. ;-)

It's similar in terms of ease of embedding, being all ANSI C, and coming from a TinyScheme, originally...

4 days ago by jojohohanon

The mark sweep GC implementation is beautiful in its direct simplicity.

4 days ago by lioeters

Big fan of uLisp, I got it running on an ESP8266. Love how the whole language fits in a single file, making it easy to hack around.

Recently I learned how the author generates the uLisp variants for different platforms using Common Lisp:


..And an accompanying article to describe how it works:

uLisp Builder - http://www.ulisp.com/show?3F07

Also, a treasure trove of other Arduino and AVR projects by the author here:


4 days ago by quchen

This is really cool, I would love to program my fleet of ESP8266s with anything but C. And I’ve been passively interested in using Lisp for many years. Using Lisp for my program as glue for the normal ESP C libraries would be awesome. I’ve read the documentation of uLisp a bit, two main questions remain:

1. What’s the workflow? REPL for development is super cool, but how do I persist my programs? How does »flash this code onto the microcontroller« work?

2. How can I interface with the large amount of C libraries out there? For example, uLisp does not provide an OTA library (for updating the software over Wifi), or one for MQTT. I don’t want to rewrite those myself, so how do I call existing C from uLisp?

4 days ago by all2

The scheme distributions I'm familiar with (Chicken, Gambit, and Gerbil) have well-defined FFIs for C.

I think with Gambit you can have C inline with your Scheme:


This is no help for programming for embedded targets? Maybe? I'm very close to clueless (I RTFM, but I still don't understand a large portion of functionality of Schemes of FFIs).

4 days ago by cogburnd02

Having never heard of Gambit, it looks like Gambit:Scheme::Awka:AWK


4 days ago by ethagnawl

> I would love to program my fleet of ESP8266s with anything but C.

Have you looked into Embeddable Common-Lisp? (https://gitlab.com/embeddable-common-lisp/ecl)

4 days ago by travv0

The "Embeddable" in Embeddable Common Lisp means that you can embed your CL code in C programs, not that it's for embedded programming. Probably a poor naming choice because a lot of people have this perception about it.

4 days ago by guenthert

All true, but ECL after having been transpiled to C has a fair chance of being x-compiled for and run on a uC.

4 days ago by fmakunbound

> but how do I persist my programs?

    (save-image 'your-fun)

4 days ago by codebje

I used uLisp in a project. I had no available non-volatile storage so I handled persistence by writing my code on the laptop and sending it serially to the micro.

When some functions proved to be stable and useful I ported them in as uLisp builtins with a C implementation.

I used it as a debug driver in an STM32 for an eZ80 CPU - the STM32 provided USB to TTY and a third serial channel for debug control.

It was a nice addition but I do wish it was designed in a way that made these modifications easier.

4 days ago by PaulHoule

in the 1970s there were two common interpreted languages on small-RAM (say 4k) microcomputers and those were BASIC and FORTH; the second of which is almost "take the parenthesis out of your LISP program, reverse the order of the tokens, and... it works!"

By 1980 or so I think there was a LISP for CP/M that fit in a large-memory micro (48k) but it was expensive not that popular. A LISP runtime could have been an answer to the certifiably inzane segmented memory model of the IBM PC and I know people tried it, but other languages pulled ahead... In particularly Turbo Pascal and other languages with very fast-compilers and IDE user interfaces ripped off from LISP machines that were about as good as Visual Studio, Eclipse, IntelliJ are today -- only the PC versions were much much faster than the modern equivalents!

To be fair: modern IDE's are handling much larger programs. I remember a 1988 issue of BYTE magazine devoted to the idea of "software components" which the author thought were a long way off, but are now realized in the form of "npm", "maven", "pypi", if not the ancient CPAN, ActiveX, ...

I think it's also funny that circa 1988 Nick Wirth thought that true modularity in the module system mattered, the world didn't listen, and we've gone on to see Java only moderately harmed by the "Guava13+ broke Hadoop" crisis and to see npm practice diverge into inzanity with 2000+ dependencies for small projects but it works because the half-baked module system is more modular than Java.

4 days ago by zozbot234

> FORTH ... is almost "take the parenthesis out of your LISP program, reverse the order of the tokens, and... it works!"

Strictly speaking, FORTH does not have a lambda syntax. But if you literally "reverse the order" of function application (while keeping lambda abstraction the same) in lambda calculus, you get De Bruijn notation which is rather more compelling than the LISP default, and also rather FORTH-like as you note. (Even moreso if variable names are replaced by De Bruijn indices.)

4 days ago by MaxBarraclough

For those like me who hadn't heard of De Bruijn notation, check out this PDF from Cornell. [0] I found the Wikipedia article pretty impenetrable, but no doubt it makes sense to a reader who already knows all about De Bruijn notation.

[0] (PDF) https://www.cs.cornell.edu/courses/cs4110/2018fa/lectures/le...

4 days ago by PaulHoule

FORTH is very different from LISP but it's very similar in that you can use the quote operator to write control structures the same way you write any other function.

Common LISP had CLOS that implemented object-oriented programming in a style not too different from Python, but as a library without compiler support and that was also true for late 1980s FORTH.

4 days ago by ska

> but as a library without compiler support

I'm not sure what you mean by this;As part of CL, CLOS always had compiler (and run time compiler) support.

Many early OO systems were implemented in lisps, partially because they are flexible enough to add language features reasonably well, by default. See, e.g. Flavors, Loops. These predate CL and influenced the design of CLOS.

4 days ago by kazinator

> can use the quote operator to write control structures

The quote operator cannot be used for writing control structures in Lisp, unless we are referring to something you generally should not do in production code, like:

  (defun meta-circular-if (cond then else)
    (if (eval cond) (eval then) (eval else)))

  (meta-circular-if (quote (> 3 2)) (quote (+ 4 4)) 0)
Quoting is nothing like referring to Forth words as data. When Forth code refers to a Forth word foo, that's more like (function foo) than (quote foo).

4 days ago by dasyatidprime

CLOS generics+methods style is actually quite a different model in some ways from the Smalltalk-like model Python runs on! Primarily, method dispatch has the generic function primary and the classes secondary: methods are separately-definable specializations of what would otherwise be functions, rather than “owned” by a receiver object via its class. There was a recent item on Python versus CL: https://news.ycombinator.com/item?id=27011942

4 days ago by ethagnawl

I can't find a link to it at the moment, but Pierre de Lacaze gave an excellent talk about the CLOS/MOP systems at Lisp NYC about 5 years ago. If anyone is interested in these topics, I'd recommend digging around to see if you can find it.

4 days ago by chalst

> Even moreso if variable names are replaced by De Bruijn indices.

De Bruijn indices are not simply variable names: they vary dynamically depending where in the term (i.e. under how many binders) they occur, which is why beta reduction is so hairy with the De Bruijn notation.

4 days ago by hota_mazi

It's interesting that you cite package managers that are deeply flawed while not listing the two that are, in my opinion, the best in class around:

- The JVM Maven Central repo

- Rust's Cargo

Also, you never say exactly which product from Wirth you are referring to, I'm assuming Modula 2. If so, all Modula 2 introduced is namespaces at the language level, and while this was a pretty novel idea at the time, it was very simplistic.

Also, the reason why Turbo-Pascal and family were fast was because the compilers were not just single pass but would abort on the first error.

I can't think of any reason why I'd trade the current compilers I use on a daily basis (mostly Kotlin and Rust) to go back to a single pass compiler, even for speed. My time is precious and a fast compiler that then forces me to spend three times as much time writing and correcting my code is not a good use of my time.

4 days ago by PaulHoule

I did mention maven.

The advantage that Javascript has over Java in this respect is that in Javascript module A can import version B.1 of module B and module C can import version B.2 of module B and it works almost always.

Contrast that to the Guava - Hadoop incompatiblity in which a tiny change to Guava that broke HDFS in an racy way got Hadoop stuck at Guava 13 so you have the choice of going with G13 forever, ditching Hadoop, or ditching Guava.

I think that one is the worst diamond dependency in Java ever, but it is one of the scaling problems that maven has as the number of imports goes up, it might not be the worst one limiting what you can do with maven. (e.g. if you have a platoon of developers and a corresponding number of projects you might be able to complete a build that downloads SNAPSHOT(s) about 0.5 of the time)

4 days ago by hota_mazi

You're over dramatizing.

For one instance of the Guava/Hadoop incident (which could happen just the same in any env), there are millions of builds that are happening every day that work just fine with the JVM + Maven Central repo combination.

And as opposed to the Javascript repos, you cannot delete anything on a Maven repo once it's been uploaded there.

4 days ago by agumonkey

Hi Paul,

beside Byte, do you know any place to read about that part of history ?

4 days ago by PaulHoule

David Ahl's, Creative Computing magazine is rarest and best of all. My mom threw most of mine out when I was away in school and so did most of the world's libraries!

The other day I found the first issue of "PC Computing" which did survive in my collection and it has a nice article on the "future of printing" that explains current-day inkjet and laser printing quite well.

4 days ago by cgh

Ha, my mom did the same thing. Luckily, my issues of The Transactor survived the purge.

Back issues of CC are archived here: https://archive.org/details/creativecomputing

4 days ago by dhosek

I'd say for that part of history, I'd go with Dr Dobb's Journal from the period. Not sure if any are online or if you'd have to find paper copies at the library.

4 days ago by exdsq

I used uLisp to program a really small microcomputer for a hobbyist rocket project. Essentially it collected telemetry data, sending it back to my laptop, and activated a locator beacon when it knew it landed. Good fun to learn but it was still slightly too large for the boards I was programming - I assume it'll be a lot better on an Arduino or something with a decent amount of memory.

4 days ago by rgrmrts

That sounds like a really fun project. What board were you using? And you didn’t by chance write about this somewhere - did you?

4 days ago by Graziano_M

There's also Lua RTOS[1] plus Fennel[2]. Lua is easy to embed, but I find the syntax pretty bad, and Fennel fixes most of it for me.

[1] https://github.com/whitecatboard/Lua-RTOS-ESP32/ [2] https://fennel-lang.org

4 days ago by petre

How does it compare to NodeMCU? I've tried to write some code to read I²C sensors and publish data via MQTT using Node MCU, but the docs and the examples are outdated. I've wasted time, only to find out that it's more productive to read the function prototypes. In the end I went with Tasmota, flash the appropriate image, setup wifi, the MQTT endpoint and you're done. The ESP32 version also has a Python like embedded language called Berry.


4 days ago by Graziano_M

I haven't used it in an MCU, I am afraid. I've recently taken up Fennel for a few projects and was made aware of its MCU capabilities, but that's it.

Daily digest email

Get a daily email with the the top stories from Hacker News. No spam, unsubscribe at any time.