;; you can evaluate:
(defn myfirst [x] (mysecond x))
;; then bind that to:
(defn mysecond [x] (+ x 1))
user> (myfirst 1)
=> 2

Which winds up being more better once you let go of the CL assumptions
about ns :)
I'm finding that part difficult as well.

On Dec 1, 10:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I'm reading through Practical Common Lisp as a way to get more
> familiar with Lisp.  In Chapter 4 I came across a stumbling block in
> the section "S-expressions As Lisp Forms."  Towards the end of that
> section it says
>
> "To determine what kind of form a given list is, the evaluator must
> determine whether the symbol that starts the list is the name of a
> function, a macro, or a special operator.  If the symbol hasn't been
> defined yet--as may be the case if you're compiling code that contains
> references to functions that will be defined later--it's assumed to be
> a function name."
>
> If I try to define the following function in the Clojure REPL I will
> get an exception saying it was unable to resolve the symbol, but that
> same method will simply give me a warning in CL stating that the
> method mysecond is undefined.
>
> (defn myfirst [] (mysecond))
>
> At first I thought maybe this has something to do with the fact that
> Clojure is a Lisp-1 vs. a Lisp-2, but the above is legal in MIT
> Scheme.
>
> So why is the above form not legal in Clojure?  I would think it might
> come in handy to define a function that relies on something currently
> not-yet-defined.  Why is this the appropriate behavior?
>
> Excuse my noise if this is already explained in the docs, or is
> obvious.
>
> -Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to