On Tue, Jan 27, 2009 at 3:13 PM, Chouser <chou...@gmail.com> wrote:
>
> On Tue, Jan 27, 2009 at 4:04 PM, Mark Volkmann
> <r.mark.volkm...@gmail.com> wrote:
>>
>> I ran across two dispatch macros today that I haven't seen before.
>>
>> What does #= do? I see in LispReader.java that it uses an EvalReader
>> which is also defined in that source file, but it's not clear to me
>> what it does.
>
> It's used by the print-dup mechanism to print and re-create objects of
> exactly the right type.
>
> For example, normally a sorted-set prints identically as a hash-set,
> so printing and re-reading would create an object of a different type:
>
> user=> (prn (sorted-set 1 2 3))
> #{1 2 3}
> nil
>
> print-dup and #= work around this:
>
> user=> (binding [*print-dup* true] (prn (sorted-set 1 2 3)))
> #=(clojure.lang.PersistentTreeSet/create [1 2 3])
> nil
>
> My understanding is that #= forms are not meant to be writen or read
> by humans.  They're for data storage, AOT compilations, etc.

Thanks! It sounds like something I should ignore for now.

>> What does #! do? I see in LispReader.java that it uses a
>> CommentReader. Is it just an alternative for a semicolon?
>
> Yes, but it's specifically meant to be used as the first line of a
> file, to allow Clojure script to use unix "shebang" format.

What should follow it? Something like this?
#!/Users/Mark/bin/clj

That's the path to where my clj script is located.

I created a script named shebang.clj that contains that line and
(println "Hello"). Then I tried to run it with ./shebang.clj, but it
tried to run it with bash instead of my clj script and didn't
understand "println".

-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to