There are two kinds of programmers: those who don’t use Lisp, and those who need new parenthesis keycaps every six months. Lisp is one of those languages you either really love or really hate. If you love it, you may have checked out ulisp, which runs on Arduino boards of the AVR and ARM variety, as well as ESP chips, RISC-V, and others. A recent update allows the language to insert assembler into AVR programs.
We probably don’t need to convince anyone reading Hackaday why adding assembler is a good thing. It seems to integrate well with the environment, too, so you can write assembler macros in Lisp, which opens up many possibilities.
Of course, the format isn’t the same as your garden variety assembler. After all, Lisp should stand for “lots of irritating spurious parenthesis.” Plus your code needs to be position-independent since you’ll never know where it loads.
Here’s a simple example:
; Greatest Common Divisor
(defcode gcd (x y)
swap
($movw 'r30 'r22)
($movw 'r22 'r24)
again
($movw 'r24 'r30)
($sub 'r30 'r22)
($sbc 'r31 'r23)
($br 'cs swap)
($br 'ne again)
($ret))
(gcd 3287 3460)
There are more examples on the website, including direct I/O register manipulation.
We’ve seen badges running ulsip. Honestly, though, we’d be just as happy with Forth and it is easier on our parenthesis keys.
“There are two kinds of programmers: those who donβt use Lisp, and those who need new parenthesis keycaps every six months. ”
Exercise the foot.
The correct resolution of LISP is “lost in silly parenthesis.”
At least, that’s what the Pascal instructor told us 40 years ago.
Huge begin/end-trees distribute the stress for the keys better?
π
Pascal is as popular a language as Latin these days.
Our primary language used for Computer Science instruction at College was VAX Pascal (early 80s) . Turbo Pascal and finally Delphi on the home and work front. Pascal is such a nice language to work with. Object Pascal made it even better. At work all our editor/gui applications were written in Delphi. Delphi was fantastic environment to work in. Fast and productive. Later, I discovered Lazarus and FreePascal and still use them on the Linux side. Pascal is not the ‘buzzword’ of the day, but still a nice language to work with.
Lisp … At college we had to explore most of the languages available at the time. Lisp was one of them. Yuck. Rather program in Cobol with punched cards than fool around with Lisp. I don’t remember even one student at the time going ‘Yeah, love that Lisp language!’. We were glad to move on.
Be never heard of lisp before, but that code snippet looks horrible.
That’s LISP with embedded assembly code. Embedded assembly looks bad in just about any language.
The very idea of embedding assembly language in LISP is just … wrong.
LISP was one of the first real “high level” languages. It intended to get away from such hardware details.
Tell that to all the 1980s 8-bit computer makers, who realized how limited their interpreted languages were, and were forced to provide mechanisms for users to embed machine code.
I assume that an interpreter written for microcontrollers would have built-in ways of accessing low-level hardware, since microcontrollers are all about low-level hardware, but then, maybe embedded assembly is the best they could come up with.
If so, it’s still a poor solution. Those 1980s computers used embedded machine code, not embedded assembly, because it made more sense to assemble the machine code before embedding it in your high-level program, than to use resources on the micro to do the assembly.
I’ve*
LISP is a high security programming language as no one wants to deal with it.
Yeah. Real programmers prefer something simple.
Like Logo.
(I don’t use Lisp/Scheme much anymore, but spent many, many hours with FranzLisp, back in the day, and envied the kids down the corrider with the LMI and Symbolics machines. If you don’t get the joke, Logo was designed for kids, is easy, was very successful, and is, at heart, Lisp without parens)
I had a series of Symbolics Lisp Machines (including one with a Thinking Machines CM-2 as an attached processor). The most advanced IDEs of today have nothing over the Genera OS of the ’80s.
I wrote a 6502 assembler in Logo and it shipped with MIT Logo for the Apple II (Terrapin mostly) and also Commodore 64 Logo. There is also a MacLisp one I wrote but never used for real.
No…Just no…..let lisp die. It works in absolutes “Everything is a list!”….no…just make it stop….besides as others pointed out, thats assembly embdedded in lisp. While that is certainly an improvement over straight lisp, its still just wrong to pollute the pure assembly with ludicrous parenthesis assuming everything including functions are lists….
shouldn’t be long know before an AVR board becomes conscious and starts hacking it’s own mind… – fantastic !
Only used Lisp in college. Got bored with solving algorithms assignments in procedural languages so got permission to do assignments in Lisp from prof. He couldn’t tell if logic was correct by looking at code. I had to demonstrate solutions to prove correctness. Lol. I wish I still had that code. It was awful looking and awful to write and debug. I got over being bored thereafter.
Yeah, it’s just Hackaday, but never before have I encountered such a dense collection of ignorance, ill-informed diss, and overt malevolent prejudice, about anything that isn’t political. I was one of those kids down the corridor with a Symbolics machine (I worked there). The inherent asymmetry — how 10 seconds of quick snark asks for 30 minutes of thoughtful response — means I can’t even begin to address the dozen or more deserving points. Oh well. https://xkcd.com/386/
https://xkcd.com/224/
Lisp is one of these things i am hoping i never need to touch…
On uLisp’s website we have:
“You can use exactly the same uLisp program, irrespective of the platform.”
Sure. With embedded assembler. Can’t have it both ways – make up your mind.
But here’s the real horror of using embedded assembly in an interpreted language on a microcontroller:
“Because AVR processors can’t execute programs in RAM, the AVR assembler copies the assembled machine code from RAM to flash, so that it can be executed in flash.”
*shudder* Maybe they haven’t heard about the problem Tesla is having with the flash in their embedded systems wearing out, bricking the cars.
If I had that sort of lisp problem I’d make a custom keyboard that gave me foot pedals for parenthesis keys.