On Mon, Feb 2, 2009 at 1:34 PM, wubbie wrote:
>
> any concrete example?
http://github.com/karmazilla/textjure/blob/cf4ac457358e02f1d1d46d14a2885da0544dbd46/textjure.clj#L342
>
> thanks,
> -sun
>
>
> On Feb 2, 5:13 am, Christian Vest Hansen wrote:
>> On Sun, Feb 1, 2009 at 9:35 PM, e wrote:
>>
On Mon, Feb 2, 2009 at 6:34 AM, wubbie wrote:
>
> any concrete example?
Here's an example of how -> makes it easy to get data out of nested maps.
(def person {
:name "Mark Volkmann"
:address {
:street "644 Glen Summit"
:city "St. Charles"
:state "Missouri"
:zip 63304}
:emp
any concrete example?
thanks,
-sun
On Feb 2, 5:13 am, Christian Vest Hansen wrote:
> On Sun, Feb 1, 2009 at 9:35 PM, e wrote:
> > This may be obvious to others, but what's the motivation behind it? Is it
> > that we are very concerned about combatting the criticism that lisp has too
> > many
On Sun, Feb 1, 2009 at 9:35 PM, e wrote:
> This may be obvious to others, but what's the motivation behind it? Is it
> that we are very concerned about combatting the criticism that lisp has too
> many parens?
The -> macro is simply an excellent tool for drilling into nested
structures and/or p
On Feb 1, 3:35 pm, e wrote:
> This may be obvious to others, but what's the motivation behind it? Is it
> that we are very concerned about combatting the criticism that lisp has too
> many parens?
>
Applying functions in succession without giving a name to each
intermediate value can be very
This may be obvious to others, but what's the motivation behind it? Is it
that we are very concerned about combatting the criticism that lisp has too
many parens?
On Sun, Feb 1, 2009 at 3:09 PM, kkw wrote:
>
> Hi sun,
>
>I thought this question looked familiar. I found some answers here
>
Hi sun,
I thought this question looked familiar. I found some answers here
also:
http://groups.google.com/group/clojure/browse_thread/thread/1f21663ea1ae9f58/
Kev
On Feb 2, 2:29 am, Adrian Cuthbertson
wrote:
> Sorry! That should have read;
> (-> m :one :b)
> 2
>
>
>
> On Sun, Feb 1, 2009
Sorry! That should have read;
(-> m :one :b)
2
On Sun, Feb 1, 2009 at 5:13 PM, e wrote:
> I was able to work through the first two examples, and thanks for those. I
> will have to study maps more, I guess, to understand the last one. I don't
> know where 'x' came from:
>>
>> user=> (-> x :one
I was able to work through the first two examples, and thanks for those. I
will have to study maps more, I guess, to understand the last one. I don't
know where 'x' came from:
>
> user=> (-> x :one :b)
> 2
>
>
--~--~-~--~~~---~--~~
You received this message becau
On Sun, Feb 1, 2009 at 8:14 AM, Adrian Cuthbertson
wrote:
>
> I would say "thread" is used here colloquially - i.e. "works the expr
> through the forms" and "form" is as defined in clojure.org/reader.
Well ... not really. There is no place on that page that says anything
like "A form is ...". It
I would say "thread" is used here colloquially - i.e. "works the expr
through the forms" and "form" is as defined in clojure.org/reader.
On Sun, Feb 1, 2009 at 4:01 PM, e wrote:
> is there a definition of "thread" somewhere, and a definition of "form"
> somewhere?
>
> Thanks.
>
> On Sat, Jan 31,
is there a definition of "thread" somewhere, and a definition of "form"
somewhere?
Thanks.
On Sat, Jan 31, 2009 at 10:31 PM, Jason Wolfe wrote:
>
> On Jan 31, 7:09 pm, wubbie wrote:
> > Hi,
> >
> > I saw in ants.clj a notation (->).
> > what is it?
> > For example,
> > (defn place [[x y]]
> >
Some examples...
; using ->
(f1 (f2 (f3 (f4 x
; can be "flattened" to
(-> x f4 f3 f2 f1)
Useful for nested maps...
user=> (def m {:one {:a 1 :b 2 :c {:x 10 :y 11}}} )
#'user/m
user=> (-> m :one :c :x)
10
user=> (-> x :one :b)
2
On Sun, Feb 1, 2009 at 5:31 AM, Jason Wolfe wrote:
>
> On Jan
On Jan 31, 7:09 pm, wubbie wrote:
> Hi,
>
> I saw in ants.clj a notation (->).
> what is it?
> For example,
> (defn place [[x y]]
> (-> world (nth x) (nth y)))
Did you check the docs?
On the website:
http://clojure.org/API#toc21
Within clojure itself:
user> (doc ->)
Hi,
I saw in ants.clj a notation (->).
what is it?
For example,
(defn place [[x y]]
(-> world (nth x) (nth y)))
thanks in advance.
-sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to
Yeah, doto is a handy complement to ->. I forgot about doto, and
there's a place some code which I'll use now. Thanks Mark!
Kev
On Jan 13, 6:38 am, "Mark Volkmann" wrote:
> On Mon, Jan 12, 2009 at 11:15 AM, Michael Reid wrote:
>
> > On Sun, Jan 11, 2009 at 9:12 PM, Mark Triggs
> > wrote:
>
>
On Mon, Jan 12, 2009 at 11:15 AM, Michael Reid wrote:
>
> On Sun, Jan 11, 2009 at 9:12 PM, Mark Triggs wrote:
>>
>> I've also found this useful for accessing members in nested maps. For
>> example:
>>
>> (let [me {:person {:name {:first "Mark"
>>:last "Triggs"}
>>
On Sun, Jan 11, 2009 at 9:12 PM, Mark Triggs wrote:
>
> I've also found this useful for accessing members in nested maps. For
> example:
>
> (let [me {:person {:name {:first "Mark"
>:last "Triggs"}
> :email "mark.h.tri...@gmail.com"}}]
>(-> me
I've also found this useful for accessing members in nested maps. For
example:
(let [me {:person {:name {:first "Mark"
:last "Triggs"}
:email "mark.h.tri...@gmail.com"}}]
(-> me :person :name :first))
=> "Mark"
On Jan 12, 1:04 pm, kkw w
One use I've found for -> (though there are others I haven't come to
appreciate yet) is when I have something like:
(f1 (f2 (f3 (f4 x
which can be re-written as
(-> x f4 f3 f2 f1)
I find the latter expression easier to read.
Kev
On Dec 30 2008, 2:49 pm, wubbie wrote:
> Very criptic for ne
Hi Timothy,
This is not really related to the current thread (sorry), but I want
to say thanks for this API examples page, it looks like it'll be a
great help, just what I need! Somehow I'd managed to completely miss
it until now when you mentioned it - either I'm partially blind, or it
could be
On Dec 30, 2:49 pm, wubbie wrote:
> Very criptic for newbie.
> What does "Threads the expr through the forms." mean?
Shameless plug, if you find learning from examples easier than textual
descriptions, you might want to look up
http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examp
Very criptic for newbie.
What does "Threads the expr through the forms." mean?
Does it create a thread to execute?
thanks
sun
On Dec 29, 10:07 pm, Paul Barry wrote:
> You can look up the documentation for a function/macro interactively
> from the repl:
>
> user=> (doc ->)
> --
You can look up the documentation for a function/macro interactively
from the repl:
user=> (doc ->)
-
clojure.core/->
([x form] [x form & more])
Macro
Threads the expr through the forms. Inserts x as the
second item in the first form, making a list of it if it is not a
On Mon, Dec 29, 2008 at 7:27 PM, wubbie wrote:
>
> Hi all,
>
> Looking into ants.clj, I came across
> (defn place [[x y]]
> (-> world (nth x) (nth y)))
>
> What -> mean here?
It means (nth (nth world x) y).
It "threads" world through the forms that follow.
First it makes world the second item i
Hi all,
Looking into ants.clj, I came across
(defn place [[x y]]
(-> world (nth x) (nth y)))
What -> mean here?
thanks
sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group,
26 matches
Mail list logo