TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

uLisp – Lisp for the Arduino

104 pointsby weeberalmost 9 years ago

9 comments

sigilalmost 9 years ago
This looks really neat! There was a story about Lisp at JPL that got me dreaming about embedded REPLs:<p><i>&gt; The Remote Agent software, running on a custom port of Harlequin Common Lisp, flew aboard Deep Space 1 (DS1), the first mission of NASA&#x27;s New Millennium program. Remote Agent controlled DS1 for two days in May of 1999. During that time we were able to debug and fix a race condition that had not shown up during ground testing. (Debugging a program running on a $100M piece of hardware that is 100 million miles away is an interesting experience. Having a read-eval-print loop running on the spacecraft proved invaluable in finding and fixing the problem.)</i> <a href="http:&#x2F;&#x2F;www.flownet.com&#x2F;gat&#x2F;jpl-lisp.html" rel="nofollow">http:&#x2F;&#x2F;www.flownet.com&#x2F;gat&#x2F;jpl-lisp.html</a><p>So often in embedded development I resort to things that make printf-style debugging look downright virtuous. (&quot;If you reach some complicated runtime state, blink the LED thrice.&quot;) Having a REPL would let you poke around without the compile-flash-test cycle and have an actual conversation with the hardware.
评论 #11790612 未加载
kazinatoralmost 9 years ago
Though uLisp has tail-call optimization, if the C compiler doesn&#x27;t, then the garbage collector needs stack in proportion to list length:<p><pre><code> void markobject (object *obj) { if (obj == NULL) return; object* arg = car(obj); if (marked(obj)) return; int type = obj-&gt;type; mark(obj); if (type != SYMBOL &amp;&amp; type != NUMBER) { &#x2F;&#x2F; cons markobject(arg); markobject(cdr(obj)); &#x2F;&#x2F; &lt;--- TAIL CALL! } } </code></pre> It&#x27;s simple enough to obj = cdr(obj) and wrap a loop around this.
评论 #11802405 未加载
评论 #11792197 未加载
AceJohnny2almost 9 years ago
The AVR cpu at the core of the Arduino uses a (modified) Harvard architecture., which separates code from data memory. A key feature of lisp of that code IS data. How does uLisp bridge the contradiction?
评论 #11789748 未加载
评论 #11790855 未加载
评论 #11789936 未加载
nice_bytealmost 9 years ago
&gt; It&#x27;s also an ideal language for expressing complex ideas, such as [...] finding the shortest route on a map<p>So, I googled &quot;Dijkstra&#x27;s Algorithm in Lisp&quot; and got this: <a href="http:&#x2F;&#x2F;richardsherriff.com&#x2F;?p=233" rel="nofollow">http:&#x2F;&#x2F;richardsherriff.com&#x2F;?p=233</a><p>Now, I&#x27;m no lisp expert, so I can&#x27;t judge whether the author of this code actually knows what they&#x27;re doing, but I know for sure that in an imperative language the implementation of the algorithm is much more concise and understandable.<p>I have concluded from my observations that claims of Lisp being &quot;easier&quot;, &quot;ideal for learning fundamental programming concepts&quot; and &quot;more expressive&quot; are exaggerated.
评论 #11789742 未加载
评论 #11790035 未加载
评论 #11789938 未加载
评论 #11790025 未加载
评论 #11790227 未加载
pclalmost 9 years ago
<i>uLisp includes a mark and sweep garbage collector. Garbage collection takes under 1 msec on an Arduino Uno or under 3 msec on an Arduino Mega 2560.</i><p>I wonder how predictable and controllable that is. Adding GC to what is likely to be a real-time device seems like a potential showstopper. But if the numbers can be a bit more firm, or if the application can receive alerts on pause &#x2F; resume, that might not be such a big deal.
评论 #11789858 未加载
评论 #11790570 未加载
WillPostForFoodalmost 9 years ago
Lisp for Arduino sounds great. The C programming barrier has kept me from tinkering with Arduino. Does this give you access to arduino shields&#x2F;expansion boards (wifi&#x2F;gps&#x2F;screens), or will that be dependent on device drivers?
评论 #11789944 未加载
fu86almost 9 years ago
Nice! This reminds me of my tiny Lisp Machine project: <a href="https:&#x2F;&#x2F;aaron-fischer.net&#x2F;tdn" rel="nofollow">https:&#x2F;&#x2F;aaron-fischer.net&#x2F;tdn</a> <a href="https:&#x2F;&#x2F;translate.google.com&#x2F;translate?hl=en&amp;sl=de&amp;tl=en&amp;u=https%3A%2F%2Faaron-fischer.net%2Ftdn" rel="nofollow">https:&#x2F;&#x2F;translate.google.com&#x2F;translate?hl=en&amp;sl=de&amp;tl=en&amp;u=h...</a>
nikolayalmost 9 years ago
This reminds me of muLISP [0].<p>[0]: <a href="https:&#x2F;&#x2F;de.wikipedia.org&#x2F;wiki&#x2F;MuLISP" rel="nofollow">https:&#x2F;&#x2F;de.wikipedia.org&#x2F;wiki&#x2F;MuLISP</a>
评论 #11789838 未加载
DigitalJackalmost 9 years ago
Clojure is my favorite language, and I&#x27;d probably like scheme just as well if it had the easy to use (yet advanced) Data structures of clojure. I just can&#x27;t seem to get my brain to mesh with Common Lisp yet, but I periodically dip my toes to test the water.<p>That said, I just don&#x27;t get statements like:<p>&quot;It&#x27;s also an ideal language for expressing complex ideas, such as teaching a robot to solve mazes or finding the shortest route on a map.&quot; More ideal than C, sure. But I don&#x27;t see the huge advantage over other high level languages.