News for hackers. Stuff that matters.
Re:A Lisp in 99LOC by eqvinox on Saturday August 16, 2025 @09:37PM (#44928240)
Holy cow this is —structurally, not just expression— some of the worst C code I have ever seen, with the abuse of the 'double' type, 'T' cast that looks like a declaration, endian dependency, and strict aliasing violations galore… does this even work on a modern compiler? o.O
Re:A Lisp in 99LOC by OhMeadhbh on Sunday August 17, 2025 @12:10AM (#44928789)
Yeah. It's munged to fit in 99 lines.
Re:A Lisp in 99LOC by eqvinox on Sunday August 17, 2025 @04:45AM (#44929989)
That's besides my point, which is why I said "structure, not just expression".

It could've used a struct rather than wedging tags into a double's first byte and still be 99 lines.

Re:A Lisp in 99LOC by Spivak on Sunday August 17, 2025 @10:48AM (#44931961)
If that's the trick you object to then you will be sad to hear that Ruby uses it.
Re:A Lisp in 99LOC by fami-com on Sunday August 17, 2025 @01:47PM (#44933408)
That's a standard technique in interpreters. All non-toy Javascript engines use it, for example.
Re:A Lisp in 99LOC by cardiffspaceman on Sunday August 17, 2025 @04:07PM (#44934506)
Nan-boxing is awesome.
Re:A Lisp in 99LOC by omoikane on Saturday August 16, 2025 @10:30PM (#44928428)
It does not, because there is a syntax error on line 81 (extra close parenthesis):

https://github.com/Robert-van-Engelen/tinylisp/blob/2d0fb35b...

Re:A Lisp in 99LOC by Y_Y on Sunday August 17, 2025 @12:28AM (#44928863)
Brought to you by this marvellous commit with the message "update",

https://github.com/Robert-van-Engelen/tinylisp/commit/40c6c0...

Re:A Lisp in 99LOC by messe on Sunday August 17, 2025 @04:49AM (#44929998)
Surpringly readable though, despite all that, if you've ever implanted a language in similar constraints.
Re:A Lisp in 99LOC by messe on Sunday August 17, 2025 @05:43PM (#44935181)
*implemented.

Too late to edit now.

Re:A Lisp in 99LOC by f1shy on Sunday August 17, 2025 @06:32AM (#44930531)
Certainly not the worst I have seen, by far; but yes, not pretty. IMHO “Just for making it shorter“. I would very much prefer 200 lines of actually readable nice code.
Re:A Lisp in 99LOC by sevensor on Sunday August 17, 2025 @10:11AM (#44931688)
For reading, I enjoyed fe, which was very clear: https://news.ycombinator.com/item?id=36239175
Re:A Lisp in 99LOC by f1shy on Sunday August 17, 2025 @12:11PM (#44932631)
Yes! Exactly what I meant. 700 lines, but of code that can be understood, and looks clearly as C. Also btw, the general file structure, the documentation, I prefer fe any day of the week. Thanks for pointing that out, I will take a look at it.