On Fri, Feb 25, 2011 at 9:39 PM, Alan <[email protected]> wrote:
> On Feb 25, 6:21 pm, Ken Wesson <[email protected]> wrote:
>> On Fri, Feb 25, 2011 at 11:21 AM, Michael Wood <[email protected]> wrote:
>> > Would this help?
>>
>> > user=> (def exit "Use Ctrl-C to exit")
>> > #'user/exit
>> > user=> exit
>> > "Use Ctrl-C to exit"
>> > user=>
>>
>> Why stop there?
>>
>> (defn exit [] (System/exit 0))
>
> But then the user has to know to type exit instead of (exit). Let's
> give them the whole Python experience:
>
> akm@sultan:~$ java -cp src/clojure/sexpbot/lib/clojure-1.2.0.jar
> clojure.main
> Clojure 1.2.0
> user=> (def exit (repeatedly #(System/exit 0)))
> #'user/exit
> user=> exit
> akm@sultan:~$

I figured anyone using a Lisp REPL knows to wrap "command" like things
in parentheses. And would feel that an expression like "exit" without
parentheses having side effects would be pretty icky. :)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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