News for hackers. Stuff that matters.
Re:Lisp implementation in sed by abecedarius on Friday June 27, 2014 @06:48PM (#7956623)
I wrote that, and I gotta say sed is a much crazier target.

More sed fun: http://aurelio.net/projects/sedsokoban/

Re:Lisp implementation in sed by mzs on Friday June 27, 2014 @10:56PM (#7957290)
Kudos, there was also this one: http://www.cs.cmu.edu/afs/cs/Web/Groups/AI/lang/lisp/impl/aw... Possibly based on the same newsgroup post?
Re:Lisp implementation in sed by abecedarius on Friday June 27, 2014 @11:49PM (#7957356)
That one's a cooler hack because it runs in old awk, from before they supported user-defined functions. The whole read-eval-print composition is a straight-line series of loops, with the recursions unrolled into explicit stack manipulation. If you want to see how to write fairly readable code within those restrictions, it's instructive. It even has a cooler name. (I said so when bringing it up in my documentation.)

On the other hand, awklisp has some value as a readable Lisp interpreter in a lower-level but still reasonable language, in between the usual Lisp-in-Lisp and Lisp-in-C tutorials.

Re:Lisp implementation in sed by breadbox on Friday June 27, 2014 @06:57PM (#7956652)
Indeed. There are few wide-spread programming languages around any more that lack such things as, say, any form of arithmetic whatsoever.
Re:Lisp implementation in sed by mtdewcmu on Friday June 27, 2014 @07:32PM (#7956763)
sed has regular expressions. I think you could do some binary arithmetic fairly easily with regular expressions and find and replace...
Re:Lisp implementation in sed by breadbox on Friday June 27, 2014 @08:22PM (#7956919)
Yep, that's pretty much how you have to do it. (If all you need is increment/decrement, though, you can actually do it pretty concisely with decimal-digit strings. Skipping the binary-to-decimal conversion greatly simplifies displaying numerical values.)
Re:Lisp implementation in sed by mtdewcmu on Friday June 27, 2014 @08:40PM (#7956964)
The GNU sed manual has examples like that at the end. It always seemed odd to show examples of things that are so awkward and inefficient. If they meant for sed to do those things, presumably they would have made commands for them.
Re:Lisp implementation in sed by userbinator on Friday June 27, 2014 @10:02PM (#7957179)
> to show examples of things that are so awkward and inefficient
Re:Lisp implementation in sed by mtdewcmu on Saturday June 28, 2014 @12:29AM (#7957419)
Yeah. As in, better done in awk. The opposite of awkward is sedward.