For FAQ style plain text I like having the RHS comments moved below
the S-Expression as I can C-n down the file and do C-x C-e evaluation
to REPL as I go.
Once the RHS ;;;Comments are below the S-Expressions I find i like
having a symbol to indicate the eval =>
I took the liberty of re-formattin
> How did you know that it delegates to 'get'?
sorry, I rushed that part.
the keyword and symbol are instances of clojure.lang.Keyword and
clojure.lang.Symbol
which are _java_ classes found in Keyword.java and Symbol.java (I
found these in the src/jvm directory)
These are what the invoke( ) m
Neat :) Thanks for the in depth examination, that's a very clear
explanation!
--~--~-~--~~~---~--~~
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 unsubscr
On Mon, Dec 15, 2008 at 9:43 PM, Daniel Eklund wrote:
>
> > Looks like an if then else version of the map lookup??
> > ie: (if (%1 %2) (%1 %2) %3)
> > Is this a special feature of maps in general, such that you can look
> > up a key but return something else if it doesn't exist?
> > I hadn't come
> Looks like an if then else version of the map lookup??
> ie: (if (%1 %2) (%1 %2) %3)
> Is this a special feature of maps in general, such that you can look
> up a key but return something else if it doesn't exist?
> I hadn't come across it yet, but it sounds useful :)
This is exactly right (I j
> user=> ('b '{a 10, b 11, c 12})
> 11
Ah, yes so the 1 arg version is the map lookup, which also works in
reverse
user=> ('{a 10, b 11, c 12} 'b)
11
That makes perfect sense...
What is the 2 arg version?
user=> ('{a 10, b 11, c 12} 'b 'c)
11
user=> ('b '{a 10, b 11, c 12} 'c)
11
user=> ('b 'c '
What is the meaning of:
('+ '1 '2)
On the surface it appears that '2 is simply the last evaluated, but
lets try some similar calls:
user=> ('+)
java.lang.IllegalArgumentException: Wrong number of args passed to:
Symbol
user=> ('+ '1)
nil
user=> ('+ '1 '2)
2
user=> ('+ '1 '2 '3)
java.lang.IllegalA
On Mon, Dec 15, 2008 at 9:41 PM, Mark Volkmann
wrote:
>
> ; Quoting a list is *not* the same as quoting everyting inside it.
> (println ('+ '1 '2)) ; outputs 2 which is the value of the last item evaluated
Your example works, but your comment is not always true:
user=> ('+ '1)
nil
user=> ('+ '1
Here's a summary of what I think I know about quoting in Clojure. I'd
appreciate some feedback if I said anything wrong below or maybe
didn't describe something well.
; One use of quoting is to prevent a list from being evaluated
; where the first item is treated as the name of a function
; and t