Message info
 
To:clojure@googlegroups.com From:Aaron Cohen Subject:Re: why can i not shut-down my pc from Java? Date:Mon, 7 May 2012 16:59:00 -0400
 

On Mon, May 7, 2012 at 4:53 PM, Jim - FooBar(); <jimpil1985@gmail.com> wrote:
Following my earlier post, i tried converting the working shutdown
function into a multi-method in order to make it cleaner to read... However for some reason the compiler is complaining and i can't pinpoint wheere the problem is! This is the multi-method:
------------------------------------------------------------------------------------------------------------------------------------
(defmulti halt
(fn []

Your dispatch function takes 0 arguments.
(let [os (System/getProperty "os.name")]
(if (.startsWith os "Mac OS") :Linux (keyword os)))))
<...>
when calling (halt "some-password" 1) i'm getting this:

You invoke your multimethod with 2 arguments. You need to change your dispatch function to take 2 arguments (it can ignore them if you don't need them).

Also... do you actually find this easier to read? How many OSes are you eventually planning to support?

--Aaron

--
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
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en