16 ms·
uLisp
- ngcc_hk 6y agoone of the best and useful lisp sites. Good for learning and studying. Not sure anyone use it for production though.
- PaulHoule 6y agoI'd feel the limitation of unsigned 16-bit ints on my AVR8. There is no language that seems like a good fit for the AVR8 thanks to its many unique characteristics. For instance, the Harvard architecture and 8-bit math with a fair sized register file. You should be able to use 3 registers to do 24 bit math, allocate a block of registers for the exclusive use of the interrupt handler, do away with the "undefined behavior" that comes from using a stack, etc. The C language environment from Arduino is acceptable, particularly for education, because you are not wasting your time learning C. I write a lot of programs from the arduino that are mostly "traverse a graph of data structures and do something" (say of laser light show coordinate data or something like that) and I pack the data up with a "data assembler" written in Python... That is a weekend's project work of tooling. It would be fun to have either a high-level assembler or a pascal-like language matched to AVR8 but I think it won't happen because AVR8 is a dead end in some respects. That is, they aren't going to make a better one, maybe I can get 4x better performance with assembler compared to C for one task, but if I care about performance I will buy a more powerful microcontroller and just recompile the C program.
- timonoko 6y agoIt is fairly easy to implement N bit arithmetics in 16-bit lisp. Especially if the system provides a Carry-flag, which it seldom does unfortunately. For some stupid reason I had strange ( 10000 . 10000 ) arithmetics, where the big number X was (cons (/ X 10000) (mod X 10000)) and primitives like */10000 helped to use it (multiply and divide with 10000). Ok. The stupid reason was it was aesthetically pleasing. For example the big number 12346789 was (1234 . 6789).
- pjmlp 6y agoAsk and you will be served, https://www.mikroe.com/mikropascal-avr https://www.mikroe.com/mikropascal-avr
- exdsq 6y agoI 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.
- rgrmrts 6y agoThat sounds like a really fun project. What board were you using? And you didn’t by chance write about this somewhere - did you?
- turbinerneiter 6y agoI think its hilarious that this project is basically a 5k-line .ino file + immeasurable awesomeness: https://github.com/technoblogy/ulisp/blob/master/ulisp.ino https://github.com/technoblogy/ulisp/blob/master/ulisp.ino This is something that is accessible to read and modify in a weekend. Really cool.
- ynniv 6y agoFor a similarly accessible lisp implementation, see Scheme48 which was originally written in two days. https://www.s48.org/1.9.2/manual/manual-Z-H-2.html#node_chap_1 https://www.s48.org/1.9.2/manual/manual-Z-H-2.html#node_chap...
- deckard1 6y agoThere are actually a few of these. https://github.com/zpl-c/tinyscheme/blob/master/source/scheme.c https://github.com/zpl-c/tinyscheme/blob/master/source/schem... 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/abuse/src/lisp.c https://github.com/videogamepreservation/abuse/blob/master/a...
- iainctduncan 6y agoAnother 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.
- moonchild 6y agos7 is amazing, but at ~100k loc it's hardly at the same scale
- iainctduncan 6y agoha, 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...
- PaulHoule 6y agoin 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.
- agumonkey 6y agoHi Paul, beside Byte, do you know any place to read about that part of history ?
- dhosek 6y agoI'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.
- PaulHoule 6y agoDavid 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.
- simongray 6y agoIf you like Clojure there is also https://github.com/mfikes/esprit https://github.com/mfikes/esprit
- azhenley 6y agoSome of the previous discussions: https://news.ycombinator.com/item?id=22117241 https://news.ycombinator.com/item?id=22117241 https://news.ycombinator.com/item?id=18882335 https://news.ycombinator.com/item?id=18882335 https://news.ycombinator.com/item?id=11777662 https://news.ycombinator.com/item?id=11777662
- fidesomnes 6y agoI do love this.
- Nihilartikel 6y agoAnother one for the Clojurists - https://github.com/nakkaya/ferret https://github.com/nakkaya/ferret which compiles down to c++11. Though it doesn't offer a real lisp REPL or eval, so it's not a meaningful comparison with uLisp.
- dTal 6y agoHow does the speed compare with micropython?
- tyingq 6y agoThey do both support very straightforward inline ASM, so there's an option for things that need the speed (LED matrix driving, etc) for either. And there's also the option of just using brute force. Like the Teensy. It's kind of funny that a 32 bit 600MHz 1MB Ram device is now a "micro" controller.
- dTal 6y agoThat's not really what I'm getting at. Yeah you can inline ASM, but that kind of defeats the purpose. And yeah, micros are "powerful", but a 10x speed difference is still significant. "Speed" is a proxy for "power draw", and a 2 hour smartwatch is rather less useful than a 20 hour one.
- tyingq 6y agoThey do have performance and benchmark pages. No direct comparison to micropython, but I assume you could recreate the crc32 and fibonacci ones. http://www.ulisp.com/show?36M3 http://www.ulisp.com/show?36M3 http://www.ulisp.com/show?1EO1 http://www.ulisp.com/show?1EO1
- aitchnyu 6y agoHow does it compare with Python on productivity and hardware power needed?
- lioeters 6y agoBig 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: https://github.com/technoblogy/ulisp-builder https://github.com/technoblogy/ulisp-builder ..And an accompanying article to describe how it works: uLisp Builder - http://www.ulisp.com/show?3F07 http://www.ulisp.com/show?3F07 Also, a treasure trove of other Arduino and AVR projects by the author here: http://www.technoblogy.com/ http://www.technoblogy.com/
- Iwan-Zotow 6y agofemtolisp?
- Graziano_M 6y agoThere'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/ https://github.com/whitecatboard/Lua-RTOS-ESP32/ [2] https://fennel-lang.org https://fennel-lang.org
- petre 6y agoHow 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. https://tasmota.github.io/docs/Berry/ https://tasmota.github.io/docs/Berry/
- Graziano_M 6y agoI 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.
- quchen 6y agoThis 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?
- all2 6y agoThe 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: https://www.iro.umontreal.ca/~gambit/doc/gambit.html#C_002dinterface https://www.iro.umontreal.ca/~gambit/doc/gambit.html#C_002di... 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).
- cogburnd02 6y agoHaving never heard of Gambit, it looks like Gambit:Scheme::Awka:AWK https://github.com/noyesno/awka https://github.com/noyesno/awka
- fmakunbound 6y ago> but how do I persist my programs? (save-image 'your-fun)
- ethagnawl 6y ago> 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 https://gitlab.com/embeddable-common-lisp/ecl)
- 6y ago
- donquichotte 6y agoVery cool! Quite similar to fe [1], a tiny, embeddable Lisp by the magnificent rxi. Seriously, if you like games and gorgeous C and Lua code, check out his projects and the games on itch.io! [1] https://github.com/rxi/fe https://github.com/rxi/fe
- usgroup 6y agoI wonder if I could make a model to accurately predict the number of HNers over 50 years old by the number of Lisp related posts...hmmmmmm :-)
- oats 6y agoA few coders from each new generation rediscover the lisp arts... https://xkcd.com/297/ https://xkcd.com/297/
- iainctduncan 6y agoWell you know, once you hit your 40's (I'm 46), you've had lots of time to explore languages, and you really don't waste your limited life remaining coding in bad ones... haha
- alimw 6y agoIs it called that because u looks a bit like μ? How is it pronounced?
- circuit 6y agomicro
- quchen 6y agoYes, u is often used as an approximation to μ. Pronounce it »micro«. The most prominent abbreviation is uc for microcontroller, and uLisp is »Microlisp«.
- tester89 6y agoOddly enough, when I wrote uLisp as µLisp, the project lead edited my post to use uLisp instead.
- johnsondavies 6y agoI pronounce it 'U'-Lisp.
- geokon 6y agoI love lisps, but isn't using a garbage collected language on a micro a bit bizarre? I'm sure in lots of cases it won't matter, but then you could probably can use some cheap ARM SBC and IO pins (and a full dev environment). the Venn diagram of situations where a SBC won't do and you don't care about random pauses seems kinda small.. I could be wrong
- remexre 6y agoIf you care about latency, not performance, I think it's fine? You can do a Cheney semispace collector in which it's safe to allocate in interrupt handlers if you have control over the ABI (and you've got a few registers to spare) or if your instruction set provides an "increment this memory location" instruction.
- blihp 6y agoLots of people are embracing MicroPython and CircuitPython on microcontrollers these days. The computational capabilities of many of these devices exceeds what a high-end PC could do in the early/mid-90's. Many applications, especially hobbyist projects, are doing relatively mundane and low frequency work like turning things on and off and taking sensor readings at human scale intervals and then going to sleep. So why not?
- geokon 6y agoI'm not experienced in this whole area, so I meant to ask in an open ended way :) Does uLisp play well with sleep modes and setting up interrupts to come out of sleep and stuff? I've been wanting to build a lower power weather logger that can run on a battery for a year. While scoping out the difficulty of the project and digging into lower power stuff .. things got very hairy very fast (this was with STM32F1 chips). A GC seems like an added layer of complexity. Like what happens if you have garbage collection during an interrupt handler? Or if your garbage collection is interrupted by something else..? is garbage collection on its own timer/handler that you need to manage? Or is this built on top of the Arduino main-event-loop based model of programming? In which base it doesn't seem to be the normal interrupt driven thing you'd be looking at for lower power applications.. i think
- bryanlarsen 6y agoI see that on the 16 bit micros, numbers range from -32768 to 32767. Which means that bits aren't being stolen for either tags or garbage collection marking. Does that mean it uses boxing instead of tags, or are the tags just on the pointers, or is there some magic during the compilation step? I'm just partway through mal, which uses boxing, so I'd like to look at a simple implementation using tagging or another memory friendly implementation.
- munificent 6y agoFrom http://www.ulisp.com/show?1AWG http://www.ulisp.com/show?1AWG: > Every Lisp object is a two-word cell, representing either a symbol, number, or cons. (Also, it's fun to see that my article on GC was helpful. :) )
- bryanlarsen 6y agoSo basically using a full word for the tag, if I understand correctly.
- munificent 6y agoYup, exactly right.
- regularfry 6y agoSlightly surprised there's no Pico port, given other M0-based boards that are on the list.
- guenthert 6y agoGive it time, I'd say. The RP2040 is out just a couple of weeks and availability was spotty so far.
- johnsondavies 6y agoThere's a beta release: http://forum.ulisp.com/t/help-wanted-debugging-ulisp-for-the-raspberry-pi-pico/793 http://forum.ulisp.com/t/help-wanted-debugging-ulisp-for-the...
- dang 6y agoSome past threads: Lisp Badge: A single-board computer that you can program in uLisp - https://news.ycombinator.com/item?id=23729970 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 https://news.ycombinator.com/item?id=22640980 - March 2020 (35 comments) uLisp – ARM Assembler in Lisp - https://news.ycombinator.com/item?id=22117241 https://news.ycombinator.com/item?id=22117241 - Jan 2020 (49 comments) Ray tracing with uLisp - https://news.ycombinator.com/item?id=20565559 https://news.ycombinator.com/item?id=20565559 - July 2019 (10 comments) uLisp: Lisp for microcontrollers - https://news.ycombinator.com/item?id=18882335 https://news.ycombinator.com/item?id=18882335 - Jan 2019 (16 comments) GPS mapping application in uLisp - https://news.ycombinator.com/item?id=18466566 https://news.ycombinator.com/item?id=18466566 - Nov 2018 (4 comments) Tiny Lisp Computer 2 - https://news.ycombinator.com/item?id=16347048 https://news.ycombinator.com/item?id=16347048 - Feb 2018 (2 comments) uLisp – Lisp for the Arduino - https://news.ycombinator.com/item?id=11777662 https://news.ycombinator.com/item?id=11777662 - May 2016 (33 comments)
- loufe 6y agoI've got to check this project out. I've been playing around micro-controllers quite a lot lately and strangely Lisp is still my most fluent language from all my years of AutoLISP programming. What a great initiative.
- pdimitar 6y agoIs there a way for me to buy a pre-assembled Lisp Badge machine? I'm paying the cost of the machine + shipping + $150. Throw in a printed manual for good measure, too. :)