News for hackers. Stuff that matters.
Re:Lisp implemented in Rust macros by duetosymmetry on Friday September 13, 2024 @06:17PM (#41535713)
Greenspun's tenth rule strikes again! https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule
Re:Lisp implemented in Rust macros by ForOldHack on Friday September 13, 2024 @07:06PM (#41535993)
HA!

"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."

HA HA!

Re:Lisp implemented in Rust macros by dgfitz on Friday September 13, 2024 @06:27PM (#41535781)
What defines "sufficiently complicated" I wonder? Seems like a shit definition.
Re:Lisp implemented in Rust macros by StableAlkyne on Friday September 13, 2024 @06:37PM (#41535848)
It's just a funny observation he made, it's not meant to be a rigorous academic definition :)
Re:Lisp implemented in Rust macros by munificent on Friday September 13, 2024 @07:21PM (#41536087)
I like that the "sufficiently complicated" part bothered you, but not the "ad hoc", "informally-specified", "bug-ridden", or "slow" parts.
Re:Lisp implemented in Rust macros by krick on Saturday September 14, 2024 @12:38AM (#41537497)
No, I think it's pretty fair. One could argue about these, but except for "slow" these are more quality qualifiers, rather than quantity. So you either agree it's "bug-ridden" or not (i.e. the number and seriousness of bugs in it is negligible by whatever standards). And I think even "slow" can be discussed in the same manner, the actual speed is quantitative, of course, but in the end one either argues that this speed is "slow" or isn't. So, given some rhetoric skills of your opponent it's at least possible for that statement to be proven false, if he convinces you the implementation actually isn't slow nor bug-ridden, or at least if there's no Lisp-implementation indeed.

But what is "sufficiently" complicated? Now it's a silly statement that just doesn't pass Popper criterion: even if nobody dares to deny your program is complicated, one can always say it isn't sufficiently complicated, hence the fact it doesn't contain Lisp-interpreter disproves nothing. A man of culture wouldn't use such definitions.

Re:Lisp implemented in Rust macros by devjab on Saturday September 14, 2024 @01:41AM (#41537721)
Isn’t that sort of the point? It makes the argument impossible to dispute. If it’s not slow or big-ridden, then it’s just not sufficiently complicated. Which you’re correct to call out.

I think what makes it work is that Common Lisp very quickly becomes a faster way to do things because of how insanely efficient it is.

Re:Lisp implemented in Rust macros by samatman on Saturday September 14, 2024 @11:36AM (#41540486)
A man of culture would never refer to an epigram as a definition.
Re:Lisp implemented in Rust macros by dgfitz on Saturday September 14, 2024 @07:28PM (#41543885)
Which culture? What about women? What a strange comment.
Re:Lisp implemented in Rust macros by eyelidlessness on Friday September 13, 2024 @06:38PM (#41535852)
The rule defines it tautologically. Which is sufficiently unambiguous for its purpose!
Re:Lisp implemented in Rust macros by throw-the-towel on Friday September 13, 2024 @08:24PM (#41536483)
Greenspun's tenth rule, corollary: Any sufficiently precise definition of "complex system" contains an ad hoc, informal, bug-ridden, slow specification of half of Common Lisp.
Re:Lisp implemented in Rust macros by kazinator on Saturday September 14, 2024 @01:27AM (#41537672)
That's explicitly encoded right in the rule itself! When the program contains a bug-ridden, ad-hoc simulacrum of half (or more) of Common Lisp, then it has become sufficiently complicated. When it has less than half, it is not yet sufficiently complicated.
Re:Lisp implemented in Rust macros by ithkuil on Saturday September 14, 2024 @03:41AM (#41538179)
"for any sufficiently X the Y" just means that if you don't observe Y right now, just increase the magnitude of X and you'll inevitably reach the conditions for Y to happen.

Famous use of that pattern is Arthur's Clarke "Any sufficiently advanced technology is indistinguishable from magic.". As with OP's quote, this is also vague and imprecise but the point of the idea is that there is a gradient towards which advancements in technology bring us towards a situation where the average person no longer understands how it works and it may as well be magic (while not necessarily defining exactly when does that transition happen)

Re:Lisp implemented in Rust macros by orwin on Saturday September 14, 2024 @05:40AM (#41538644)
My experience is: once you have enough different FSM and reducers that you need to abstract them, the 'sufficiently complicated' criterion is made.
Re:Lisp implemented in Rust macros by bigdict on Saturday September 14, 2024 @12:02AM (#41537381)
nah, this is about codebases that are not themselves primarily lisp implementations
Re:Lisp implemented in Rust macros by kazinator on Saturday September 14, 2024 @01:25AM (#41537668)
This is correct. Greenspun's Tenth Rule is not meant to be interpreted as applying to projects that are consciously creating a Lisp implementation. It's about programs which are not meant to be language implementations at all reinventing ad hoc infrastructure that is designed in Lisps according to established patterns. For instance, badly reinventing something that functions as symbols.
Re:Lisp implemented in Rust macros by Nevermark on Saturday September 14, 2024 @03:46AM (#41538201)
I conjecture the line is not so easy to draw.

If you are creating Lisp because you want to create Lisp, like creating Lisp, want to show off creating Lisp, that obviously is not what the Law is about.

Furthermore, if you create Lisp because you know the Law, know it is inevitable, and want to avoid the caveats and missed bars by doing so explicitly, well then that also is not what the Law is about.

But if you are going about your business, focused on your independent goal, realize you need Lisp like lists, and then 250 lines of code later realize you have created a solid Lisp unintentionally? Well, congrats on falling into the trap but not getting hurt!

—

Personally, I have created both Lisp and Forth multiple times for suitable projects where I wanted some flexible runtime scripting. I am not familiar with the standard version libraries of either and don’t need them.

Minimal foundation implementations are extremely easy to create, and eliminate any dependencies or sources of mystery.

Anyone know of any other well designed mininal languages?

Re:Lisp implemented in Rust macros by pjmlp on Saturday September 14, 2024 @11:41AM (#41540528)
Except it is been like 60 years that any proper Lisp implementation has more than plain cons lists.
Re:Lisp implemented in Rust macros by PhilipRoman on Saturday September 14, 2024 @02:18AM (#41537852)
Pretty sure it applies to Common Lisp itself too.
Re:Lisp implemented in Rust macros by vasvir on Saturday September 14, 2024 @03:59AM (#41538249)
yes but not recursively!
Re:Lisp implemented in Rust macros by arnsholt on Saturday September 14, 2024 @04:27AM (#41538353)
The corollary to Greenspun’s rule is that any sufficiently complicated Common Lisp program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Prolog.
Re:Lisp implemented in Rust macros by hun3 on Saturday September 14, 2024 @07:44AM (#41539170)
It would be fun if it was "half Prolog, half Common Lisp"
Re:Lisp implemented in Rust macros by Guthur on Saturday September 14, 2024 @07:47AM (#41539186)
I've now used both professionally. I look forward to hopefully using both in the same project. Though not holding my breath.
Re:Lisp implemented in Rust macros by anthk on Sunday September 15, 2024 @04:54PM (#41550302)
Well, the 'PAIP' book for sure does it, literally.
Re:Lisp implemented in Rust macros by rfl890 on Saturday September 14, 2024 @10:34AM (#41540075)
I think that's the joke
Re:Lisp implemented in Rust macros by klrtaj on Saturday September 14, 2024 @09:15AM (#41539617)
A great example of the rule is that C++ rediscovers car/cdr at a glacial pace in the template language. In C++26 one can finally get the car of a typename parameter pack with Args...[0].

I've no idea why they don't introduce car/cdr functions and nil for empty parameter packs and allow to store parameter packs instead of the current syntax insanity.

Re:Lisp implemented in Rust macros by gpderetta on Saturday September 14, 2024 @10:44AM (#41540135)
C++ metaprogramming was done with cons cells already back in '98. The new syntax provides random access instead, which is completely different from linked lists.
Re:Lisp implemented in Rust macros by otabdeveloper4 on Saturday September 14, 2024 @01:02PM (#41541054)
Store where?

C++ templates are a lambda calculus, there's no notion of memory cells or state.

Re:Lisp implemented in Rust macros by jasfas on Saturday September 14, 2024 @02:17PM (#41541692)
In a struct! Pseudo code for extracting the types from subclasses and calling a multimethod on them:

  template <typename Result, typename Head, typename ...Tail>
  struct Foo : Visitor {
    Result res;
    UntypedList lst; // This does not exist!
    Tail... tail;    // This is not possible!
    Foo(UntypedList l; Head hd, Tail... tl) : lst(l), tail(tl) {
      hd->accept(*this);
    }
    void visit(float *f) {
      res = Foo<Result, Tail...>(append(lst, f), tail)::res; }
    }
  };
 
  // Base case that calls the multimethod omitted.
There are two issues here: You can't store the parameter pack in Foo() which is later required by the continuation in visit(). And you would have to use tuples and tuple_cat() instead of UntypedList.

Why can the compiler not infer the types in such an UntypedList? Why is there no car/cdr for tuples?

Re:Lisp implemented in Rust macros by gpderetta on Monday September 16, 2024 @04:38AM (#41554011)
Not sure what Untyped list is or supposed to do in the above. In fact I'm not sure what the code above is trying to do at all.

If you want a cons-based tuple, boost::tuple will work just fine (or you can implement your own, it is not hard). std::tuple is not (visibly) cons based.