Re: [ANN] monarch 0.2.0 - Simple database migrations for Clojure.

2014-05-27 Thread Ray Miller
On 27 May 2014 01:02, Michael Cramm  wrote:
> Good question. I had originally wanted a separate, untracked config file but
> couldn't decide on a format. (like separating out protocol, host, port, etc)
> Exporting the environment variable felt the most non-committal at the time.

Don't underestimate the value of using environment variables for
configuration: they are simple and effective, and allow for a lot of
flexibility in testing and deployment.

> It wouldn't be too much work to have a file living in
> `resources/monarch/...`, and add another optional param to `project.clj` to
> tell monarch where to look. I'll see about adding this to the next version.

Do configuration files really belong in resources? They will then be
shipped with the compiled jar. From a DevOps point of view, we like to
separate code from config, and certainly don't want to compile a new
jar just to deploy with a different database configuration.

Ray.

-- 
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/d/optout.


clojure.lang.Atom cannot be cast to a java.lang.Num

2014-05-27 Thread Dylan Gleason
I am trying to read a TCP request via an instance of DataInputStream and am 
running into this error with the following code:

(defn receive
  [socket]
  (with-open [reader (DataInputStream. (.getInputStream socket))]
(let [length   (read-length reader)
  bytes-in (byte-array length)
  offset   (atom 0)
  index(atom 0)]
  (while (not= -1 @offset)
(reset! offset (.read reader bytes-in offset (- length index)))
(reset! index (+ index offset))

For some reason, trying to update the value in offset appears to result in 
this casting error. I tried testing a similar expression at the REPL, and 
it works, e.g.

> (def blah (atom 0))
> (reset! blah 93); no error

It seems odd that Clojure would complain about this, since "93" is an 
instance of java.lang.Long -- why would Clojure be so annoyingly 
anal-retentive when setting the atom to a java.lang.Num? Also, if anyone 
has any ideas on how to make achieve this without using atoms, and what the 
best approach would be (a recursive solution using loop-recur, perhaps?)

-- 
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/d/optout.


Re: [ANN] core.async (and more) video tutorials

2014-05-27 Thread László Török
Hi,


> Btw When I click on the download video button, nothing gets downloaded.
> Tried on Firefox/Chrome - Mac. Is that a known issue?
>
Same here. I could only download the videos I paid for, but not the free
one.


> Also, I had sent you this email via support on that site but didn't get
> any reply,
> so resending it on this thread.
>
+1


>
> Thanks a lot.
>
>

-- 
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/d/optout.


Re: clojure.lang.Atom cannot be cast to a java.lang.Num

2014-05-27 Thread Ambrose Bonnaire-Sergeant
You're adding two atoms together here:  (reset! index (+ index offset))

Thanks,
Ambrose


On Tue, May 27, 2014 at 3:43 PM, Dylan Gleason wrote:

> I am trying to read a TCP request via an instance of DataInputStream and
> am running into this error with the following code:
>
> (defn receive
>   [socket]
>   (with-open [reader (DataInputStream. (.getInputStream socket))]
> (let [length   (read-length reader)
>   bytes-in (byte-array length)
>   offset   (atom 0)
>   index(atom 0)]
>   (while (not= -1 @offset)
> (reset! offset (.read reader bytes-in offset (- length index)))
> (reset! index (+ index offset))
>
> For some reason, trying to update the value in offset appears to result in
> this casting error. I tried testing a similar expression at the REPL, and
> it works, e.g.
>
> > (def blah (atom 0))
> > (reset! blah 93); no error
>
> It seems odd that Clojure would complain about this, since "93" is an
> instance of java.lang.Long -- why would Clojure be so annoyingly
> anal-retentive when setting the atom to a java.lang.Num? Also, if anyone
> has any ideas on how to make achieve this without using atoms, and what the
> best approach would be (a recursive solution using loop-recur, perhaps?)
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: [ANN] monarch 0.2.0 - Simple database migrations for Clojure.

2014-05-27 Thread Manuel Paccagnella
Il giorno martedì 27 maggio 2014 08:16:49 UTC+2, Atamert Ölçgen ha scritto:
>
> You are welcome. Thanks for the library!
>
>
Second that.
 

> I have given it some more thought and I now realize local overrides for 
> leiningen config might not be a good idea. Perhaps application 
> configuration should be completely decoupled with packaging.
>
>
Indeed, I also agree with Ray Miller: configuration is 
environment-specific, the application is not (more or less). Environment 
variables are useful , but they have some 
limitations and, as usual, there are tradeoffs involved.
 

> I've found confijulate , 
> here.
>  
> It might be useful.
>

Well, ok. Another configuration library that I wasn't aware of when I wrote 
confunion . Another one that I found 
*after* writing mine is carica , which 
seems quite good. There are a bunch of them out there, you can look into 
Clojure 
Toolbox , probably there is already one 
that satisfies your use cases. 

Cheers,
Manuel

-- 
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/d/optout.


Re: [ANN] monarch 0.2.0 - Simple database migrations for Clojure.

2014-05-27 Thread Ray Miller
On 27 May 2014 09:35, Manuel Paccagnella  wrote:
>
>> I've found confijulate, here. It might be useful.
>
>
> Well, ok. Another configuration library that I wasn't aware of when I wrote
> confunion. Another one that I found after writing mine is carica, which
> seems quite good. There are a bunch of them out there, you can look into
> Clojure Toolbox, probably there is already one that satisfies your use
> cases.

Thank you for drawing all these configuration libraries to my
attention, this is something I've done in an ad hoc way for the
different applications I've written. I'll take a look at these before
rolling my own next time.

Ray.

-- 
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/d/optout.


Re: [ANN] core.async (and more) video tutorials

2014-05-27 Thread Juan Manuel Gimeno Illa
Seems strange. I get 0 downloads remaining for all the videos (both the 
free and the paid).

Juan Manuel

El martes, 27 de mayo de 2014 09:44:29 UTC+2, Las escribió:
>
> Hi,
>  
>
>> Btw When I click on the download video button, nothing gets downloaded.
>> Tried on Firefox/Chrome - Mac. Is that a known issue?
>>
> Same here. I could only download the videos I paid for, but not the free 
> one.
>
>
>> Also, I had sent you this email via support on that site but didn't get 
>> any reply,
>> so resending it on this thread.
>>
> +1
>  
>
>>
>> Thanks a lot.
>>
>> 

-- 
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/d/optout.


Re: How to refactor data safely?

2014-05-27 Thread Jakub Holy
Hello, thank you all for your tips! I'm away from my PC for a month so I 
will experiment with your proposals when I come back.

@Ulises, @Betrand: Hiding the access behind functions to limit the change 
to them is something I have also though of. The disadvantage is that I 
loose the benefit of destucturing and more documentary function signatures. 
But I want to try this out to see how it turns out to be,

@Aramndo: Thank you, that is a neat idea to use a temporary transformation 
fn that can produce the old structure from the new so that I could 
propagate the change slowly, one step at a time. I will look more into 
that. And if I am lucky with time, I will share my experience via a blog 
post.

@Laurent: I want a save way to change the data structure - this temporary 
ability to work with both shapes of data is one possible way of achieving 
it. Otherwise you captured it quite well. "You could implement a 
transitional protocol which would behave differently depending on how data 
is accessed" - yes, that is what I have been thinking about. I have never 
done such a thing but I guess it should not be too difficult. You have a 
good point with the necessity of compromises. I guess I can draw 
inspiration from Om's cursors 
that 
behave as data but are more than that, knowing their place in the larger 
structure and producing new cursors when accessed - they too have limits 
such as not working with lazy seqs (so f.ex. (remove ..) must be wrapped in 
(vec ...)) or sets.

I hope I will eventually get back with a report how the different 
approaches worked. More ideas are still welcome :-)

On Saturday, May 24, 2014 10:19:31 AM UTC+2, Laurent PETIT wrote:
>
> So you want a transition phase where existing consuming code can work with 
> both data shapes, and then start fixing functions one at a time to use the 
> new data shape, until you reach the point where you have only the new data 
> shape produced / consumed in your application?
>
>
> Current consumer functions expect the data to behave as a vector: calling 
> seq on it should produce an deterministically ordered list of property 
> values, calling nth should work, etc.
>
> Upgraded consumer functions will expect the data to behave as a map, so be 
> able to pick keyword keys.
>
> You could implement a transitional protocol which would behave differently 
> depending on how data is accessed (then delegating to the underlying 
> fields).
>
> You would probably have to make some compromises during this transition 
> phase. E.G. refactored consumer functions would not be able to call (seq) 
> on the map (or they would get the data vector back).
>
> HTH,
>
> -- Laurent
>
>
>
> 2014-05-22 10:17 GMT+02:00 Jakub Holy >:
>
>> I have a nested data structure, used by a bunch of functions that presume 
>> knowledge of its structure, and I wonder how to change a part of the 
>> structure in a safe way, preferably in small incremental steps, rather than 
>> having my code broken until I update all the functions and tests for the 
>> new structure. I believe many of you must have experiences with this, would 
>> you care to share some tips?
>>
>> The data structure is first built incrementally and the collected data is 
>> later summarized. Instead of replacing the raw data with their summary, I 
>> want to keep both, so I want to wrap the data with a map; i.e. from:
>> {  [ data...] }   ;; later replaced with { summary}
>> to
>> { {:data [data...], :summary ...}
>>
>> I have a number of functions operating on the structure and tests for 
>> those functions (with test data that also need to be updated w.r.t. the 
>> refactoring).
>>
>> When I change one of the functions to produce the new data structure 
>> (i.e. data wrapped in a map instead of the data itself), everything else 
>> breaks. So I fix some tests and another function and get even more 
>> failures. This does not feel as a good way to do it as I prefer to have 
>> limited 
>> red  and am 
>> fond of parallel 
>> changefor
>>  that reason.
>>
>> Ideally, I would have an automated refactoring or the possibility to wrap 
>> the data in some kind of a two-faced proxy that could behave both as a 
>> vector (towards the old code) or as a map containing the vector (towards 
>> the updated code) [some thing like lenses/cursor?!]. I haven't either so I 
>> guess the only option remaining is a well-controlled process of updating 
>> the structure and code. Any advice?
>>
>> Thank you! /Jakub
>> -- 
>> *Forget software. Strive to make an impact, deliver a valuable change.*
>>
>> *(**Vær så snill og hjelp meg med å forbedre norsken **min –** skriftlig 
>> og muntlig. Takk!**)*
>>
>> Jakub Holy
>> Solutions Engineer | +47 966 23 666
>> Iterate AS | www.iterate.no
>> The Lean Software Development Consultancy
>> - http

Re: [ANN] monarch 0.2.0 - Simple database migrations for Clojure.

2014-05-27 Thread Andrey Antukh
Nomad is an other tool like confijulate:
https://github.com/james-henderson/nomad

I use it in some projects and seems better documented that confijulate and
uses edn as file format.

Andrey


2014-05-27 10:43 GMT+02:00 Ray Miller :

> On 27 May 2014 09:35, Manuel Paccagnella 
> wrote:
> >
> >> I've found confijulate, here. It might be useful.
> >
> >
> > Well, ok. Another configuration library that I wasn't aware of when I
> wrote
> > confunion. Another one that I found after writing mine is carica, which
> > seems quite good. There are a bunch of them out there, you can look into
> > Clojure Toolbox, probably there is already one that satisfies your use
> > cases.
>
> Thank you for drawing all these configuration libraries to my
> attention, this is something I've done in an ad hoc way for the
> different applications I've written. I'll take a look at these before
> rolling my own next time.
>
> Ray.
>
> --
> 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/d/optout.
>



-- 
Andrey Antukh - Андрей Антух -  / 
http://www.niwi.be 
https://github.com/niwibe

-- 
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/d/optout.


Re: clojure.lang.Atom cannot be cast to a java.lang.Num

2014-05-27 Thread Philippe Guillebert
Also, you should be using loop/recur instead of mutating atoms here, this
is the functional way.

You already laid out your 2 loop bindings, and a stop condition. This
should be straightforward.

Philippe.
Le 27 mai 2014 09:44, "Dylan Gleason"  a écrit :

> I am trying to read a TCP request via an instance of DataInputStream and
> am running into this error with the following code:
>
> (defn receive
>   [socket]
>   (with-open [reader (DataInputStream. (.getInputStream socket))]
> (let [length   (read-length reader)
>   bytes-in (byte-array length)
>   offset   (atom 0)
>   index(atom 0)]
>   (while (not= -1 @offset)
> (reset! offset (.read reader bytes-in offset (- length index)))
> (reset! index (+ index offset))
>
> For some reason, trying to update the value in offset appears to result in
> this casting error. I tried testing a similar expression at the REPL, and
> it works, e.g.
>
> > (def blah (atom 0))
> > (reset! blah 93); no error
>
> It seems odd that Clojure would complain about this, since "93" is an
> instance of java.lang.Long -- why would Clojure be so annoyingly
> anal-retentive when setting the atom to a java.lang.Num? Also, if anyone
> has any ideas on how to make achieve this without using atoms, and what the
> best approach would be (a recursive solution using loop-recur, perhaps?)
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: [ANN] monarch 0.2.0 - Simple database migrations for Clojure.

2014-05-27 Thread Dave Della Costa
Just to add to the chorus--environ
(https://github.com/weavejester/environ) is a good, basic option which
we've had lots of success using.

(2014/05/27 18:08), Andrey Antukh wrote:
> Nomad is an other tool like
> confijulate: https://github.com/james-henderson/nomad
> 
> I use it in some projects and seems better documented that confijulate
> and uses edn as file format.
> 
> Andrey
> 
> 
> 2014-05-27 10:43 GMT+02:00 Ray Miller  >:
> 
> On 27 May 2014 09:35, Manuel Paccagnella
> mailto:manuel.paccagne...@gmail.com>>
> wrote:
> >
> >> I've found confijulate, here. It might be useful.
> >
> >
> > Well, ok. Another configuration library that I wasn't aware of
> when I wrote
> > confunion. Another one that I found after writing mine is carica,
> which
> > seems quite good. There are a bunch of them out there, you can
> look into
> > Clojure Toolbox, probably there is already one that satisfies your use
> > cases.
> 
> Thank you for drawing all these configuration libraries to my
> attention, this is something I've done in an ad hoc way for the
> different applications I've written. I'll take a look at these before
> rolling my own next time.
> 
> Ray.
> 
> --
> 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/d/optout.
> 
> 
> 
> 
> -- 
> Andrey Antukh - Андрей Антух -  > / mailto:n...@niwi.be>>
> http://www.niwi.be 
> https://github.com/niwibe
> 
> -- 
> 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/d/optout.

-- 
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/d/optout.


Re: [ANN] core.async (and more) video tutorials

2014-05-27 Thread Ivan Ryakhov
Greate work, Tim! 
My advice is to split the screen by vertical but not horisontal. Your code 
are not so wide and there is a lot of empty space on the right side.
I think it would be useful to place a REPL to the right side of the screen 
to obtain a vast space for code and REPL ineractions.
What about it?
 

-- 
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/d/optout.


practice for learning clojure

2014-05-27 Thread Randy Chiu
Hi all,
I'm new to clojure and want to find some suggestion for learning clojure. I 
googled some project about "how to learn clojure" but without any perfect 
answers until now.
I worked on linux kernel in last several years mainly with C, and I'm 
recently interested in lisp. I try to read some books about common lisp and 
scheme  and even clojure, so I think I know a little about lisp but lacking 
for practice. 
So, I'd like to know any project I could read(or even try to join in), or 
any other suggestion for learning this new lisp dialect please let me know.
Thanks for your advance.

-- 
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/d/optout.


Re: emacs - some output goes to stdout when using cider

2014-05-27 Thread Don Hill
Thanks for the explanation. I will also check out emacs-live


On Mon, May 26, 2014 at 10:31 PM, Carlo Zancanaro
wrote:

> On Mon, May 26, 2014 at 08:32:45AM -0700, Don Hill wrote:
> > I am in a project with a test.clj file and if I do a (println "Hi") C-x
> C-e
> > it goes to repl as expected. If I do something like (+ 1 2 3) it seems to
> > go to stdout below the status bar.
>
> This is the correct behaviour.
>
> When you evaluate (println "hi") it should show nil below the status
> bar. This isn't actually stdout, but is cider displaying the result to
> you in the minibuffer. If you evaluate (+ 1 2 3) then it shows you the
> result in the minibuffer, too.
>
> The confusing part is that (println "hi") also, as a side effect, prints
> the result to the repl. (+ 1 2 3) doesn't print anything, it only
> displays in the minibuffer. If you want to display it in the repl you
> can evaluate (println (+ 1 2 3)), or you can run the expression in the
> repl (by switching to the repl buffer and entering/running it directly).
>
> Carlo
>

-- 
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/d/optout.


Re: practice for learning clojure

2014-05-27 Thread Plínio Balduino
Hi, Randy

ClojureDocs has lots of examples with documentation, 4clojure and Clojure Koans 
are excellent start points and you can learn a lot reading the Clojure portion 
of Clojure source code. 

Regards

Plinio Balduino
11 982 611 487

> On 27/05/2014, at 08:58, Randy Chiu  wrote:
> 
> Hi all,
> I'm new to clojure and want to find some suggestion for learning clojure. I 
> googled some project about "how to learn clojure" but without any perfect 
> answers until now.
> I worked on linux kernel in last several years mainly with C, and I'm 
> recently interested in lisp. I try to read some books about common lisp and 
> scheme  and even clojure, so I think I know a little about lisp but lacking 
> for practice. 
> So, I'd like to know any project I could read(or even try to join in), or any 
> other suggestion for learning this new lisp dialect please let me know.
> Thanks for your advance.
> -- 
> 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/d/optout.

-- 
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/d/optout.


Re: Remote function calls / simple distributed computation

2014-05-27 Thread Gary Johnson
Check out Tim Baldridge's Hermod library: 
https://github.com/halgari/com.tbaldridge.hermod

It's a very lightweight system that lets you create mailboxes (which listen 
on ports) on each of your independent JVMs. Then you can pass messages 
between them using core.async. This should give you most of the tools that 
you need to create arbitrarily complex coordination frameworks on top of it.

  Happy hacking!
~Gary


On Sunday, May 25, 2014 12:30:19 PM UTC-4, David James wrote:
>
> What are the ways to do remote function calls with Clojure? Here is a 
> *low-level 
> list* I have so far:
> * Java Remote Method Invocation API: 
> http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/index.html
> * nREPL: https://github.com/clojure/tools.nrepl
>
> There are *higher-level tools*, too, such as:
> * Slacker https://github.com/sunng87/slacker
>
> What else should I add to the lists?
>
> Here is my goal. I'm exploring various ways to do distributed computation. 
> Many distributed computation platforms (e.g. Storm, Hadoop) require (1) 
> significant dev-ops setup (2) deployment via a JAR file (3) quite a bit of 
> time lag to get things started. I was hoping to find lighter-weight, more 
> responsive, ways to do distributed computation. I also consider this a 
> learning exercise.
>
> I like PigPen's use of a custom `pmap` function to distributes work: 
> https://github.com/Netflix/PigPen (But it requires Pig and Hadoop)
>
> It could be nifty to have a `pmap` that worked, say, over a set of 
> machines connected via nREPL. Has this already been done?
>
> Thanks!
>
>
>

-- 
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/d/optout.


Re: Building clojure compiler in eclipse

2014-05-27 Thread Alex Miller
Yep, Java 1.6+ is required. We test with 1.6, 1.7, 1.8.

-- 
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/d/optout.


regex strings

2014-05-27 Thread Glen Rubin
I have a string of the general form:

Name: Last,First Middle ID: GA88192


I am trying to extract the first name by invoking string.replace function, 
for example to extract the first name I invoke the following where 
'nameidstring' is the general form above:


 (clojure.string/replace nameidstring #"Name:\s(\w+){1},(\w+){1}" "$2")

Unfortunately, this gives me the First name along with ID: GA88192

since i specified a single word {1} in my regex above I don't understand 
why this is happening.  THank you for any advice

-- 
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/d/optout.


Re: regex strings

2014-05-27 Thread Stephen Gilardi
clojure.string/replace replaces the portion of the string matched by the regex 
with the replacement. If you add ".*" to the regex, the regex will match the 
entire input string and the form will evaluate to "First".

--Steve

On May 27, 2014, at 11:24 AM, Glen Rubin  wrote:

> I have a string of the general form:
> 
> Name: Last,First Middle ID: GA88192
> 
> 
> I am trying to extract the first name by invoking string.replace function, 
> for example to extract the first name I invoke the following where 
> 'nameidstring' is the general form above:
> 
> 
>  (clojure.string/replace nameidstring #"Name:\s(\w+){1},(\w+){1}" "$2")
> 
> Unfortunately, this gives me the First name along with ID: GA88192
> 
> since i specified a single word {1} in my regex above I don't understand why 
> this is happening.  THank you for any advice
> 
> -- 
> 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/d/optout.

-- 
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/d/optout.


Re: [ANN] core.async (and more) video tutorials

2014-05-27 Thread Timothy Baldridge
Thanks for all the suggestions.

1) Yes, there seems to be an issue with downloading free videos. From what
I'm seeing in the admin settings I only have the option for "paid and
downloadable" and "free". Free disables the downloading. I'll contact
PivotShare and see if they can change that.

2) Sounds like a good idea to split vertical. I'll give it a try in the
next video

3) yes, I plan on uploading more logic tutorials. The next should be out
tonight, after that maybe once a week? I'd like to focus on core.async, but
having a range of topics is nice for breaking up the pace a bit.

Thanks again,

Timothy Baldridge


On Tue, May 27, 2014 at 4:22 AM, Ivan Ryakhov wrote:

> Greate work, Tim!
> My advice is to split the screen by vertical but not horisontal. Your code
> are not so wide and there is a lot of empty space on the right side.
> I think it would be useful to place a REPL to the right side of the screen
> to obtain a vast space for code and REPL ineractions.
> What about it?
>
>
> --
> 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/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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/d/optout.


Re: practice for learning clojure

2014-05-27 Thread Gregg Williams
Hi, Randy,

I'm several years into learning Clojure. Here's what has worked for me:

* Use either Light Table or (if you're determined) Emacs as your IDE.
* I learned a lot from taking this free online course: 
http://iloveponies.github.io/120-hour-epic-sax-marathon/index.html
* I have *all* the published Clojure books. To start, I recommend 
Programming Clojure, 2nd Ed. (Halloway), or Clojure Programming (Emerick 
et. al.).
* Start on the exercises at 4clojure.com (sorted from easiest to hardest) 
***AND*** (this is where you will learn the most) once you've completed an 
exercise, spend *a lot* of time studying other people's solutions, looking 
at both the factors of elegance and readability in solutions. If you can't 
figure one out, keep at it until you do.
* Ask for help on stackoverflow.com. You get better results there because 
people have an incentive to write clearly.
* In your own code, prefer readability over brevity (this bucks the common 
wisdom of the community). Use multiline functions that show structure 
through (auto)indentation. Symbol names are tricky--too short and they're 
cryptic, too long and they hide the code; find what works for you.
* Watch videos from the various Clojure conferences and groups, especially 
those from Rich Hickey and the most visible contributors of the Clojure 
community. Their talks have given me a lot more about the philosophy of 
Clojure and how to think about coding in Clojure than most of the printed 
books.
* Finally, here are my Clojure bookmarks, which go back almost five years 
https://www.pinboard.in/search/u:GreggInCA?query=clojure. Older links are, 
in some cases, outdated. Use your best judgement.
* Persevere. Clojure is not an easy language/environment, but it is 
uniquely oriented to future hardware and it is very powerful.



On Tuesday, May 27, 2014 4:58:44 AM UTC-7, Randy Chiu wrote:
>
> Hi all,
> I'm new to clojure and want to find some suggestion for learning clojure. 
> I googled some project about "how to learn clojure" but without any perfect 
> answers until now.
> I worked on linux kernel in last several years mainly with C, and I'm 
> recently interested in lisp. I try to read some books about common lisp and 
> scheme  and even clojure, so I think I know a little about lisp but lacking 
> for practice. 
> So, I'd like to know any project I could read(or even try to join in), or 
> any other suggestion for learning this new lisp dialect please let me know.
> Thanks for your advance.
>

-- 
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/d/optout.


core.match incorrect docstring?

2014-05-27 Thread Dom Kiva-Meyer
The clojure.core.match/match docstring states that it takes "...a vector of
occurrences, vars. Clause question-answer syntax is like `cond`. Questions
must be wrapped in a vector..."
https://github.com/clojure/core.match/blob/5429e20f5db8c398d745f15f7a85f65976f45397/src/main/clojure/clojure/core/match.clj#L1966-1976

However, it seems to work without wrapping the occurrences and questions in
vectors.

(match [{:a 1 :b 2}]   [{:a 1 :b x}] x);;=> 2(match {:a 1 :b 2}
   {:a 1 :b x} x);;=> 2

Is the docstring outdated or are there circumstances that necessitate
wrapping the occurrence/s and question/s in vectors?

-- 
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/d/optout.


Re: practice for learning clojure

2014-05-27 Thread Randy Chiu
Hi Gregg,
Your suggestion is very good and explicit,thanks for your response.
I'd like to ask you another question since you mentioned :
>>> spend *a lot* of time studying other people's solutions, looking at 
both the factors of elegance and readability in solutions. 
do you have any good projects/solutions recommended?

在 2014年5月28日星期三UTC+8上午3时15分37秒,Gregg Williams写道:
>
> Hi, Randy,
>
> I'm several years into learning Clojure. Here's what has worked for me:
>
> * Use either Light Table or (if you're determined) Emacs as your IDE.
> * I learned a lot from taking this free online course: 
> http://iloveponies.github.io/120-hour-epic-sax-marathon/index.html
> * I have *all* the published Clojure books. To start, I recommend 
> Programming Clojure, 2nd Ed. (Halloway), or Clojure Programming (Emerick 
> et. al.).
> * Start on the exercises at 4clojure.com (sorted from easiest to hardest) 
> ***AND*** (this is where you will learn the most) once you've completed an 
> exercise, spend *a lot* of time studying other people's solutions, looking 
> at both the factors of elegance and readability in solutions. If you can't 
> figure one out, keep at it until you do.
> * Ask for help on stackoverflow.com. You get better results there because 
> people have an incentive to write clearly.
> * In your own code, prefer readability over brevity (this bucks the common 
> wisdom of the community). Use multiline functions that show structure 
> through (auto)indentation. Symbol names are tricky--too short and they're 
> cryptic, too long and they hide the code; find what works for you.
> * Watch videos from the various Clojure conferences and groups, especially 
> those from Rich Hickey and the most visible contributors of the Clojure 
> community. Their talks have given me a lot more about the philosophy of 
> Clojure and how to think about coding in Clojure than most of the printed 
> books.
> * Finally, here are my Clojure bookmarks, which go back almost five years 
> https://www.pinboard.in/search/u:GreggInCA?query=clojure. Older links 
> are, in some cases, outdated. Use your best judgement.
> * Persevere. Clojure is not an easy language/environment, but it is 
> uniquely oriented to future hardware and it is very powerful.
>
>
>
> On Tuesday, May 27, 2014 4:58:44 AM UTC-7, Randy Chiu wrote:
>>
>> Hi all,
>> I'm new to clojure and want to find some suggestion for learning clojure. 
>> I googled some project about "how to learn clojure" but without any perfect 
>> answers until now.
>> I worked on linux kernel in last several years mainly with C, and I'm 
>> recently interested in lisp. I try to read some books about common lisp and 
>> scheme  and even clojure, so I think I know a little about lisp but lacking 
>> for practice. 
>> So, I'd like to know any project I could read(or even try to join in), or 
>> any other suggestion for learning this new lisp dialect please let me know.
>> Thanks for your advance.
>>
>

-- 
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/d/optout.


Re: [ANN] core.async (and more) video tutorials

2014-05-27 Thread Juan Manuel Gimeno Illa


El martes, 27 de mayo de 2014 19:55:12 UTC+2, tbc++ escribió:
>
> Thanks for all the suggestions.
>
> 1) Yes, there seems to be an issue with downloading free videos. From what 
> I'm seeing in the admin settings I only have the option for "paid and 
> downloadable" and "free". Free disables the downloading. I'll contact 
> PivotShare and see if they can change that. 
>

I'm unable to download even the paid ones. I'll contact PivotShare as well. 

>
> 3) yes, I plan on uploading more logic tutorials. The next should be out 
> tonight, after that maybe once a week? I'd like to focus on core.async, but 
> having a range of topics is nice for breaking up the pace a bit. 
>

Great !!!

Juan Manuel

>

-- 
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/d/optout.


Re: clojure.lang.Atom cannot be cast to a java.lang.Num

2014-05-27 Thread Dylan Gleason
Thank you, Ambrose. It appears I forgot to dereference both index and
offset when trying to read the values associated with the atoms. Thanks
Phillippe -- I went with your recursive solution and bypassed mutation via
atoms altogether -- a much cleaner solution.


On Tue, May 27, 2014 at 2:15 AM, Philippe Guillebert <
philippe.guilleb...@gmail.com> wrote:

> Also, you should be using loop/recur instead of mutating atoms here, this
> is the functional way.
>
> You already laid out your 2 loop bindings, and a stop condition. This
> should be straightforward.
>
> Philippe.
> Le 27 mai 2014 09:44, "Dylan Gleason"  a écrit :
>
>> I am trying to read a TCP request via an instance of DataInputStream and
>> am running into this error with the following code:
>>
>> (defn receive
>>   [socket]
>>   (with-open [reader (DataInputStream. (.getInputStream socket))]
>> (let [length   (read-length reader)
>>   bytes-in (byte-array length)
>>   offset   (atom 0)
>>   index(atom 0)]
>>   (while (not= -1 @offset)
>> (reset! offset (.read reader bytes-in offset (- length index)))
>> (reset! index (+ index offset))
>>
>> For some reason, trying to update the value in offset appears to result
>> in this casting error. I tried testing a similar expression at the REPL,
>> and it works, e.g.
>>
>> > (def blah (atom 0))
>> > (reset! blah 93); no error
>>
>> It seems odd that Clojure would complain about this, since "93" is an
>> instance of java.lang.Long -- why would Clojure be so annoyingly
>> anal-retentive when setting the atom to a java.lang.Num? Also, if anyone
>> has any ideas on how to make achieve this without using atoms, and what the
>> best approach would be (a recursive solution using loop-recur, perhaps?)
>>
>> --
>> 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/d/optout.
>>
>  --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/DRxhey7Mx8Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/d/optout.


Re: deftest and var's metadata

2014-05-27 Thread Nahuel Greco
ok, just for the record, I fixed it. Instead of (resolve 'a) you must
use (ns-resolve
'test-namespace 'a), because lein test runs the tests in namespace
'userinstead of the one that defined the test (as I wrongly assumed).
Also the
first test for the existence of the var is wrong, I assumed resolve will
raise an exception if not found, but it returns nil. Moral: sleep
deprivation is bad for debugging :)


Saludos,
Nahuel Greco.


On Mon, May 26, 2014 at 5:05 AM, Nahuel Greco  wrote:

> This works ok at the REPL:
>
> (def ^{:k :v} a 4)
> (:k (meta (resolve 'a)))
>   ;=> evaluates to :v, ok.
>
> But the same didn't worked inside a clojure.test/deftest:
>
> (deftest mytest
>   (def ^{:k :v} b 4)
>   (is (= (resolve 'b) nil)) ;; passed, var is resolved ok
>   (is (= (:k (meta (resolve 'b))) :v))) ;; fails, metadata is nil
>
> I know deftest wraps his body in a fn, but this works ok:
>
> ((fn []
>   (def ^{:k :v} c 4)
>   (:k (meta (resolve 'c)))
> ))
>
> Why the deftest case is not working?
>
>
> Saludos,
> Nahuel Greco.
>

-- 
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/d/optout.