Thanks for the help Lauri!
John
On Oct 25, 10:29 am, Lauri Pesonen wrote:
> Hi John,
>
> 2009/10/25 jsrodrigues :
>
>
>
> > When I try the following:
> > user=> (into {} (map #([% (* % %)]) [1 2 3 4]))
>
> The #(...) form assumes that the is a function call and thus it is
> implicitly wrapped i
Thanks Lauri. I was stuck on this too.
FYI this issue prompted me to submit a patch to improve the arity
error message:
http://groups.google.com/group/clojure/browse_thread/thread/de969a419a535a82
--~--~-~--~~~---~--~~
You received this message because you are s
Hi John,
2009/10/25 jsrodrigues :
>
> When I try the following:
> user=> (into {} (map #([% (* % %)]) [1 2 3 4]))
The #(...) form assumes that the is a function call and thus it is
implicitly wrapped in parens. That is, #(+ % %) becomes (fn [x] (+ x
x)). So in your code the anonymous function bo
Hi,
I'm trying to find the #(...) equivalent of (fn [] ...) for the
following case:
user=> (into {} (map (fn [x] [x (* x x)]) [1 2 3 4]))
{4 16, 3 9, 2 4, 1 1}
When I try the following:
user=> (into {} (map #([% (* % %)]) [1 2 3 4]))
I get the error:
java.lang.RuntimeException: java.lang.Illeg
Thanks for the explanation!
So the solution is much simpler:
user=> (-> person :childs first (select-keys [:name]))
{:name "Son"}
Cool :-)
On Sep 22, 3:26 pm, Jarkko Oranen wrote:
> On Sep 22, 3:58 pm, Roman Roelofsen
> wrote:
>
>
>
> > Hi there!
>
> > Lets assume I have this map:
>
> > us
On Sep 22, 3:58 pm, Roman Roelofsen
wrote:
> Hi there!
>
> Lets assume I have this map:
>
> user=> (def person {:name "Father" :childs [{:name "Son" :age 10}]})
>
> Testing:
>
> user=> (-> person :childs first)
> {:name "Son", :age 10}
>
> Now lets filter the child map:
>
> user=> (def only-nam
Hi Roman!
On Tue, Sep 22, 2009 at 2:58 PM, Roman Roelofsen <
roman.roelof...@googlemail.com> wrote:
>
> Hi there!
>
> Lets assume I have this map:
>
> user=> (def person {:name "Father" :childs [{:name "Son" :age 10}]})
>
> Testing:
>
> user=> (-> person :childs first)
> {:name "Son", :age 10}
>
Hi there!
Lets assume I have this map:
user=> (def person {:name "Father" :childs [{:name "Son" :age 10}]})
Testing:
user=> (-> person :childs first)
{:name "Son", :age 10}
Now lets filter the child map:
user=> (def only-name (fn [m] (select-keys m [:name])))
user=> (-> person :childs first