Yes, that's very succinct. Of course, it isn't cheap. I mean I wouldn't
put it in the inner loop of Robert's image processing code.
--
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 t
You win sir. That is the most beautiful way.
sincerely,
--Robert McIntyre
On Sun, Jan 30, 2011 at 7:59 PM, Bill James wrote:
> Alexander Yakushev wrote:
>> Why not use a constraint? It looks much cleaner.
>>
>> (defn hello [& {:keys [a b] :as input}]
>> {:pre [(= (set (keys input)) #{:
On Sun, Jan 30, 2011 at 5:08 PM, Alexander Yakushev
wrote:
>> Where is this documented?
>
> I couldn't find the documentation for it. I learned about them in Full
> Disclojure screencasts by Sean Devlin.
There is another, quite active thread on this topic right here, right
now. It includes some m
Alexander Yakushev wrote:
> Why not use a constraint? It looks much cleaner.
>
> (defn hello [& {:keys [a b] :as input}]
> {:pre [(= (set (keys input)) #{:a :b})]}
> "hello")
>
> You can learn more about constraints here:
> http://vimeo.com/channels/fulldisclojure#8399758
{:pre
> Where is this documented?
I couldn't find the documentation for it. I learned about them in Full
Disclojure screencasts by Sean Devlin.
--
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
On Sun, Jan 30, 2011 at 4:03 PM, Aaron Cohen wrote:
> On Sun, Jan 30, 2011 at 12:12 PM, Ken Wesson wrote:
>> On Sun, Jan 30, 2011 at 5:36 AM, Shantanu Kumar
>> wrote:
>>> On Jan 30, 2:17 pm, Alexander Yakushev
>>> wrote:
Why not use a constraint? It looks much cleaner.
(defn hell
On Sun, Jan 30, 2011 at 12:12 PM, Ken Wesson wrote:
> On Sun, Jan 30, 2011 at 5:36 AM, Shantanu Kumar
> wrote:
>> On Jan 30, 2:17 pm, Alexander Yakushev
>> wrote:
>>> Why not use a constraint? It looks much cleaner.
>>>
>>> (defn hello [& {:keys [a b] :as input}]
>>> {:pre [(= (set (key
On Sun, Jan 30, 2011 at 5:36 AM, Shantanu Kumar
wrote:
> On Jan 30, 2:17 pm, Alexander Yakushev
> wrote:
>> Why not use a constraint? It looks much cleaner.
>>
>> (defn hello [& {:keys [a b] :as input}]
>> {:pre [(= (set (keys input)) #{:a :b})]}
>> "hello")
Where is this docum
On Jan 30, 2:17 pm, Alexander Yakushev
wrote:
> Why not use a constraint? It looks much cleaner.
>
> (defn hello [& {:keys [a b] :as input}]
> {:pre [(= (set (keys input)) #{:a :b})]}
> "hello")
This is not the use case I was looking for (I listed it in a post
above). Constrai
Why not use a constraint? It looks much cleaner.
(defn hello [& {:keys [a b] :as input}]
{:pre [(= (set (keys input)) #{:a :b})]}
"hello")
You can learn more about constraints here:
http://vimeo.com/channels/fulldisclojure#8399758
--
You received this message because you are
On Sat, Jan 29, 2011 at 5:18 PM, Robert McIntyre wrote:
> I see, so you wanted to allow some subset of the optional arguments.
>
> Might I recommend the following?
> Sets are already functions that check for inclusion of the objects on
> which you call them, so instead of (contains? some-set ele)
On Jan 30, 3:18 am, Robert McIntyre wrote:
> I see, so you wanted to allow some subset of the optional arguments.
>
> Might I recommend the following?
> Sets are already functions that check for inclusion of the objects on
> which you call them, so instead of (contains? some-set ele) just
> (som
I see, so you wanted to allow some subset of the optional arguments.
Might I recommend the following?
Sets are already functions that check for inclusion of the objects on
which you call them, so instead of (contains? some-set ele) just
(some-set ele) will work. Also, upon actually making a typo
On Jan 30, 1:26 am, Robert McIntyre wrote:
> you could do something like this, but I'm curious --- why do you want
> to restrict the function's inputs in this way?
As they are optional arguments, it's possible that somebody might
misspell a key and spend time debugging. The intention is to avoid
you could do something like this, but I'm curious --- why do you want
to restrict the function's inputs in this way?
(defn hello [& {:keys [a b] :as input}]
(assert (= (set (keys input)) #{:a :b}))
"hello")
sincerely,
--Robert McIntyre
On Sat, Jan 29, 2011 at 1:19 PM, Shantanu Kumar
wrote:
>
Hi,
Given this example:
(defn hello [& {:keys [a b]}]
"hello")
=> (hello :foo "bar") ; :foo isn't listed!
"hello"
How can I disallow all keys except :a and :b in this example?
Regards,
Shantanu
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
16 matches
Mail list logo