How can i println an index of a vector?
tryed.
(println vector index)
like
(println x 0)
dosnt work.
/ a swede.
--
--
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
(println (v 0))
(v 0) would give you the element at index 0
(println ..) would print whatever you supply as its argument.
Cheers,
Omer
On Tue, Jan 14, 2014 at 6:44 PM, Andreas Olsson photoguy@gmail.comwrote:
How can i println an index of a vector?
tryed.
(println vector index)
Cant get this to work.
(def sx2(atom [2 3 4]))
(println (sx2 3))
Den tisdagen den 14:e januari 2014 kl. 12:04:27 UTC+1 skrev Omer Iqbal:
(println (v 0))
(v 0) would give you the element at index 0
(println ..) would print whatever you supply as its argument.
Cheers,
Omer
On Tue, Jan
an atom cannot be used as a function! deref it first to get the vector
inside and then try again...
Jim
On 14/01/14 11:25, Andreas Olsson wrote:
Cant get this to work.
(def sx2(atom [2 3 4]))
(println (sx2 3))
Den tisdagen den 14:e januari 2014 kl. 12:04:27 UTC+1 skrev Omer Iqbal:
thanks... this works
(println ((deref sx2) 4))
Den tisdagen den 14:e januari 2014 kl. 12:29:02 UTC+1 skrev Jim foo.bar:
an atom cannot be used as a function! deref it first to get the vector
inside and then try again...
Jim
On 14/01/14 11:25, Andreas Olsson wrote:
Cant get this
You could also write:
(println (@sx2 4))
On 14 January 2014 11:35, Andreas Olsson photoguy@gmail.com wrote:
thanks... this works
(println ((deref sx2) 4))
Den tisdagen den 14:e januari 2014 kl. 12:29:02 UTC+1 skrev Jim foo.bar:
an atom cannot be used as a function! deref it first
Okay,..
..learning one step at a time hear. =)
I´m good at basic.. this is some thing else.
Den tisdagen den 14:e januari 2014 kl. 12:38:34 UTC+1 skrev James Reeves:
You could also write:
(println (@sx2 4))
On 14 January 2014 11:35, Andreas Olsson photog...@gmail.comjavascript:
wrote:
Unless you are worrying about concurrency, you probably don't need an atom
at all:
(def sx2 [2 3 4])
(println (sx2 1))
On 14 January 2014 14:45, Andreas Olsson photoguy@gmail.com wrote:
Okay,..
..learning one step at a time hear. =)
I´m good at basic.. this is some thing else.
Den