Re: "special form" vs. "macro"

2010-06-01 Thread Sina K. Heshmati
alux wrote: > no special form at all? Cool, I'll have a look. > > Chapter 4.1 and 4.2 actually sit on my desk already since yesterday - > I just didnt read it. I hope I get a chance in the next days. If you have the time and motivation, go for it. Please note that, the wizard book had better be

Re: "special form" vs. "macro"

2010-06-01 Thread Konrad Hinsen
On 1 Jun 2010, at 21:38, alux wrote: In a lazy lisp if and cond can be plain functions. But to define plain functions, or in any case somewhere, I need a special form. Is it that what you mean? Not quite, though it's true as well. What I meant is that you can't define if/cond as a function i

Re: "special form" vs. "macro"

2010-06-01 Thread alux
Hello SinDoc, no special form at all? Cool, I'll have a look. Chapter 4.1 and 4.2 actually sit on my desk already since yesterday - I just didnt read it. I hope I get a chance in the next days. Many thanks, alux On 1 Jun., 09:38, "Sina K. Heshmati" wrote: > "alux" said: > > Hey alux, > > > wh

Re: "special form" vs. "macro"

2010-06-01 Thread alux
Hello Konrad, to ensure I understand you right (I want to understand your words, so in this very moment I dont care about other wordings): In a lazy lisp if and cond can be plain functions. But to define plain functions, or in any case somewhere, I need a special form. Is it that what you mean?

Re: "special form" vs. "macro"

2010-06-01 Thread Konrad Hinsen
On 1 Jun 2010, at 09:18, alux wrote: So, if you have lazy-eval, there's no need for special-forms. This is obviousely correct for if / cond. If you define special forms as in Common Lisp (that's something I learned from this discussion), yes. If you define special forms as I think Clojur

Re: "special form" vs. "macro"

2010-06-01 Thread Sina K. Heshmati
"alux" said: Hey alux, > what an interesting discussion! Whoo! ;-) > > Many thanks four your comment. > >> So, if you have lazy-eval, there's no need for special-forms. > > This is obviousely correct for if / cond. > > Looking into the other special forms ( http://clojure.org/special_forms >

Re: "special form" vs. "macro"

2010-06-01 Thread alux
Hello SinDoc, what an interesting discussion! Whoo! ;-) Many thanks four your comment. You wrote > So, if you have lazy-eval, there's no need for special-forms. This is obviousely correct for if / cond. Looking into the other special forms ( http://clojure.org/special_forms ), I wouldnt know

Re: "special form" vs. "macro"

2010-05-31 Thread Joost
On May 31, 8:14 pm, Joost wrote: > > True, but that's more a question of the interface provided by def. The > real problem is that if you want to access the vars defined by that > function anywhere else, they need to be defined (if not initialized) > before you can compile the code. Meaning you ei

Re: "special form" vs. "macro"

2010-05-31 Thread Joost
On May 31, 7:54 pm, Meikel Brandmeyer wrote: > It works sometimes. Of course you can redef a Var via function. > > (defn foo [y] (def x y)) > (foo 5) > > However, you cannot define arbitrary Vars. > > (defn bar [x y] (def x y)) > (bar 'c 5) True, but that's more a question of the interface provid

Re: "special form" vs. "macro"

2010-05-31 Thread Meikel Brandmeyer
Hi, On Mon, May 31, 2010 at 10:21:14AM -0700, Quzanti wrote: > Are you sure that always works? > > I think I am misunderstanding Halloway's Taxonomy of Macro's chapter > > defstruct is written as a macro and Stuart then comments > > "This macro looks so simple that you may be tempted to try to

Re: "special form" vs. "macro"

2010-05-31 Thread Angel Java Lopez
Hi people! Nice explanation, about the difference of "special form" in Clojure, vs other Lisp. I remember (Queinnec Lisp?): lambda: to make "normal functions" mlambda: to make "macros" (something that produce a form, and then, evaluate that result) flambda: spread, non evaluation of parameters n

Re: "special form" vs. "macro"

2010-05-31 Thread Quzanti
Are you sure that always works? I think I am misunderstanding Halloway's Taxonomy of Macro's chapter defstruct is written as a macro and Stuart then comments "This macro looks so simple that you may be tempted to try to write it as a function. You won't be able to because def is a special form.

Re: "special form" vs. "macro"

2010-05-31 Thread Joost
On May 31, 4:35 pm, Quzanti wrote: > That was interesting. > > One more Q. > > What determines whether special forms can be used in functions eg you > can't def a variable in a fn. You can: user> (defn fun [v] (def my-v v)) user> (fun 'a) user> my-v a user> (fun 'b) user> my-v b I'm not aware

Re: "special form" vs. "macro"

2010-05-31 Thread Quzanti
That was interesting. One more Q. What determines whether special forms can be used in functions eg you can't def a variable in a fn. Is it there some rule or is it special form specific depending on (a) the intended use of the special form (b) the mechanics of getting the compiler to use the sp

Re: "special form" vs. "macro"

2010-05-31 Thread Patrick Stein
Maybe Clojure uses the term "special form" differently than Common Lisp does, but here's how to think of "special form" in the Common Lisp sense. A form that is *NOT* a special form like (F A B C D ...) will either evaluate: 1. (SYMBOL-FUNCTION F), then A, B, C, D, ... in order from left-to- righ

RE: "special form" vs. "macro"

2010-05-31 Thread Sina K. Heshmati
"Sina K. Heshmati" said: > "alux" said: > >> I got a very basic question about the concept of "special form". What >> is correct, multiple selections allowed: >> >> [ ] A special form is what can be implemented by a macro. > > Wrong. Macros cannot remove the need for special-forms, at least no

RE: "special form" vs. "macro"

2010-05-31 Thread Sina K. Heshmati
"alux" said: > I got a very basic question about the concept of "special form". What > is correct, multiple selections allowed: > > [ ] A special form is what can be implemented by a macro. Wrong. Macros cannot remove the need for special-forms, at least not in a real interpreter. In a metaci

Re: "special form" vs. "macro"

2010-05-31 Thread Konrad Hinsen
On 31 May 2010, at 11:08, alux wrote: Hello Konrad, many thanks, that clarifies it! So, in "A special form is always built in, and cannot be implemented in the language itself." the first part is true, the second is not. Like most lisps have a bilt in list-reverse for speed reasons. In that cas

Re: "special form" vs. "macro"

2010-05-31 Thread alux
Hello Konrad, many thanks, that clarifies it! So, in "A special form is always built in, and cannot be implemented in the language itself." the first part is true, the second is not. Like most lisps have a bilt in list-reverse for speed reasons. In that case, this build in thing is a special form

Re: "special form" vs. "macro"

2010-05-31 Thread Jarkko Oranen
On May 31, 10:35 am, alux wrote: > [  ] A special form is what can be implemented by a macro. That depends. My understanding is that a special form is something that is "fundamental" to the language, that the evaluator handles as a special case. That is, they need to be implemented in the compil

Re: "special form" vs. "macro"

2010-05-31 Thread Konrad Hinsen
On 31 May 2010, at 09:35, alux wrote: I got a very basic question about the concept of "special form". What is correct, multiple selections allowed: [ ] A special form is what can be implemented by a macro. Wrong. You cannot implement a Lisp-like language with just macros and functions. At

"special form" vs. "macro"

2010-05-31 Thread alux
Hi, I got a very basic question about the concept of "special form". What is correct, multiple selections allowed: [ ] A special form is what can be implemented by a macro. [ ] Every macro gives a special form. [ ] Only a macro that doesn't evaluate some of its arguments gives a special form