wolfgangj / bone-lisp

The Bone Lisp programming language
Other
321 stars 21 forks source link

named subs? #19

Closed ownwaterloo closed 8 years ago

ownwaterloo commented 8 years ago

The doc says:

we only add a shortcut for anonymous subs with a single expression in the body...

Are there non-anonymous(or named) subs(like (fn f [x] ...) in Clojure) in bone? It can't be done by lambda or subs shortcut right? If it is the case, is it better to remove the word "anonymous" in the doc?

wolfgangj commented 8 years ago

Good catch. Since it is possible to do (mysub f | x (...)) (similar to how define works in Scheme), it is not only for anonymous subs.

Creating a function/subroutine and giving it a name have always been orthogonal operations in the Lisp tradition and I think this is the right thing. The equivalent of your Clojure example would be (with f | x (...) f), which certainly is a candidate for a macro.

ownwaterloo commented 8 years ago

The original statement could lead to (at least) two interpretations:

  1. There are anonymous and named subroutines, shortcut is for some of them(anonymous and with a single expression in the body).
  2. All subroutines are anonymous, shortcut is for some of them(with a single expression in the body).

I think the latter is correct and the word "anonymous" in that statement is confusing. It's better to remove it. That's my point.

About (fn f [x] ...) in Clojure, I'm not saying "bone or other lisps should support this" or something like that. I just need it to explain the opposite of anonymous subroutines.

ownwaterloo commented 8 years ago

clicked on the wrong button.

wolfgangj commented 8 years ago

Yes, you're right, I'm going to remove it. Thanks. :)