Re: I tripped out

2013-05-08 Thread Gunnar Völkel
You might be interested in https://github.com/guv/clojure.options/

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I tripped out

2013-05-07 Thread Pierre-Yves Ritschard
atkaaz, you can do this: (fn [ {:keys [arg1 arg2 arg3]}] ...)


On Mon, May 6, 2013 at 10:03 PM, AtKaaZ atk...@gmail.com wrote:

 I agree, I'm not sure what he means xD
 If you ask me, I'd rather have each arg be identified by a keyword instead
 of by order
 like: (somefn :arg1 somestr :arg3 100 :arg2 (+ 1 2))
 or all those in a map
 I'll probably still do that for me, so that any function will take params
 like this. There's probably a way this can be done but it's not good enough
 for me, was it with :keys and :as map ?



 On Sun, May 5, 2013 at 10:52 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Tell us more about it.


 On Sunday, May 5, 2013 11:54:32 AM UTC+4, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args
 for a function you're basically just destructuring an arg vector?  It
 trips me out.

  --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




  --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I tripped out

2013-05-07 Thread AtKaaZ
yes, thank you, that is what I was referring to + the :or and :as like:
(defn somefn
  [req1 req2 ;required params
{
  :keys [a b c d e] ;optional params
  :or {a 1 ;optional params with preset default values other than the
nil default
   ; b takes nil if not specified on call
   c 3 ; c is 3 when not specified on call
   d 0 ; d is 0 --//--
   ; e takes nil if not specified on call
   }
  :as mapOfParamsSpecifiedOnCall
  }]
  (println req1 req2 mapOfParamsSpecifiedOnCall a b c d e)
  )
;= (somefn 9 10 :b 2 :d 4)
;9 10 {:b 2, :d 4} 1 2 3 4 nil
;nil

this may be good for most people, but not for me. I've tried implementing
something for me but I have it only half way done (and I haven't looked at
in in a few months) it's here [1] but u won't like how it looks xD

meanwhile I realized what OP was saying with destructuring the arg vector.

[1]
https://github.com/DeMLinkS/demlinks/blob/7064df0491ea2b565f6edf18708a599af8b37a33/src/util/funxions.clj


On Tue, May 7, 2013 at 9:58 AM, Pierre-Yves Ritschard p...@spootnik.orgwrote:

 atkaaz, you can do this: (fn [ {:keys [arg1 arg2 arg3]}] ...)


 On Mon, May 6, 2013 at 10:03 PM, AtKaaZ atk...@gmail.com wrote:

 I agree, I'm not sure what he means xD
 If you ask me, I'd rather have each arg be identified by a keyword
 instead of by order
 like: (somefn :arg1 somestr :arg3 100 :arg2 (+ 1 2))
 or all those in a map
 I'll probably still do that for me, so that any function will take params
 like this. There's probably a way this can be done but it's not good enough
 for me, was it with :keys and :as map ?



 On Sun, May 5, 2013 at 10:52 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Tell us more about it.


 On Sunday, May 5, 2013 11:54:32 AM UTC+4, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args
 for a function you're basically just destructuring an arg vector?  It
 trips me out.

  --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




  --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




  --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I tripped out

2013-05-06 Thread AtKaaZ
I agree, I'm not sure what he means xD
If you ask me, I'd rather have each arg be identified by a keyword instead
of by order
like: (somefn :arg1 somestr :arg3 100 :arg2 (+ 1 2))
or all those in a map
I'll probably still do that for me, so that any function will take params
like this. There's probably a way this can be done but it's not good enough
for me, was it with :keys and :as map ?



On Sun, May 5, 2013 at 10:52 PM, Alex Fowler alex.murat...@gmail.comwrote:

 Tell us more about it.


 On Sunday, May 5, 2013 11:54:32 AM UTC+4, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args for
 a function you're basically just destructuring an arg vector?  It trips
 me out.

  --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




I tripped out

2013-05-05 Thread JvJ
Is anyone else tripped out when they realize that when you write args for a 
function you're basically just destructuring an arg vector?  It trips 
me out.

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I tripped out

2013-05-05 Thread Gary Trakhman
We write all these s-exps, but in the end it's just convenient ways to
control electricity, and we are Magneto.

On Sunday, May 5, 2013, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args for
 a function you're basically just destructuring an arg vector?  It trips
 me out.

 --
 --
 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+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I tripped out

2013-05-05 Thread James MacAulay
Yeah. It seems like the logical extension of this would be to allow (fn args 
expr) to be equivalent to (fn [ args] expr)...but I'm not sure how useful that 
would actually be.

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I tripped out

2013-05-05 Thread Alex Fowler
Tell us more about it.

On Sunday, May 5, 2013 11:54:32 AM UTC+4, JvJ wrote:

 Is anyone else tripped out when they realize that when you write args for 
 a function you're basically just destructuring an arg vector?  It trips 
 me out.

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.