Re: map output to string

2014-07-08 Thread Daniel Compton
To force realisation of a sequence, use one of the do* forms. 
https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/do

If you post a gist of your code then someone may be able to give more specific 
guidance. 

Daniel.

> On 8/07/2014, at 2:15 pm, Glen Rubin  wrote:
> 
> yes, that is exactly my issue. i am trying to get the lazy sequence fully 
> realized as you say, but it's not happening in the context i put it in.  
> 
>> On Monday, July 7, 2014 6:04:00 PM UTC-7, Daniel Compton wrote:
>> Hi Glen
>> 
>> One thing to keep in mind with lazy sequences is that running them at the 
>> REPL will force them to be fully realised, whereas a lazy sequence may not 
>> be realised in other contexts. I didn't understand where 'clojure-lazy-seq' 
>> is coming from in your question so I'm not sure if that's your issue or not.
>> 
>> 
>>> On 8 July 2014 09:49, Glen Rubin  wrote:
>>> my-fn takes a number and a string as argument and outputs a string.  I am 
>>> using map-indexed and my-fn to comprehend a list of items with numbered 
>>> index as follows, 
>>>  
>>>  
>>> (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap))
>>>  
>>> When i run this on the repl everything works well and I get a single long 
>>> string of output. But, I am trying to use the output of this function in a 
>>> report and it is not working in that context.
>>>  
>>> The code to generate report looks something like this:
>>>  
>>>  (str
>>>   string1
>>>   string2
>>>   string3
>>> (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap))
>>>   string4etc...
>>> )
>>>  
>>> The code above will just print out 'clojure-lazy-seq' instead of the string 
>>> output.  If I try:
>>>  
>>> (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)))
>>>  
>>> Then I get the last item from my list properly formated in the report, but 
>>> that's all.  How do I print out everything?  Thanks
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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+u...@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.

-- 
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: System/getenv can't read env vars?

2014-07-08 Thread James Reeves
You could try running:

export MY_VAR=foo
bash -c 'echo $MY_VAR'

And see if that comes with the same result. You might also want to make
sure you're not using a pre-loader like Drip.

You can use Java system properties to do per environment/machine config as
well.

I wrote a library a while back that handles both system properties and
environment variables, called environ:
https://github.com/weavejester/environ

- James


On 7 July 2014 20:32, Jarrod Swart  wrote:

> Sean,
>
> Thanks for the input.  There is a good chance you are right.  The process
> is launched from tmuxinator a tool that opens multiple processes and joins
> them all to a tmux session.
>
> I suppose I'll have to investigate that but it seems odd that if I type
> "echo $MY_VAR" I get the expected value from within that same series of
> tmux processes.
>
> It must be part of the JVM bit I don't grasp yet.
>
> I'll look into these suggestions later.
>
> Is there a particular way you do per environment/machine config that
> differs from env vars?
>
> --
> 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: is their a Clojure framework for handling form validation?

2014-07-08 Thread Mimmo Cosenza
Sorry for the delay, I just saw this thread now.

I used https://github.com/cemerick/valip

A version of https://github.com/weavejester/valip by Chas Emerick which can be 
used for both client and server side validation. You could eventually take a 
look at the way I used from here on:

https://github.com/magomimmo/modern-cljs/blob/master/doc/tutorial-13.md

HIH

mimmo

On Jul 5, 2014, at 2:48 PM, Asim Jalis  wrote:

> For validation check out Bouncer [1][2]. It is elegant and minimal, and also 
> lets you chain together validators using the threading macro. 
> 
> [1] https://github.com/leonardoborges/bouncer
> [2] 
> http://www.leonardoborges.com/writings/2013/01/04/bouncer-validation-lib-for-clojure/
> 
> Asim
> 
> On Sunday, July 22, 2012 4:46:52 PM UTC-7, larry google groups wrote:
> Since 2000 I've been doing web development, first with PHP and then with Ruby 
> On Rails. In the world of PHP, there are some frameworks, such as Symfony, 
> that have classes for managing forms, both generating the HTML for the forms, 
> and also handling the validation of the forms. In the world of Python, the 
> Django framework also has facilities for generating and validating forms. 
> These frameworks offer certain time saving conveniences. For instance, with 
> the Symfony framework, if you have a database table that has a foreign key, 
> then you can get that other table (the target of the foreign key) to appear 
> in a form as a pre-populated select box, automatically (after filling out 
> some config files).
> 
> I'm now trying to make Clojure my primary development language for 
> everything, including web development. I'm curious, are there any libraries 
> in the land of Clojure that offer similar conveniences for forms? 
> 
> -- 
> 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.


IllegalArgumentException when running core.async example

2014-07-08 Thread endbegin
Hi

I was trying to teach myself core.async and tried the rock, paper, scissors 
example found here:
http://tech.puredanger.com/2013/07/10/rps-core-async/

See a gist here:
https://gist.github.com/endbegin/b10be6d7a3ba5f6c29db

Really, the main difference is in the :require statement at the top, and 
whenever I use a function from the core.async library, I prepend it with 
async. For instance, async/go or async/> (def game (init))
>> (play game)

and get the error:

IllegalArgumentException No implementation of method: :take! of protocol: 
#'clojure.core.async.impl.protocols/ReadPort found for class: 
clojure.core.async$chan  clojure.core/-cache-protocol-fn 
(core_deftype.clj:541)

*What does this mean?!?*

*P.S.* If I replace the :require at the top with 
(:require [clojure.core.async :refer :all]))

I can't even get it to compile. I get an error about there being a conflict 
between the partition-by in clojure.core and in core.async. 

Thanks for the help!

-- 
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: map output to string

2014-07-08 Thread Lee Spector

Sometimes you have to manually stamp out laziness, for this among other reasons.

In some cases I apply the list function to do this:

=> (str (map inc (range 10)))
"clojure.lang.LazySeq@c5d38b66"

=> (str (apply list (map inc (range 10
"(1 2 3 4 5 6 7 8 9 10)"

 -Lee


> On 8 July 2014 09:49, Glen Rubin  wrote:
> my-fn takes a number and a string as argument and outputs a string.  I am 
> using map-indexed and my-fn to comprehend a list of items with numbered index 
> as follows, 
>  
>  
> (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap))
>  
> When i run this on the repl everything works well and I get a single long 
> string of output. But, I am trying to use the output of this function in a 
> report and it is not working in that context.
>  
> The code to generate report looks something like this:
>  
>  (str
>   string1
>   string2
>   string3
> (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap))
>   string4etc...
> )
>  
> The code above will just print out 'clojure-lazy-seq' instead of the string 
> output.  If I try:
>  
> (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)))
>  
> Then I get the last item from my list properly formated in the report, but 
> that's all.  How do I print out everything?  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: map output to string

2014-07-08 Thread Diego Basch
That's not your problem. From (doc str):

"With more than one arg, returns the concatenation of the str values of the 
args."

The str value of a lazy sequence is something like:

"clojure.lang.LazySeq@386e0460"
which is the result of (.toString your-seq)

What you probably want is something like

(str s1 s2 s3 (apply str your-seq) s4...)


On Monday, July 7, 2014 11:15:13 PM UTC-3, Glen Rubin wrote:
>
> yes, that is exactly my issue. i am trying to get the lazy sequence fully 
> realized as you say, but it's not happening in the context i put it in.  
>
> On Monday, July 7, 2014 6:04:00 PM UTC-7, Daniel Compton wrote:
>>
>> Hi Glen
>>
>> One thing to keep in mind with lazy sequences is that running them at the 
>> REPL will force them to be fully realised, whereas a lazy sequence may not 
>> be realised in other contexts. I didn't understand where 'clojure-lazy-seq' 
>> is coming from in your question so I'm not sure if that's your issue or not.
>>
>>
>> On 8 July 2014 09:49, Glen Rubin  wrote:
>>
>>> my-fn takes a number and a string as argument and outputs a string.  I 
>>> am using map-indexed and my-fn to comprehend a list of items with numbered 
>>> index as follows, 
>>>  
>>>  
>>> (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap))
>>>  
>>> When i run this on the repl everything works well and I get a 
>>> single long string of output. But, I am trying to use the output of this 
>>> function in a report and it is not working in that context.
>>>  
>>> The code to generate report looks something like this:
>>>  
>>>  (str
>>>   string1
>>>   string2
>>>   string3
>>> (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap))
>>>   string4etc...
>>> )
>>>  
>>> The code above will just print out 'clojure-lazy-seq' instead of the 
>>> string output.  If I try:
>>>  
>>> (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)))
>>>  
>>> Then I get the last item from my list properly formated in the report, 
>>> but that's all.  How do I print out everything?  Thanks
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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+u...@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] Grimoire: up to date Clojure web docs

2014-07-08 Thread Andy Fingerhut
Mark, creating separate versions of the Clojure cheat sheet that link to
Grimoire instead of ClojureDocs.org should be fairly straightforward, but
due to other work I won't get to it for at least a few days.  If someone
else is interested, and not put off by my code, they are welcome to go for
it and submit a pull request:

https://github.com/jafingerhut/clojure-cheatsheets

The time-consuming part isn't getting the first version up and running, but
checking that all the symbols with odd characters in them actually have
working links in both the HTML and PDF versions, although arguably the
links in the PDF versions aren't as important.

I can publish the results here, which is one click away from
http://clojure.org/cheatsheet

http://jafingerhut.github.io

Once done, Clojure folks other than myself can consider whether the version
with links to Grimoire belongs at http://clojure.org/cheatsheet, too.

Andy


On Mon, Jul 7, 2014 at 9:49 PM, Mark Mandel  wrote:

> Nice work! I've been using Grimoire all day :)
>
> Two small suggestions, which you have probably thought of: (1) search  (2)
> a copy of the clojure cheat sheet that points to grimoire instead. (Maybe
> Grimoire needs it's own domain?)
>
> CrossClj is *awesome* as well. I've been wanting something similar for a
> looong time. Thanks!
>
> Mark
>
>
>
> On Tue, Jul 8, 2014 at 2:31 PM, Reid McKenzie 
> wrote:
>
>>  I'm delighted to announce that thanks to the official Clojuredocs client
>> (https://github.com/dakrone/clojuredocs-client) Grimoire now features
>> every example posted on Clojuredocs.
>>
>> Ex.
>> http://www.arrdem.com/grimoire/1.6.0/clojure.core/DASH__GT__GT/#example-0
>>
>> Currently at 0.0.13, which represents a slew of changes since the
>> original announcement including the dropping of 1.5.1 as a documented
>> version (it's a patch release, nothing changed from 1.5.0) and a major
>> rework of the way I munge symbols and include examples between versions.
>>
>> I'd like to give Alex (puredanger) a huge shout out for handing me a SQL
>> dump of the clojuredocs examples table right after I got a dakrone's client
>> working.
>>
>> More tooling thanks to Phil (technomancy), lein's profiles enabled me to
>> ditch a make target which downloaded old Clojure versions in favor of
>> simply having one lein profile for each documented Clojure version.
>>
>>
>> Reid
>>
>> On 07/07/2014 04:54 PM, cldwalker wrote:
>>
>> Hey Reid,
>>
>>  Nice work! I think this is a much more maintainable approach for a
>> community-based examples repository.  Have you thought about seeding
>> examples from clojuredocs using their api e.g.
>> http://api.clojuredocs.org/examples/1.3.0/clojure.core/map? I think this
>> would help if the goal is to become the canonical site for clojure fn
>> examples.
>>
>>  It is worth noting that clojuredocs is undergoing a rewrite,
>> https://github.com/zk/clojuredocs/tree/clj-rewrite. If this rewrite
>> lands soon than it may be worth adding a Motivation section to the home
>> page to distinguish it from clojuredocs.org.
>>
>>  On Tuesday, July 1, 2014 7:34:38 PM UTC-4, Reid McKenzie wrote:
>>>
>>> Hey guys,
>>>
>>> If you're like me while using clojure.repl/doc works for the most part
>>> there are just times that you need to send someone a link to the
>>> official docs and navigating the docstrings in the core Clojure
>>> repository is a pain.
>>>
>>> After several months of being frustrated that clojuredocs is out of
>>> date, I finally sat down and built an alternative which I'm pleased to
>>> present here: http://www.arrdem.com/grimoire/
>>>
>>> Grimoire is still alpha and subject to change, especially with regards
>>> to the example contribution process which needs streamlining beyond the
>>> current "click a link, edit on github and submit a PR".
>>>
>>
>>  I think this is a reasonable approach. It's better than having a login
>> just for clojuredocs.
>>
>>
>>>
>>> I'd like to give a shout out to César for porting clojure.repl/source
>>> into the doc generation script and to Nicola for his random usability
>>> criticisms.
>>>
>>
>>
>>
>> Cheers,
>> Gabriel
>>
>>
>>>
>>> Reid McKenzie
>>>
>>  --
>> 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.

Re: [ANN] Grimoire: up to date Clojure web docs

2014-07-08 Thread Colin Fleming
If we think that Grimoire should be the official ClojureDocs replacement,
why don't we do that? Could we just host Grimoire under the clojuredocs.org
domain, perhaps structuring the URLs to match?

One thing that I couldn't see - does Grimoire offer an API to get access to
the examples?


On 8 July 2014 11:52, Andy Fingerhut  wrote:

> Mark, creating separate versions of the Clojure cheat sheet that link to
> Grimoire instead of ClojureDocs.org should be fairly straightforward, but
> due to other work I won't get to it for at least a few days.  If someone
> else is interested, and not put off by my code, they are welcome to go for
> it and submit a pull request:
>
> https://github.com/jafingerhut/clojure-cheatsheets
>
> The time-consuming part isn't getting the first version up and running,
> but checking that all the symbols with odd characters in them actually have
> working links in both the HTML and PDF versions, although arguably the
> links in the PDF versions aren't as important.
>
> I can publish the results here, which is one click away from
> http://clojure.org/cheatsheet
>
> http://jafingerhut.github.io
>
> Once done, Clojure folks other than myself can consider whether the
> version with links to Grimoire belongs at http://clojure.org/cheatsheet,
> too.
>
> Andy
>
>
> On Mon, Jul 7, 2014 at 9:49 PM, Mark Mandel  wrote:
>
>> Nice work! I've been using Grimoire all day :)
>>
>> Two small suggestions, which you have probably thought of: (1) search
>>  (2) a copy of the clojure cheat sheet that points to grimoire instead.
>> (Maybe Grimoire needs it's own domain?)
>>
>> CrossClj is *awesome* as well. I've been wanting something similar for a
>> looong time. Thanks!
>>
>> Mark
>>
>>
>>
>> On Tue, Jul 8, 2014 at 2:31 PM, Reid McKenzie 
>> wrote:
>>
>>>  I'm delighted to announce that thanks to the official Clojuredocs
>>> client (https://github.com/dakrone/clojuredocs-client) Grimoire now
>>> features every example posted on Clojuredocs.
>>>
>>> Ex.
>>> http://www.arrdem.com/grimoire/1.6.0/clojure.core/DASH__GT__GT/#example-0
>>>
>>> Currently at 0.0.13, which represents a slew of changes since the
>>> original announcement including the dropping of 1.5.1 as a documented
>>> version (it's a patch release, nothing changed from 1.5.0) and a major
>>> rework of the way I munge symbols and include examples between versions.
>>>
>>> I'd like to give Alex (puredanger) a huge shout out for handing me a SQL
>>> dump of the clojuredocs examples table right after I got a dakrone's client
>>> working.
>>>
>>> More tooling thanks to Phil (technomancy), lein's profiles enabled me to
>>> ditch a make target which downloaded old Clojure versions in favor of
>>> simply having one lein profile for each documented Clojure version.
>>>
>>>
>>> Reid
>>>
>>> On 07/07/2014 04:54 PM, cldwalker wrote:
>>>
>>> Hey Reid,
>>>
>>>  Nice work! I think this is a much more maintainable approach for a
>>> community-based examples repository.  Have you thought about seeding
>>> examples from clojuredocs using their api e.g.
>>> http://api.clojuredocs.org/examples/1.3.0/clojure.core/map? I think
>>> this would help if the goal is to become the canonical site for clojure fn
>>> examples.
>>>
>>>  It is worth noting that clojuredocs is undergoing a rewrite,
>>> https://github.com/zk/clojuredocs/tree/clj-rewrite. If this rewrite
>>> lands soon than it may be worth adding a Motivation section to the home
>>> page to distinguish it from clojuredocs.org.
>>>
>>>  On Tuesday, July 1, 2014 7:34:38 PM UTC-4, Reid McKenzie wrote:

 Hey guys,

 If you're like me while using clojure.repl/doc works for the most part
 there are just times that you need to send someone a link to the
 official docs and navigating the docstrings in the core Clojure
 repository is a pain.

 After several months of being frustrated that clojuredocs is out of
 date, I finally sat down and built an alternative which I'm pleased to
 present here: http://www.arrdem.com/grimoire/

 Grimoire is still alpha and subject to change, especially with regards
 to the example contribution process which needs streamlining beyond the
 current "click a link, edit on github and submit a PR".

>>>
>>>  I think this is a reasonable approach. It's better than having a login
>>> just for clojuredocs.
>>>
>>>

 I'd like to give a shout out to César for porting clojure.repl/source
 into the doc generation script and to Nicola for his random usability
 criticisms.

>>>
>>>
>>>
>>> Cheers,
>>> Gabriel
>>>
>>>

 Reid McKenzie

>>>  --
>>> 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

Re: [ANN] Grimoire: up to date Clojure web docs

2014-07-08 Thread Andy Fingerhut
On Tue, Jul 8, 2014 at 3:28 AM, Colin Fleming 
wrote:

> If we think that Grimoire should be the official ClojureDocs replacement,
> why don't we do that? Could we just host Grimoire under the
> clojuredocs.org domain, perhaps structuring the URLs to match?
>

Depends upon who you mean by "we".  The clojuredocs.org domain is owned by
Zachary Kim, according to a search at whois.net.  He gets to decide what is
published there.  Lately he has been actively working on a rewrite of the
ClojureDocs.org server code in Clojure, intended to replace the original
version written in Ruby:

https://github.com/zk/clojuredocs

Andy


On 8 July 2014 11:52, Andy Fingerhut  wrote:

> Mark, creating separate versions of the Clojure cheat sheet that link to
> Grimoire instead of ClojureDocs.org should be fairly straightforward, but
> due to other work I won't get to it for at least a few days.  If someone
> else is interested, and not put off by my code, they are welcome to go for
> it and submit a pull request:
>
> https://github.com/jafingerhut/clojure-cheatsheets
>
> The time-consuming part isn't getting the first version up and running,
> but checking that all the symbols with odd characters in them actually have
> working links in both the HTML and PDF versions, although arguably the
> links in the PDF versions aren't as important.
>
> I can publish the results here, which is one click away from
> http://clojure.org/cheatsheet
>
> http://jafingerhut.github.io
>
> Once done, Clojure folks other than myself can consider whether the
> version with links to Grimoire belongs at http://clojure.org/cheatsheet,
> too.
>
> Andy
>
>
> On Mon, Jul 7, 2014 at 9:49 PM, Mark Mandel  wrote:
>
>> Nice work! I've been using Grimoire all day :)
>>
>> Two small suggestions, which you have probably thought of: (1) search
>>  (2) a copy of the clojure cheat sheet that points to grimoire instead.
>> (Maybe Grimoire needs it's own domain?)
>>
>> CrossClj is *awesome* as well. I've been wanting something similar for a
>> looong time. Thanks!
>>
>> Mark
>>
>>
>>
>> On Tue, Jul 8, 2014 at 2:31 PM, Reid McKenzie 
>> wrote:
>>
>>>  I'm delighted to announce that thanks to the official Clojuredocs
>>> client (https://github.com/dakrone/clojuredocs-client) Grimoire now
>>> features every example posted on Clojuredocs.
>>>
>>> Ex.
>>> http://www.arrdem.com/grimoire/1.6.0/clojure.core/DASH__GT__GT/#example-0
>>>
>>> Currently at 0.0.13, which represents a slew of changes since the
>>> original announcement including the dropping of 1.5.1 as a documented
>>> version (it's a patch release, nothing changed from 1.5.0) and a major
>>> rework of the way I munge symbols and include examples between versions.
>>>
>>> I'd like to give Alex (puredanger) a huge shout out for handing me a SQL
>>> dump of the clojuredocs examples table right after I got a dakrone's client
>>> working.
>>>
>>> More tooling thanks to Phil (technomancy), lein's profiles enabled me to
>>> ditch a make target which downloaded old Clojure versions in favor of
>>> simply having one lein profile for each documented Clojure version.
>>>
>>>
>>> Reid
>>>
>>> On 07/07/2014 04:54 PM, cldwalker wrote:
>>>
>>> Hey Reid,
>>>
>>>  Nice work! I think this is a much more maintainable approach for a
>>> community-based examples repository.  Have you thought about seeding
>>> examples from clojuredocs using their api e.g.
>>> http://api.clojuredocs.org/examples/1.3.0/clojure.core/map? I think
>>> this would help if the goal is to become the canonical site for clojure fn
>>> examples.
>>>
>>>  It is worth noting that clojuredocs is undergoing a rewrite,
>>> https://github.com/zk/clojuredocs/tree/clj-rewrite. If this rewrite
>>> lands soon than it may be worth adding a Motivation section to the home
>>> page to distinguish it from clojuredocs.org.
>>>
>>>  On Tuesday, July 1, 2014 7:34:38 PM UTC-4, Reid McKenzie wrote:

 Hey guys,

 If you're like me while using clojure.repl/doc works for the most part
 there are just times that you need to send someone a link to the
 official docs and navigating the docstrings in the core Clojure
 repository is a pain.

 After several months of being frustrated that clojuredocs is out of
 date, I finally sat down and built an alternative which I'm pleased to
 present here: http://www.arrdem.com/grimoire/

 Grimoire is still alpha and subject to change, especially with regards
 to the example contribution process which needs streamlining beyond the
 current "click a link, edit on github and submit a PR".

>>>
>>>  I think this is a reasonable approach. It's better than having a login
>>> just for clojuredocs.
>>>
>>>

 I'd like to give a shout out to César for porting clojure.repl/source
 into the doc generation script and to Nicola for his random usability
 criticisms.

>>>
>>>
>>>
>>> Cheers,
>>> Gabriel
>>>
>>>

 Reid McKenzie

>>>  --
>>> You received this me

lein install

2014-07-08 Thread zhenxuanpan
when i run lein install

lein install
Compiling zilch.mq
Exception in thread "main" java.io.FileNotFoundException: Could not locate 
zilch/mq__init.class or zilch/mq.clj on classpath: 
at clojure.lang.RT.load(RT.java:432)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$compile$fn__4895.invoke(core.clj:5426)
at clojure.core$compile.invoke(core.clj:5425)
at user$eval9.invoke(form-init581473078545854006.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.Compiler.loadFile(Compiler.java:6912)
at clojure.main$load_script.invoke(main.clj:283)
at clojure.main$init_opt.invoke(main.clj:288)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Compilation failed: Subprocess failed

-- 
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: lein install

2014-07-08 Thread Tim Visher
On Tue, Jul 8, 2014 at 7:39 AM, zhenxuanpan  wrote:
> when i run lein install
>
> lein install
> Compiling zilch.mq
> Exception in thread "main" java.io.FileNotFoundException: Could not locate
> zilch/mq__init.class or zilch/mq.clj on classpath:
> at clojure.lang.RT.load(RT.java:432)
> at clojure.lang.RT.load(RT.java:400)
> at clojure.core$load$fn__4890.invoke(core.clj:5415)
> at clojure.core$load.doInvoke(core.clj:5414)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:5227)
> at clojure.core$compile$fn__4895.invoke(core.clj:5426)
> at clojure.core$compile.invoke(core.clj:5425)
> at user$eval9.invoke(form-init581473078545854006.clj:1)
> at clojure.lang.Compiler.eval(Compiler.java:6511)
> at clojure.lang.Compiler.eval(Compiler.java:6501)
> at clojure.lang.Compiler.load(Compiler.java:6952)
> at clojure.lang.Compiler.loadFile(Compiler.java:6912)
> at clojure.main$load_script.invoke(main.clj:283)
> at clojure.main$init_opt.invoke(main.clj:288)
> at clojure.main$initialize.invoke(main.clj:316)
> at clojure.main$null_opt.invoke(main.clj:349)
> at clojure.main$main.doInvoke(main.clj:427)
> at clojure.lang.RestFn.invoke(RestFn.java:421)
> at clojure.lang.Var.invoke(Var.java:419)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
> Compilation failed: Subprocess failed

Is your source code available anywhere? Harder to help without it.

--

In Christ,

Timmy V.

http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail

-- 
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: lein install

2014-07-08 Thread Plínio Balduino
I could guess that the problem is in the dot in the project name.

Could you try to change it to zilch-mq or zilchmq and test?

Plínio


On Tue, Jul 8, 2014 at 8:39 AM, zhenxuanpan  wrote:

> when i run lein install
>
> lein install
> Compiling zilch.mq
> Exception in thread "main" java.io.FileNotFoundException: Could not locate
> zilch/mq__init.class or zilch/mq.clj on classpath:
>  at clojure.lang.RT.load(RT.java:432)
> at clojure.lang.RT.load(RT.java:400)
> at clojure.core$load$fn__4890.invoke(core.clj:5415)
>  at clojure.core$load.doInvoke(core.clj:5414)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:5227)
>  at clojure.core$compile$fn__4895.invoke(core.clj:5426)
> at clojure.core$compile.invoke(core.clj:5425)
> at user$eval9.invoke(form-init581473078545854006.clj:1)
>  at clojure.lang.Compiler.eval(Compiler.java:6511)
> at clojure.lang.Compiler.eval(Compiler.java:6501)
> at clojure.lang.Compiler.load(Compiler.java:6952)
>  at clojure.lang.Compiler.loadFile(Compiler.java:6912)
> at clojure.main$load_script.invoke(main.clj:283)
> at clojure.main$init_opt.invoke(main.clj:288)
>  at clojure.main$initialize.invoke(main.clj:316)
> at clojure.main$null_opt.invoke(main.clj:349)
> at clojure.main$main.doInvoke(main.clj:427)
>  at clojure.lang.RestFn.invoke(RestFn.java:421)
> at clojure.lang.Var.invoke(Var.java:419)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
>  at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
> Compilation failed: Subprocess failed
>
>  --
> 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: lein install

2014-07-08 Thread zhenxuanpan
apache/storm, I compile at A,B machine, A machine success,B machine report 
this error

在 2014年7月8日星期二UTC+8下午8时12分48秒,Tim Visher写道:
>
> On Tue, Jul 8, 2014 at 7:39 AM, zhenxuanpan  > wrote: 
> > when i run lein install 
> > 
> > lein install 
> > Compiling zilch.mq 
> > Exception in thread "main" java.io.FileNotFoundException: Could not 
> locate 
> > zilch/mq__init.class or zilch/mq.clj on classpath: 
> > at clojure.lang.RT.load(RT.java:432) 
> > at clojure.lang.RT.load(RT.java:400) 
> > at clojure.core$load$fn__4890.invoke(core.clj:5415) 
> > at clojure.core$load.doInvoke(core.clj:5414) 
> > at clojure.lang.RestFn.invoke(RestFn.java:408) 
> > at clojure.core$load_one.invoke(core.clj:5227) 
> > at clojure.core$compile$fn__4895.invoke(core.clj:5426) 
> > at clojure.core$compile.invoke(core.clj:5425) 
> > at user$eval9.invoke(form-init581473078545854006.clj:1) 
> > at clojure.lang.Compiler.eval(Compiler.java:6511) 
> > at clojure.lang.Compiler.eval(Compiler.java:6501) 
> > at clojure.lang.Compiler.load(Compiler.java:6952) 
> > at clojure.lang.Compiler.loadFile(Compiler.java:6912) 
> > at clojure.main$load_script.invoke(main.clj:283) 
> > at clojure.main$init_opt.invoke(main.clj:288) 
> > at clojure.main$initialize.invoke(main.clj:316) 
> > at clojure.main$null_opt.invoke(main.clj:349) 
> > at clojure.main$main.doInvoke(main.clj:427) 
> > at clojure.lang.RestFn.invoke(RestFn.java:421) 
> > at clojure.lang.Var.invoke(Var.java:419) 
> > at clojure.lang.AFn.applyToHelper(AFn.java:163) 
> > at clojure.lang.Var.applyTo(Var.java:532) 
> > at clojure.main.main(main.java:37) 
> > Compilation failed: Subprocess failed 
>
> Is your source code available anywhere? Harder to help without it. 
>
> -- 
>
> In Christ, 
>
> Timmy V. 
>
> http://blog.twonegatives.com/ 
> http://five.sentenc.es/ -- Spend less time on mail 
>

-- 
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: lein install

2014-07-08 Thread zhenxuanpan


在 2014年7月8日星期二UTC+8下午7时39分51秒,zhenxuanpan写道:
>
> when i run lein install
>
> lein install
> Compiling zilch.mq
> Exception in thread "main" java.io.FileNotFoundException: Could not locate 
> zilch/mq__init.class or zilch/mq.clj on classpath: 
> at clojure.lang.RT.load(RT.java:432)
> at clojure.lang.RT.load(RT.java:400)
> at clojure.core$load$fn__4890.invoke(core.clj:5415)
> at clojure.core$load.doInvoke(core.clj:5414)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:5227)
> at clojure.core$compile$fn__4895.invoke(core.clj:5426)
> at clojure.core$compile.invoke(core.clj:5425)
> at user$eval9.invoke(form-init581473078545854006.clj:1)
> at clojure.lang.Compiler.eval(Compiler.java:6511)
> at clojure.lang.Compiler.eval(Compiler.java:6501)
> at clojure.lang.Compiler.load(Compiler.java:6952)
> at clojure.lang.Compiler.loadFile(Compiler.java:6912)
> at clojure.main$load_script.invoke(main.clj:283)
> at clojure.main$init_opt.invoke(main.clj:288)
> at clojure.main$initialize.invoke(main.clj:316)
> at clojure.main$null_opt.invoke(main.clj:349)
> at clojure.main$main.doInvoke(main.clj:427)
> at clojure.lang.RestFn.invoke(RestFn.java:421)
> at clojure.lang.Var.invoke(Var.java:419)
> at clojure.lang.AFn.applyToHelper(AFn.java:163)
> at clojure.lang.Var.applyTo(Var.java:532)
> at clojure.main.main(main.java:37)
> Compilation failed: Subprocess failed
>
>

-- 
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.


Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Ashish Negi
I am new to clojure and finding it great.. :)

I came across a paper - Why functional programming matters ?
at www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf



to quote it :
"This paper is also relevant to the present controversy over lazy 
evaluation.
Some believe that functional languages should be lazy; others believe they
should not. Some compromise and provide only lazy lists, with a special 
syntax
for constructing them (as, for example, in Scheme [1]). This paper provides
further evidence that lazy evaluation is too important to be relegated to 
*secondclasscitizenship*. It is perhaps the most powerful glue functional 
programmers
possess. One should not obstruct access to such a vital tool."

I know that if you people have taken some important decision for clojure, 
it must had been after some thoughts.

Was it difficult to implement or not that good ?

-- 
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.


Fibonacci Heaps and Dijkstra's algorithm

2014-07-08 Thread Ashish Negi
I came across this article : 
http://maryrosecook.com/blog/post/the-fibonacci-heap-ruins-my-life

The user says that he can not use fibonacci heaps efficiently in clojure 
because since the memory location of nodes changes, it is not possible to 
have a pointer to the nodes to get faster access to them.
This is important in Dijkstra algorithm of shortest distance because you 
have to change the value/keys of nodes. Changing values and reshuffling is 
fast in fibonacci heaps. But for that you need accesss to the node.

This is easy in c++ but not that in clojure .

How can we achieve the same thing ? Can we have some more tweaks to 
Fib-Heaps to make it happen in clojure ? any other alternative data 
structure ? 

-- 
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.


Local variable

2014-07-08 Thread Cecil Westerhof
In Clojure you can define a local constant with let, but I need a variable
(I think).

I want to do the following. I have a function that checks several things.
Every time an error is found I want to set the variable errors to:
(concat errors new-error)

Is this possible? Or is there a better way to do this?

-- 
Cecil Westerhof

-- 
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: Local variable

2014-07-08 Thread Michael Klishin
 On 8 July 2014 at 17:40:49, Cecil Westerhof (cldwester...@gmail.com) wrote:
> > In Clojure you can define a local constant with let, but I need  
> a variable (I think).

They are not constants. Locals can be "overwritten" but their data structures
are immutable (by default).

> I want to do the following. I have a function that checks several  
> things. Every time an error is found I want to set the variable  
> errors to:
> (concat errors new-error)
>  
> Is this possible? Or is there a better way to do this?

You can do that with loop/recur or an atom. The key is to understand
that in Clojure, values and references are separate, and references
can be mutated but in a particular, concurrency-aware way:

http://clojure-doc.org/articles/language/concurrency_and_parallelism.html#identity/value-separation-("on-state-and-identity")
--  
MK

-- 
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: Local variable

2014-07-08 Thread Ashish Negi
you can make that variable "error" as an Agent and change it asynchronously 
or as a Ref if you want the change synchronously. other part of the code 
remains same.

On Tuesday, 8 July 2014 19:10:54 UTC+5:30, Cecil Westerhof wrote:
>
> In Clojure you can define a local constant with let, but I need a variable 
> (I think).
>
> I want to do the following. I have a function that checks several things. 
> Every time an error is found I want to set the variable errors to:
> (concat errors new-error)
>
> Is this possible? Or is there a better way to do this?
>
> -- 
> Cecil Westerhof 
>

-- 
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: Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Zach Oakes
Abstract topics like this are interesting, but you may be better off 
starting a discussion at a more generic venue like /r/programming, because 
it isn't really specific to Clojure. I would assume that pervasive laziness 
would greatly complicate interop with hosts like the JVM.

On Tuesday, July 8, 2014 9:13:56 AM UTC-4, Ashish Negi wrote:
>
> I am new to clojure and finding it great.. :)
>
> I came across a paper - Why functional programming matters ?
> at www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf
>
>
>
> to quote it :
> "This paper is also relevant to the present controversy over lazy 
> evaluation.
> Some believe that functional languages should be lazy; others believe they
> should not. Some compromise and provide only lazy lists, with a special 
> syntax
> for constructing them (as, for example, in Scheme [1]). This paper provides
> further evidence that lazy evaluation is too important to be relegated to 
> *secondclasscitizenship*. It is perhaps the most powerful glue functional 
> programmers
> possess. One should not obstruct access to such a vital tool."
>
> I know that if you people have taken some important decision for clojure, 
> it must had been after some thoughts.
>
> Was it difficult to implement or not that good ?
>

-- 
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: Local variable

2014-07-08 Thread John Gabriele
On Tuesday, July 8, 2014 9:40:54 AM UTC-4, Cecil Westerhof wrote:
>
> In Clojure you can define a local constant with let, but I need a variable 
> (I think).
>
> I want to do the following. I have a function that checks several things. 
> Every time an error is found I want to set the variable errors to:
> (concat errors new-error)
>
> Is this possible? Or is there a better way to do this?
>
>
You *could* do something like:

~~~
(let [errors  (atom [])
  ...
  (swap! errors conj "error-X")
  ...)
~~~

though, a more functional approach might look more like:

~~~
(loop [errors []
   things-to-check ...]
  (if (empty? things-to-check)
errors
(recur (conj errors (check (first things-to-check)))
   (rest things-to-check
~~~

-- John

-- 
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: System/getenv can't read env vars?

2014-07-08 Thread Jarrod Swart
James,

It appears Sean and yourself have identified the issue.  The tmux scripts 
that launch my dev environment don't pull in the necessary environment.  

I have seen your environ library and I was to thank you for all your 
contributions.  Sean too!

While I have you James do you have a good example of an upstart script for 
uberjars handy?  

I think I saw you post one somewhere but I can't find it despite my search 
attempts.

-- 
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: Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread James Reeves
Laziness is a useful property, but it is not without its disadvantages,
particularly in terms of predictable performance. For example, code
involving lazy seqs is more prone to memory leaks than iterators are.

Eager evaluation is a simpler approach, in terms of both code and
predictability. Eager evaluation fails fast, and has predictable
performance characteristics. Laziness is a useful tool to have in one's
arsenal, but I don't believe it should be the norm, as most of the time
it's not necessary.

Of course, most Haskell users would probably disagree with me :)

- James



On 8 July 2014 14:13, Ashish Negi  wrote:

> I am new to clojure and finding it great.. :)
>
> I came across a paper - Why functional programming matters ?
> at www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf
>
>
>
> to quote it :
> "This paper is also relevant to the present controversy over lazy
> evaluation.
> Some believe that functional languages should be lazy; others believe they
> should not. Some compromise and provide only lazy lists, with a special
> syntax
> for constructing them (as, for example, in Scheme [1]). This paper provides
> further evidence that lazy evaluation is too important to be relegated to
> *secondclasscitizenship*. It is perhaps the most powerful glue functional
> programmers
> possess. One should not obstruct access to such a vital tool."
>
> I know that if you people have taken some important decision for clojure,
> it must had been after some thoughts.
>
> Was it difficult to implement or not that good ?
>
> --
> 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: System/getenv can't read env vars?

2014-07-08 Thread James Reeves
I use an upstart script like:

description "Some description"
author "Your name"

start on startup
stop on shutdown

setuid deploy
chdir /deploy
console log

env PORT=4000

exec java -jar uberjar-name.jar

In the above case, I deploy to the "/deploy" directory, and execute the jar
using a non-privileged user named "deploy".

- James


On 8 July 2014 16:07, Jarrod Swart  wrote:

> James,
>
> It appears Sean and yourself have identified the issue.  The tmux scripts
> that launch my dev environment don't pull in the necessary environment.
>
> I have seen your environ library and I was to thank you for all your
> contributions.  Sean too!
>
> While I have you James do you have a good example of an upstart script for
> uberjars handy?
>
> I think I saw you post one somewhere but I can't find it despite my search
> attempts.
>

-- 
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: Local variable

2014-07-08 Thread Cecil Westerhof
2014-07-08 16:55 GMT+02:00 John Gabriele :

> On Tuesday, July 8, 2014 9:40:54 AM UTC-4, Cecil Westerhof wrote:
>>
>> In Clojure you can define a local constant with let, but I need a
>> variable (I think).
>>
>> I want to do the following. I have a function that checks several things.
>> Every time an error is found I want to set the variable errors to:
>> (concat errors new-error)
>>
>> Is this possible? Or is there a better way to do this?
>>
>>
> You *could* do something like:
>
> ~~~
> (let [errors  (atom [])
>   ...
>   (swap! errors conj "error-X")
>   ...)
> ~~~
>

​I al-ready tried something along those lines:​
(defn error-in-datastruct-p []
  (let [errors (atom ())]
   (if (= (count objects) (count *object-locations*))
   (map (fn [x]
(println x)
(if (not (*object-locations* x))
(do
(println x)
(swap! errors conj (remove-symbol-from-output
`(No location for ~x)))
@errors
)
  ))
objects)
 (swap! errors conj '(Number of objects and number of object
locations is not the same.)))
   @errors))

(error-in-datastruct-p)

This gives:
user=> user=> ()

When I only remove the last @errors, I get:
user=> user=> (whiskey
bucket
nil chain
nil frog
nil pole
pole
nil ((No location for pole)))


What could be happening here?

The variables are defined with:
(def objects '(whiskey bucket chain frog pole))

(def ^:dynamic *object-locations* {
 'whiskey   'living-room
 'bucket'living-room
 'chain 'garden
 'frog  'garden
 'dummy 'nowhere
 })

And I am using clojure 1.6.0.


​By the way when changing *object-locations* to:​
​(def ^:dynamic *object-locations* {
 'whiskey   'living-room
 'bucket'living-room
 'chain 'garden
 'frog  'garden
 })

​There is no problem, then I get the expected:
user=> user=> ((Number of objects and number of object locations is not the
same.))


-- 
Cecil Westerhof

-- 
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: System/getenv can't read env vars?

2014-07-08 Thread Jarrod Swart
Awesome thank you!

-- 
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.


[ANN] Nightcode 0.3.8 and Nightmod 0.1.4

2014-07-08 Thread Zach Oakes
I recently released updates for Nightcode (a Clojure IDE) and Nightmod (a 
Clojure game tool).

Nightcode  has mostly received maintenance 
updates, because the main priority is being beginner-friendly rather than 
featureful. I finally added support for evaling a selected form in a REPL, 
for example, almost a year since I first released it.

Nightmod  has been steadily improved since my first 
release over a month ago. You can star it on Github 
 and give it visibility on HN 
. I hope it becomes useful 
for teaching, as it is an all-in-one tool and provides instant feedback.

-- 
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: Local variable

2014-07-08 Thread Lars Nilsson
On Tue, Jul 8, 2014 at 11:38 AM, Cecil Westerhof  wrote:
> I al-ready tried something along those lines:
> (defn error-in-datastruct-p []
>   (let [errors (atom ())]
>(if (= (count objects) (count *object-locations*))
>(map (fn [x]
> (println x)
> (if (not (*object-locations* x))
> (do
> (println x)
> (swap! errors conj (remove-symbol-from-output
> `(No location for ~x)))
> @errors
> )
>   ))
> objects)
>  (swap! errors conj '(Number of objects and number of object
> locations is not the same.)))
>@errors))
>
> (error-in-datastruct-p)
>
> This gives:
> user=> user=> ()
>
> When I only remove the last @errors, I get:
> user=> user=> (whiskey
> bucket
> nil chain
> nil frog
> nil pole
> pole
> nil ((No location for pole)))
>
>
> What could be happening here?

You're discarding the result of the (if ...) because it is directly
followed by @errors and as a result the lazy evaluation of (map ...)
is not happening, and your println and errors updates does not get
executed.

Lars Nilsson

-- 
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: Local variable

2014-07-08 Thread John Gabriele
On Tuesday, July 8, 2014 11:38:42 AM UTC-4, Cecil Westerhof wrote:
>
>
>
>
> 2014-07-08 16:55 GMT+02:00 John Gabriele >:
>
>> On Tuesday, July 8, 2014 9:40:54 AM UTC-4, Cecil Westerhof wrote:
>>>
>>> In Clojure you can define a local constant with let, but I need a 
>>> variable (I think).
>>>
>>> I want to do the following. I have a function that checks several 
>>> things. Every time an error is found I want to set the variable errors to:
>>> (concat errors new-error)
>>>
>>> Is this possible? Or is there a better way to do this?
>>>
>>>
>> You *could* do something like:
>>
>> ~~~
>> (let [errors  (atom [])
>>   ...
>>   (swap! errors conj "error-X")
>>   ...)
>> ~~~
>>
>
> ​I al-ready tried something along those lines:​
> (defn error-in-datastruct-p []
>   (let [errors (atom ())]
>(if (= (count objects) (count *object-locations*))
>(map (fn [x]
> (println x)
> (if (not (*object-locations* x))
> (do
> (println x)
> (swap! errors conj (remove-symbol-from-output 
> `(No location for ~x)))
> @errors
> )
>   ))
> objects)
>  (swap! errors conj '(Number of objects and number of object 
> locations is not the same.)))
>@errors))
>
>
`map` is for creating seqs (and lazy ones at that); it's not for 
side-effects. If you want side-effects, try `doseq`.

Also, just a matter of style, but it's customary to leave closing parens at 
the end of a line, rather than by themselves on their own line.

-- 
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] Grimoire: up to date Clojure web docs

2014-07-08 Thread Colin Fleming
That was sort of a royal "we, the community". I think everyone probably
agrees that it's not in anyone's interest to have two separate clojure doc
sites serving essentially exactly the same purpose (docs + examples). It
looks like Zachary is working fairly actively on his new ClojureDocs
version, is he on the mailing list here? Does anyone know what the ETA for
a new version is?


On 8 July 2014 13:08, Andy Fingerhut  wrote:

> On Tue, Jul 8, 2014 at 3:28 AM, Colin Fleming  > wrote:
>
>> If we think that Grimoire should be the official ClojureDocs replacement,
>> why don't we do that? Could we just host Grimoire under the
>> clojuredocs.org domain, perhaps structuring the URLs to match?
>>
>
> Depends upon who you mean by "we".  The clojuredocs.org domain is owned
> by Zachary Kim, according to a search at whois.net.  He gets to decide
> what is published there.  Lately he has been actively working on a rewrite
> of the ClojureDocs.org server code in Clojure, intended to replace the
> original version written in Ruby:
>
> https://github.com/zk/clojuredocs
>
> Andy
>
>
> On 8 July 2014 11:52, Andy Fingerhut  wrote:
>
>> Mark, creating separate versions of the Clojure cheat sheet that link to
>> Grimoire instead of ClojureDocs.org should be fairly straightforward, but
>> due to other work I won't get to it for at least a few days.  If someone
>> else is interested, and not put off by my code, they are welcome to go for
>> it and submit a pull request:
>>
>> https://github.com/jafingerhut/clojure-cheatsheets
>>
>> The time-consuming part isn't getting the first version up and running,
>> but checking that all the symbols with odd characters in them actually have
>> working links in both the HTML and PDF versions, although arguably the
>> links in the PDF versions aren't as important.
>>
>> I can publish the results here, which is one click away from
>> http://clojure.org/cheatsheet
>>
>> http://jafingerhut.github.io
>>
>> Once done, Clojure folks other than myself can consider whether the
>> version with links to Grimoire belongs at http://clojure.org/cheatsheet,
>> too.
>>
>> Andy
>>
>>
>> On Mon, Jul 7, 2014 at 9:49 PM, Mark Mandel 
>> wrote:
>>
>>> Nice work! I've been using Grimoire all day :)
>>>
>>> Two small suggestions, which you have probably thought of: (1) search
>>>  (2) a copy of the clojure cheat sheet that points to grimoire instead.
>>> (Maybe Grimoire needs it's own domain?)
>>>
>>> CrossClj is *awesome* as well. I've been wanting something similar for a
>>> looong time. Thanks!
>>>
>>> Mark
>>>
>>>
>>>
>>> On Tue, Jul 8, 2014 at 2:31 PM, Reid McKenzie 
>>> wrote:
>>>
  I'm delighted to announce that thanks to the official Clojuredocs
 client (https://github.com/dakrone/clojuredocs-client) Grimoire now
 features every example posted on Clojuredocs.

 Ex.
 http://www.arrdem.com/grimoire/1.6.0/clojure.core/DASH__GT__GT/#example-0

 Currently at 0.0.13, which represents a slew of changes since the
 original announcement including the dropping of 1.5.1 as a documented
 version (it's a patch release, nothing changed from 1.5.0) and a major
 rework of the way I munge symbols and include examples between versions.

 I'd like to give Alex (puredanger) a huge shout out for handing me a
 SQL dump of the clojuredocs examples table right after I got a dakrone's
 client working.

 More tooling thanks to Phil (technomancy), lein's profiles enabled me
 to ditch a make target which downloaded old Clojure versions in favor of
 simply having one lein profile for each documented Clojure version.


 Reid

 On 07/07/2014 04:54 PM, cldwalker wrote:

 Hey Reid,

  Nice work! I think this is a much more maintainable approach for a
 community-based examples repository.  Have you thought about seeding
 examples from clojuredocs using their api e.g.
 http://api.clojuredocs.org/examples/1.3.0/clojure.core/map? I think
 this would help if the goal is to become the canonical site for clojure fn
 examples.

  It is worth noting that clojuredocs is undergoing a rewrite,
 https://github.com/zk/clojuredocs/tree/clj-rewrite. If this rewrite
 lands soon than it may be worth adding a Motivation section to the home
 page to distinguish it from clojuredocs.org.

  On Tuesday, July 1, 2014 7:34:38 PM UTC-4, Reid McKenzie wrote:
>
> Hey guys,
>
> If you're like me while using clojure.repl/doc works for the most part
> there are just times that you need to send someone a link to the
> official docs and navigating the docstrings in the core Clojure
> repository is a pain.
>
> After several months of being frustrated that clojuredocs is out of
> date, I finally sat down and built an alternative which I'm pleased to
> present here: http://www.arrdem.com/grimoire/
>
> Grimoire is still alpha and subject to change, esp

Re: Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Marko Kocić
Clojure doesn't have lazy evaluation because it is a "few" years younger 
and didn't want to repeat Haskell's mistake. Even Simon Payton Jones, the 
creator of Haskel, confessed that, if he would make Haskel again, he would 
make it strict, and not lazy, but that it's too late to change 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.


Re: Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Andrey Antukh
2014-07-08 18:20 GMT+02:00 Marko Kocić :

> Clojure doesn't have lazy evaluation because it is a "few" years younger
> and didn't want to repeat Haskell's mistake. Even Simon Payton Jones, the
> creator of Haskel, confessed that, if he would make Haskel again, he would
> make it strict, and not lazy, but that it's too late to change it.
>
> --
>

Sorry for offtopic, but, you have source of it?

Andrey


> 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: Local variable

2014-07-08 Thread Cecil Westerhof
2014-07-08 18:14 GMT+02:00 John Gabriele :

> On Tuesday, July 8, 2014 11:38:42 AM UTC-4, Cecil Westerhof wrote:
>>
>>
>>
>>
>> 2014-07-08 16:55 GMT+02:00 John Gabriele :
>>
>> On Tuesday, July 8, 2014 9:40:54 AM UTC-4, Cecil Westerhof wrote:

 In Clojure you can define a local constant with let, but I need a
 variable (I think).

 I want to do the following. I have a function that checks several
 things. Every time an error is found I want to set the variable errors to:
 (concat errors new-error)

 Is this possible? Or is there a better way to do this?


>>> You *could* do something like:
>>>
>>> ~~~
>>> (let [errors  (atom [])
>>>   ...
>>>   (swap! errors conj "error-X")
>>>   ...)
>>> ~~~
>>>
>>
>> ​I al-ready tried something along those lines:​
>> (defn error-in-datastruct-p []
>>   (let [errors (atom ())]
>>(if (= (count objects) (count *object-locations*))
>>(map (fn [x]
>> (println x)
>> (if (not (*object-locations* x))
>> (do
>> (println x)
>> (swap! errors conj (remove-symbol-from-output
>> `(No location for ~x)))
>> @errors
>> )
>>   ))
>> objects)
>>  (swap! errors conj '(Number of objects and number of object
>> locations is not the same.)))
>>@errors))
>>
>>
> `map` is for creating seqs (and lazy ones at that); it's not for
> side-effects. If you want side-effects, try `doseq`.
>

​That was the problem. I know have:
(defn error-in-datastruct-p []
  (let [errors (atom ())]
   (if (= (count objects) (count *object-locations*))
   (doseq [obj objects]
  (if (not (*object-locations* obj))
  (swap! errors conj (remove-symbol-from-output `(No
location for ~obj)
 (swap! errors conj '(Number of objects and number of object
locations is not the same.)))
   (reverse @errors)))

And that works.

​


> Also, just a matter of style, but it's customary to leave closing parens
> at the end of a line, rather than by themselves on their own line.
>

​I do that also, but when I am editing I put them on there own line,
because in this way changes are faster. When I am satisfied, I merge them.
;-)


By the way I would like to put a point after the message, like:
(swap! errors conj (remove-symbol-from-output `(No location for
~obj.)
​

​But that gives:
CompilerException java.lang.ClassNotFoundException: obj.,
compiling:(NO_SOURCE_PATH:124:42)

Is there a way to get the point behind the line?​

-- 
Cecil Westerhof

-- 
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: Local variable

2014-07-08 Thread blake
>
> Also, just a matter of style, but it's customary to leave closing parens
>> at the end of a line, rather than by themselves on their own line.
>>
>
> ​I do that also, but when I am editing I put them on there own line,
> because in this way changes are faster. When I am satisfied, I merge them.
> ;-)
>
>
I also tend to not stack them like that till I'm done futzing. Pretty sure
it's a sign of noobiness. =P

When I see others code, they're perfectly capable of using the editor to
slide the expressions around so that it doesn't matter if the parens are at
the end of the line. (Learning to do that is next on my to-do list.)

-- 
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: Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Colin Fleming
I searched for this as well, and found this:
http://www.cs.nott.ac.uk/~gmh/appsem-slides/peytonjones.ppt

"Purity is more important than, and quite independent of, laziness"

and

"The next ML will be pure, with effects only via monads.  The next Haskell
will be strict, but still pure."


On 8 July 2014 19:58, Andrey Antukh  wrote:

> 2014-07-08 18:20 GMT+02:00 Marko Kocić :
>
> Clojure doesn't have lazy evaluation because it is a "few" years younger
>> and didn't want to repeat Haskell's mistake. Even Simon Payton Jones, the
>> creator of Haskel, confessed that, if he would make Haskel again, he would
>> make it strict, and not lazy, but that it's too late to change it.
>>
>> --
>>
>
> Sorry for offtopic, but, you have source of it?
>
> Andrey
>
>
>>  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 - Андрей Антух -  / <
> 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] Grimoire: up to date Clojure web docs

2014-07-08 Thread Reid McKenzie
1) doesn't make a whole lot of sense. I'm an adherent to the "simplest
thing that could possibly work" philosophy, and as a result Grimoire is
entirely static HTML. Search and symbol quick access could be
implemented by adding some javascript, but that's a low priority item at
the moment as there are still basic usability and layout concerns being
addressed. Feel free to open an improvement issue on Github
(http://github.com/arrdem/grimoire/). Down the road it may be worth
questioning this static HTML approach as there are a number of tricks
one could play such as ranking symbols by the frequency with which their
documentation is visited which are impossible in pure static HTML.

2) this probably does make sense. I think it's worth doing some more
general study of how people discover Clojure functions, but the
categorized quick reference provided by the various cheat sheets is an
index I'd love to have in Grimoire, perhaps even as part of the homepage?

3) http://grimoire.arrdem.com/ exists, however it's pretty broken and
there's some configuration changes that need to happen (and which will
break http://arrdem.com/grimoire) in order for it to work. I'm open for
suggestions WRT having a dedicated domain, however remember I'm a GSoC
student on a shoestring budget building this in my free time :P. I'm
open to comment as to which URL you find more generally useful.

Reid

On 07/07/2014 11:49 PM, Mark Mandel wrote:
> Nice work! I've been using Grimoire all day :)
>
> Two small suggestions, which you have probably thought of: (1) search
>  (2) a copy of the clojure cheat sheet that points to grimoire
> instead. (Maybe Grimoire needs it's own domain?)
>
> CrossClj is *awesome* as well. I've been wanting something similar for
> a looong time. Thanks!
>
> Mark
>
>
>
> On Tue, Jul 8, 2014 at 2:31 PM, Reid McKenzie  > wrote:
>
> I'm delighted to announce that thanks to the official Clojuredocs
> client (https://github.com/dakrone/clojuredocs-client) Grimoire
> now features every example posted on Clojuredocs.
>
> Ex.
> http://www.arrdem.com/grimoire/1.6.0/clojure.core/DASH__GT__GT/#example-0
>
> Currently at 0.0.13, which represents a slew of changes since the
> original announcement including the dropping of 1.5.1 as a
> documented version (it's a patch release, nothing changed from
> 1.5.0) and a major rework of the way I munge symbols and include
> examples between versions.
>
> I'd like to give Alex (puredanger) a huge shout out for handing me
> a SQL dump of the clojuredocs examples table right after I got a
> dakrone's client working.
>
> More tooling thanks to Phil (technomancy), lein's profiles enabled
> me to ditch a make target which downloaded old Clojure versions in
> favor of simply having one lein profile for each documented
> Clojure version.
>
>
> Reid
>
> On 07/07/2014 04:54 PM, cldwalker wrote:
>> Hey Reid,
>>
>> Nice work! I think this is a much more maintainable approach for
>> a community-based examples repository.  Have you thought about
>> seeding examples from clojuredocs using their api
>> e.g. http://api.clojuredocs.org/examples/1.3.0/clojure.core/map?
>> I think this would help if the goal is to become the canonical
>> site for clojure fn examples.
>>
>> It is worth noting that clojuredocs is undergoing a
>> rewrite, https://github.com/zk/clojuredocs/tree/clj-rewrite. If
>> this rewrite lands soon than it may be worth adding a Motivation
>> section to the home page to distinguish it from clojuredocs.org
>> .
>>
>> On Tuesday, July 1, 2014 7:34:38 PM UTC-4, Reid McKenzie wrote:
>>
>> Hey guys,
>>
>> If you're like me while using clojure.repl/doc works for the
>> most part
>> there are just times that you need to send someone a link to the
>> official docs and navigating the docstrings in the core Clojure
>> repository is a pain.
>>
>> After several months of being frustrated that clojuredocs is
>> out of
>> date, I finally sat down and built an alternative which I'm
>> pleased to
>> present here: http://www.arrdem.com/grimoire/
>>
>> Grimoire is still alpha and subject to change, especially
>> with regards
>> to the example contribution process which needs streamlining
>> beyond the
>> current "click a link, edit on github and submit a PR".
>>
>>
>> I think this is a reasonable approach. It's better than having a
>> login just for clojuredocs.
>>  
>>
>>
>> I'd like to give a shout out to César for porting
>> clojure.repl/source
>> into the doc generation script and to Nicola for his random
>> usability
>> criticisms.
>>
>>
>>
>>
>> Cheers,
>> Gabriel
>>  
>>
>>
>> Reid McKenzie
>>
>> -- 
>> You received thi

Re: [ANN] Grimoire: up to date Clojure web docs

2014-07-08 Thread Reid McKenzie
Not as such. Strictly speaking one can navigate to say
https://github.com/arrdem/grimoire/edit/master/_includes/1.4.0/clojure.core/DASH/examples.md
and find all the examples for what is in this case clojure.core/-.
However there is no examples API at present and due to the flat file
nature of Grimoire I consider one more or less out of scope until such
time as Grimoire gets reworked into a "real" webapp if ever.

As Grimoire contains only examples from clojuredocs at present, the
clojuredocs REPL client (https://github.com/dakrone/clojuredocs-client)
(which is what Grimoire uses to access clojuredocs' examples) should
give you identical results for the time being.

I'm open to comment and issues as to whether or not having REPL access
to examples is potentially useful and a desired feature.

Reid


On 07/08/2014 05:28 AM, Colin Fleming wrote:
> If we think that Grimoire should be the official ClojureDocs
> replacement, why don't we do that? Could we just host Grimoire under
> the clojuredocs.org  domain, perhaps
> structuring the URLs to match?
>
> One thing that I couldn't see - does Grimoire offer an API to get
> access to the examples?
>
>
> On 8 July 2014 11:52, Andy Fingerhut  > wrote:
>
> Mark, creating separate versions of the Clojure cheat sheet that
> link to Grimoire instead of ClojureDocs.org should be fairly
> straightforward, but due to other work I won't get to it for at
> least a few days.  If someone else is interested, and not put off
> by my code, they are welcome to go for it and submit a pull request:
>
> https://github.com/jafingerhut/clojure-cheatsheets
>
> The time-consuming part isn't getting the first version up and
> running, but checking that all the symbols with odd characters in
> them actually have working links in both the HTML and PDF
> versions, although arguably the links in the PDF versions aren't
> as important.
>
> I can publish the results here, which is one click away from
> http://clojure.org/cheatsheet
>
> http://jafingerhut.github.io
>
> Once done, Clojure folks other than myself can consider whether
> the version with links to Grimoire belongs at
> http://clojure.org/cheatsheet, too.
>
> Andy
>
>
> On Mon, Jul 7, 2014 at 9:49 PM, Mark Mandel  > wrote:
>
> Nice work! I've been using Grimoire all day :)
>
> Two small suggestions, which you have probably thought of: (1)
> search  (2) a copy of the clojure cheat sheet that points to
> grimoire instead. (Maybe Grimoire needs it's own domain?)
>
> CrossClj is *awesome* as well. I've been wanting something
> similar for a looong time. Thanks!
>
> Mark
>
>
>
> On Tue, Jul 8, 2014 at 2:31 PM, Reid McKenzie
> mailto:rmckenzi...@gmail.com>> wrote:
>
> I'm delighted to announce that thanks to the official
> Clojuredocs client
> (https://github.com/dakrone/clojuredocs-client) Grimoire
> now features every example posted on Clojuredocs.
>
> Ex.
> 
> http://www.arrdem.com/grimoire/1.6.0/clojure.core/DASH__GT__GT/#example-0
>
> Currently at 0.0.13, which represents a slew of changes
> since the original announcement including the dropping of
> 1.5.1 as a documented version (it's a patch release,
> nothing changed from 1.5.0) and a major rework of the way
> I munge symbols and include examples between versions.
>
> I'd like to give Alex (puredanger) a huge shout out for
> handing me a SQL dump of the clojuredocs examples table
> right after I got a dakrone's client working.
>
> More tooling thanks to Phil (technomancy), lein's profiles
> enabled me to ditch a make target which downloaded old
> Clojure versions in favor of simply having one lein
> profile for each documented Clojure version.
>
>
> Reid
>
> On 07/07/2014 04:54 PM, cldwalker wrote:
>> Hey Reid,
>>
>> Nice work! I think this is a much more maintainable
>> approach for a community-based examples repository.  Have
>> you thought about seeding examples from clojuredocs using
>> their api
>> e.g. http://api.clojuredocs.org/examples/1.3.0/clojure.core/map?
>> I think this would help if the goal is to become the
>> canonical site for clojure fn examples.
>>
>> It is worth noting that clojuredocs is undergoing a
>> rewrite, https://github.com/zk/clojuredocs/tree/clj-rewrite.
>> If this rewrite lands soon than it may be worth adding a
>> Motivation section to the home page to distinguish it
>> from clojuredocs.org .
>>
>>

[nginx-clojure] Getting started question

2014-07-08 Thread Boris Kourtoukov
I am working on a small personal project and want to use/learn nginx and 
clojure as the web backend. Unfortunately I am bogged down my the 
installation instructions.

I have Nginx running and serving html on a Linode instance, I just don't 
know enough about it's plugins to do step 1.1 "Installation by Binary"  in 
the nginx-clojure instructions: 
https://github.com/nginx-clojure/nginx-clojure#11-installation-by-binary

The way I read it nginx-clojure is meant to completely replace nginx on the 
machine? So should I remove the prior version, install this from binary and 
then re-setup the served sites? 

Thanks and sorry for the basic question,
Boris

-- 
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.


[question] Multimethods vs case

2014-07-08 Thread Elric Erkose
Is there any documentation or do you have thoughts on choosing between 
using multimethods vs case? I assume they both do constant time dispatch.

-- 
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: Client side tools for Clojure web app (back end questions as well, especially Pedestal)

2014-07-08 Thread Ahmad Hammad
Brendan, could you please elaborate on how you handled client/server 
communication with a project using Reagent/Om?

-- 
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: Local variable

2014-07-08 Thread Bob Hutchison

On Jul 8, 2014, at 9:40 AM, Cecil Westerhof  wrote:

> In Clojure you can define a local constant with let, but I need a variable (I 
> think).
> 
> I want to do the following. I have a function that checks several things. 
> Every time an error is found I want to set the variable errors to:
> (concat errors new-error)
> 
> Is this possible? Or is there a better way to do this?

Here's a different take on your question, and a few comments about how I'd 
write that code. I don't think you need the atom -- kinda ugly and the 
reduce/map/filter family of sequence functions will take you a long way.

; This is not a predicate, so don't use the -p suffix (and in Clojure it's a ? 
normally)
; There's no reason not to pass those two objects into this function, so I do.
(defn errors-in-datastruct [locations objects]
  (if (= (count objects) (count locations))
; 'remove' makes a new sequence containing elements that had a falsey 
; (false or nil) result to the provided function -- that is the objects
; with no location

; the mapv maps a function over a sequence resulting in a vector.
; the function creates a vector pair for each object containing the error
; code and object

; I find vectors more natural to use in Clojure

; I also find keywords more natural (and useful)

; In my mind, finding the errors and reporting them are two separate 
functions. If you want to make
; a nicer error report, then map a reporting function over the error codes.

(mapv #(vector :no-location %) (remove locations objects))

; This reduce does something similar to the mapv/remove combination above, 
but 
; it gives you more flexibility.

#_(reduce (fn [errors obj] 
(if (locations obj) 
  errors 
  (conj errors [:no-location obj]))) [] objects)

[[:counts-differ]]))

; use locally scoped variables if you can
(let [locations {:whiskey :living-room
 :bucket  :living-room
 :chain   :garden
 :frog:garden
 :dummy   :nowhere}]
  (println (errors-in-datastruct locations [:whiskey :bucket :chain :frog 
:dummy]))
  (println (errors-in-datastruct locations [:whiskey :bucket :chain :frog :pole 
:dummy]))
  (println (errors-in-datastruct locations [:whiskey :bucket :chain :frog 
:pole]))
  (println (errors-in-datastruct locations [:whiskey :bucket :chain :frog1 
:pole]))
  (println (errors-in-datastruct locations [:whiskey :whiskey :whiskey :whiskey 
:whiskey])))


; If you need to use the same locations map and don't want to pass it around, 
you can
; partially apply the errors-in-datastruct function to the locations, and use 
that function.
; You probably don't care about this but the technique can be very handy when 
getting
; rid of global variables.
(let [f (partial errors-in-datastruct {:whiskey :living-room
   :bucket  :living-room
   :chain   :garden
   :frog:garden
   :dummy   :nowhere})]
  (println (f [:whiskey :bucket :chain :frog :dummy]))
  (println (f [:whiskey :bucket :chain :frog :pole :dummy]))
  (println (f [:whiskey :bucket :chain :frog :pole]))
  (println (f [:whiskey :bucket :chain :frog1 :pole])))


I hope you can make sense of that :-)

Cheers,
Bob

> 
> -- 
> Cecil Westerhof
> 
> -- 
> 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: [question] Multimethods vs case

2014-07-08 Thread Sam Ritchie
Use multimethods if you want to open the system up for later extension 
(by a library user, for example).



Elric Erkose 
July 8, 2014 at 2:02 PM
Is there any documentation or do you have thoughts on choosing between 
using multimethods vs case? I assume they both do constant time dispatch.

--
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.


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
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: lein install

2014-07-08 Thread Sam Ritchie
No, that's the name of a namespace - zilch is the library, and it has an 
"mq" namespace, I believe.


My guess is that it's a multi-module project and you're running "lein 
install" from the root, instead of the appropriate submodule.



Plínio Balduino 
July 8, 2014 at 6:39 AM
I could guess that the problem is in the dot in the project name.

Could you try to change it to zilch-mq or zilchmq and test?

Plínio



--
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.
zhenxuanpan 
July 8, 2014 at 5:39 AM
when i run lein install

lein install
Compiling zilch.mq
Exception in thread "main" java.io.FileNotFoundException: Could not 
locate zilch/mq__init.class or zilch/mq.clj on classpath:

at clojure.lang.RT.load(RT.java:432)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$compile$fn__4895.invoke(core.clj:5426)
at clojure.core$compile.invoke(core.clj:5425)
at user$eval9.invoke(form-init581473078545854006.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.Compiler.loadFile(Compiler.java:6912)
at clojure.main$load_script.invoke(main.clj:283)
at clojure.main$init_opt.invoke(main.clj:288)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Compilation failed: Subprocess failed

--
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.


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
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: Local variable

2014-07-08 Thread Cecil Westerhof
2014-07-08 23:11 GMT+02:00 Bob Hutchison :

>
> On Jul 8, 2014, at 9:40 AM, Cecil Westerhof 
> wrote:
>
> > In Clojure you can define a local constant with let, but I need a
> variable (I think).
> >
> > I want to do the following. I have a function that checks several
> things. Every time an error is found I want to set the variable errors to:
> > (concat errors new-error)
> >
> > Is this possible? Or is there a better way to do this?
>
> Here's a different take on your question, and a few comments about how I'd
> write that code. I don't think you need the atom -- kinda ugly and the
> reduce/map/filter family of sequence functions will take you a long way.
>
> ; This is not a predicate, so don't use the -p suffix (and in Clojure it's
> a ? normally)
>

​As I understood it (I am rewriting land of lisp to Clojure) that when a
function returns a true/false state, that you then use the -p suffix. When
returning () there are no errors. But I should use the ? then?

​


> ; There's no reason not to pass those two objects into this function, so I
> do.
>

​Good idea. Makes it easy to test the function also.

[…]​



> I hope you can make sense of that :-)
>

​Not immediately. I need to digest it.

By the way. The current function is only the start of the checks.​

​After the if I need to do several other checks also. So I think I do need
the atom. But maybe I am mistaken. ;-)

-- 
Cecil Westerhof

-- 
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.


Land of lisp to Clojure

2014-07-08 Thread Cecil Westerhof
I received the book land of lisp as a gift. I am trying to translate it to
Clojure. In chapter 5 there is a text game engine. In the attachment my
translation. What do you think of it?

There are a few problems.
- The book displays all the lines of a look on separate lines. In my case
it is just one long line. Am I doing something wrong?

- In Emacs Lisp you can use a function A in the definition of another
function B before you declared function A. Is it correct that this is not
possible in Clojure?

- Al variables in land of lisp begin and end with an asterisk. As I
understood it, you only do this for variables that can be changed. So I
renamed some variables. Did I understand this correctly, or is the usage of
asterisks for something else?

-- 
Cecil Westerhof

-- 
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.


land-of-lisp-text-game.clj
Description: Binary data


Re: Land of lisp to Clojure

2014-07-08 Thread Bruce Wang
Hi Cecil,

You might want to check out this
https://github.com/quux00/land-of-lisp-in-clojure

Cheers,
Bruce


On Wed, Jul 9, 2014 at 9:49 AM, Cecil Westerhof 
wrote:

> I received the book land of lisp as a gift. I am trying to translate it to
> Clojure. In chapter 5 there is a text game engine. In the attachment my
> translation. What do you think of it?
>
> There are a few problems.
> - The book displays all the lines of a look on separate lines. In my case
> it is just one long line. Am I doing something wrong?
>
> - In Emacs Lisp you can use a function A in the definition of another
> function B before you declared function A. Is it correct that this is not
> possible in Clojure?
>
> - Al variables in land of lisp begin and end with an asterisk. As I
> understood it, you only do this for variables that can be changed. So I
> renamed some variables. Did I understand this correctly, or is the usage of
> asterisks for something else?
>
> --
> Cecil Westerhof
>
> --
> 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.
>



-- 
simple is good
http://brucewang.net
http://twitter.com/number5

-- 
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: Local variable

2014-07-08 Thread Bob Hutchison

On Jul 8, 2014, at 7:08 PM, Cecil Westerhof  wrote:

> 2014-07-08 23:11 GMT+02:00 Bob Hutchison :
> 
> On Jul 8, 2014, at 9:40 AM, Cecil Westerhof  wrote:
> 
> > In Clojure you can define a local constant with let, but I need a variable 
> > (I think).
> >
> > I want to do the following. I have a function that checks several things. 
> > Every time an error is found I want to set the variable errors to:
> > (concat errors new-error)
> >
> > Is this possible? Or is there a better way to do this?
> 
> Here's a different take on your question, and a few comments about how I'd 
> write that code. I don't think you need the atom -- kinda ugly and the 
> reduce/map/filter family of sequence functions will take you a long way.
> 
> ; This is not a predicate, so don't use the -p suffix (and in Clojure it's a 
> ? normally)
> 
> ​As I understood it (I am rewriting land of lisp to Clojure) that when a 
> function returns a true/false state, that you then use the -p suffix. When 
> returning () there are no errors. But I should use the ? then?

You’re returning a list of errors. You can interpret that as a truthy/falsy 
kind of thing, in which case make sure you’re returning a nil for the no-error 
case. And use the ‘?’ in Clojure.

> 
> ​ 
> ; There's no reason not to pass those two objects into this function, so I do.
> 
> ​Good idea. Makes it easy to test the function also.

it does

> 
> […]​ 
>  
> I hope you can make sense of that :-)
> 
> ​Not immediately. I need to digest it.

Have fun.

> 
> By the way. The current function is only the start of the checks.​  ​After 
> the if I need to do several other checks also. So I think I do need the atom. 
> But maybe I am mistaken. ;-)

I thought maybe your checks would be a little more than that. That’s why I left 
the ‘reduce’ version in there. Just make the function that is applied by reduce 
more powerful, perhaps pull it out into a separate function rather than an 
inline anonymous function. This will work as long as all tests are performed on 
one object at a time.

No matter what, I’d recommend not going using an atom if you can help it.

Cheers,
Bob

> 
> -- 
> Cecil Westerhof
> 
> -- 
> 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: map output to string

2014-07-08 Thread Glen Rubin


I am still having difficulties with this, so let me clarify by showing some 
sample code.


My fn looks like this:

(defn report [text]

(str
 "string1"
 "string2"
(apply str (map-indexed (fn [idx itm] (time-text idx itm)) (filtered-list 
text))

 

When I invoke spit in order to output a text file using the above funtion, 
I only get the first item in my list (filtered-list text) outputted

Here is the basic code for my fns used above:


(defn filtered-list [text]
(let
[street (:str (address text))
 city (:city (address text))
 state (:state (address text))

;actually there's a bunch of other bindings, 3 will suffice for the example

]

  (remove nil?
  (conj '()   

(if-not
(blank? street)
  (str "ADDRESS: " street))
(if-not
(blank? city)
  (str "CITY: " city))
(if-not
(blank? state)
  (str "STATE: " state))


(defn time-text [time-idx text-var]
 (str some-string (hour-min time-idx) another-string)) 

;this uses the clojure time library
(defn hour-min [idx]
(format-local-time (plus (local-now) (minutes idx)) :hour-minute-second))
On Tuesday, July 8, 2014 2:28:52 AM UTC-7, Lee wrote:

>
> Sometimes you have to manually stamp out laziness, for this among other 
> reasons. 
>
> In some cases I apply the list function to do this: 
>
> => (str (map inc (range 10))) 
> "clojure.lang.LazySeq@c5d38b66" 
>
> => (str (apply list (map inc (range 10 
> "(1 2 3 4 5 6 7 8 9 10)" 
>
>  -Lee 
>
>
> > On 8 July 2014 09:49, Glen Rubin > 
> wrote: 
> > my-fn takes a number and a string as argument and outputs a string.  I 
> am using map-indexed and my-fn to comprehend a list of items with numbered 
> index as follows, 
> >   
> >   
> > (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap)) 
> >   
> > When i run this on the repl everything works well and I get a single 
> long string of output. But, I am trying to use the output of this function 
> in a report and it is not working in that context. 
> >   
> > The code to generate report looks something like this: 
> >   
> >  (str 
> >   string1 
> >   string2 
> >   string3 
> > (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)) 
> >   string4etc... 
> > ) 
> >   
> > The code above will just print out 'clojure-lazy-seq' instead of the 
> string output.  If I try: 
> >   
> > (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap))) 
> >   
> > Then I get the last item from my list properly formated in the report, 
> but that's all.  How do I print out everything?  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: Land of lisp to Clojure

2014-07-08 Thread Timothy Baldridge
A few notes:

Prefer vectors over quoted lists '(1 2) vs [1 2]. There's rarely a case
(outside of macros) that you want the former.

Instead of quoted lists of symbols: '(You cannot get that.) try strings
"You cannot get that"

Don't use defs inside defs. Instead move the defs to a global position and
then use binding or set-var-root! to set them. Better yet, use atoms to
hold their contents, even better yet, pass the game state into each
function and have each function return a new game state.

Instead of:

(defn walk [direction]
  ...
  (def ^:dynamic *location* (first edge))

Use atoms like this:

(def location (atom nil))

(defn walk [direction]
  ...
  (reset! location (first edge))


Once you replace symbol lists with strings, you can easily do this instead
of syntax quoting:

(str "There is a " (nth edge 2) " going " (nth edge 1) "from here")



That's all I have for now.

Timothy



On Tue, Jul 8, 2014 at 6:24 PM, Bruce Wang  wrote:

> Hi Cecil,
>
> You might want to check out this
> https://github.com/quux00/land-of-lisp-in-clojure
>
> Cheers,
> Bruce
>
>
> On Wed, Jul 9, 2014 at 9:49 AM, Cecil Westerhof 
> wrote:
>
>> I received the book land of lisp as a gift. I am trying to translate it
>> to Clojure. In chapter 5 there is a text game engine. In the attachment my
>> translation. What do you think of it?
>>
>> There are a few problems.
>> - The book displays all the lines of a look on separate lines. In my case
>> it is just one long line. Am I doing something wrong?
>>
>> - In Emacs Lisp you can use a function A in the definition of another
>> function B before you declared function A. Is it correct that this is not
>> possible in Clojure?
>>
>> - Al variables in land of lisp begin and end with an asterisk. As I
>> understood it, you only do this for variables that can be changed. So I
>> renamed some variables. Did I understand this correctly, or is the usage of
>> asterisks for something else?
>>
>> --
>> Cecil Westerhof
>>
>> --
>> 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.
>>
>
>
>
> --
> simple is good
> http://brucewang.net
> http://twitter.com/number5
>
> --
> 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: map output to string

2014-07-08 Thread Lee Spector

Hi Glen,

You haven't really provided what we would need to replicate your problem.

Specifically:

- You call but don't provide definitions for address or is-blank?

- You refer to unbound symbols some-string and another-string.

- You don't provide an input for report, or the top-level call you are making, 
that produces the problem.

In addition, your report function has an extra ")" at the end.

I tried patching up everything in a minimal way but then I don't see a problem.

 -Lee

On Jul 8, 2014, at 10:38 PM, Glen Rubin  wrote:

> I am still having difficulties with this, so let me clarify by showing some 
> sample code.
> 
> 
> My fn looks like this:
> 
> (defn report [text]
> 
> (str
>  "string1"
>  "string2"
> (apply str (map-indexed (fn [idx itm] (time-text idx itm)) (filtered-list 
> text))
> 
>  
> When I invoke spit in order to output a text file using the above funtion, I 
> only get the first item in my list (filtered-list text) outputted
> 
> Here is the basic code for my fns used above:
> 
> 
> (defn filtered-list [text]
> (let
> [street (:str (address text))
>  city (:city (address text))
>  state (:state (address text))
> 
> ;actually there's a bunch of other bindings, 3 will suffice for the example
> 
> ]
> 
>   (remove nil?
>   (conj '()   
> 
> (if-not
> (blank? street)
>   (str "ADDRESS: " street))
> (if-not
> (blank? city)
>   (str "CITY: " city))
> (if-not
> (blank? state)
>   (str "STATE: " state))
> 
> 
> (defn time-text [time-idx text-var]
>  (str some-string (hour-min time-idx) another-string))
> 
> ;this uses the clojure time library
> (defn hour-min [idx]
> (format-local-time (plus (local-now) (minutes idx)) :hour-minute-second))
> On Tuesday, July 8, 2014 2:28:52 AM UTC-7, Lee wrote:
> 
> 
> Sometimes you have to manually stamp out laziness, for this among other 
> reasons. 
> 
> In some cases I apply the list function to do this: 
> 
> => (str (map inc (range 10))) 
> "clojure.lang.LazySeq@c5d38b66" 
> 
> => (str (apply list (map inc (range 10 
> "(1 2 3 4 5 6 7 8 9 10)" 
> 
>  -Lee 
> 
> 
> > On 8 July 2014 09:49, Glen Rubin  wrote: 
> > my-fn takes a number and a string as argument and outputs a string.  I am 
> > using map-indexed and my-fn to comprehend a list of items with numbered 
> > index as follows, 
> >   
> >   
> > (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap)) 
> >   
> > When i run this on the repl everything works well and I get a single long 
> > string of output. But, I am trying to use the output of this function in a 
> > report and it is not working in that context. 
> >   
> > The code to generate report looks something like this: 
> >   
> >  (str 
> >   string1 
> >   string2 
> >   string3 
> > (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)) 
> >   string4etc... 
> > ) 
> >   
> > The code above will just print out 'clojure-lazy-seq' instead of the string 
> > output.  If I try: 
> >   
> > (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap))) 
> >   
> > Then I get the last item from my list properly formated in the report, but 
> > that's all.  How do I print out everything?  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.

--
Lee Spector, Professor of Computer Science
Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

-- 
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.goo

Re: Land of lisp to Clojure

2014-07-08 Thread John Mastro
Hi Cecil,

Cecil Westerhof  wrote:
> - The book displays all the lines of a look on separate lines. In my
> case it is just one long line. Am I doing something wrong?

No, you're not doing anything wrong. There's nothing in that data
structure which would inherently cause it to print on multiple lines.

If you're using Cider, you can enable automatic pretty-printing in the
REPL, which would likely cause it to print on multiple lines. I think
it's M-x cider-repl-toggle-pretty-printing.

Or you could use a definition of look more like this, which uses println
to print each item on its own line (not sure if you wanted to retain the
parens or not, but both are easily doable).

(defn look []
  (doseq [d [(describe-location *location* nodes)
 (describe-paths *location* edges)
 (describe-objects *location* objects *object-locations*)]]
(println d)))

> - In Emacs Lisp you can use a function A in the definition of another
> function B before you declared function A. Is it correct that this is
> not possible in Clojure?

Correct, though you can declare it without defining it, e.g.
(declare function-a).

> - Al variables in land of lisp begin and end with an asterisk. As I
> understood it, you only do this for variables that can be changed. So
> I renamed some variables. Did I understand this correctly, or is the
> usage of asterisks for something else?

The "earmuffs" convention is related to dynamic variables. All global
variables are dynamic in Common Lisp, but that's not the case in
Clojure. You're creating dynamic variables (by using :dynamic metadata
in your defs) but I didn't notice anywhere where you're using this
feature (i.e. no binding or set! forms). Long story short, I would use
earmuffs if the variables are dynamic but not otherwise.

Speaking of global variables, I'd recommend only using def at top level
(it creates global vars regardless of where you use it). Perhaps it
would work to initialize them at top level with a "null value", like
(def something (atom nil)), and then set it later if/when appropriate,
like (reset! something (first whatever)). As a plus, if you use
atoms like this you most likely won't need dynamic variables, even if
you need to start changing global variable values later on.

Hope that helps,

John

-- 
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: IllegalArgumentException when running core.async example

2014-07-08 Thread endbegin

>
> Just tried it with Clojure 1.6.0. Still no luck!
>

-- 
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: map output to string

2014-07-08 Thread Glen Rubin
Thanks Lee.  You are correct there is something wrong with my input to this 
function that is causing the problem, not the function.  Sorry for the 
error.

On Tuesday, July 8, 2014 8:13:36 PM UTC-7, Lee wrote:
>
>
> Hi Glen, 
>
> You haven't really provided what we would need to replicate your problem. 
>
> Specifically: 
>
> - You call but don't provide definitions for address or is-blank? 
>
> - You refer to unbound symbols some-string and another-string. 
>
> - You don't provide an input for report, or the top-level call you are 
> making, that produces the problem. 
>
> In addition, your report function has an extra ")" at the end. 
>
> I tried patching up everything in a minimal way but then I don't see a 
> problem. 
>
>  -Lee 
>
> On Jul 8, 2014, at 10:38 PM, Glen Rubin > 
> wrote: 
>
> > I am still having difficulties with this, so let me clarify by showing 
> some sample code. 
> > 
> > 
> > My fn looks like this: 
> > 
> > (defn report [text] 
> > 
> > (str 
> >  "string1" 
> >  "string2" 
> > (apply str (map-indexed (fn [idx itm] (time-text idx itm)) 
> (filtered-list text)) 
> > 
> >   
> > When I invoke spit in order to output a text file using the above 
> funtion, I only get the first item in my list (filtered-list text) 
> outputted 
> > 
> > Here is the basic code for my fns used above: 
> > 
> > 
> > (defn filtered-list [text] 
> > (let 
> > [street (:str (address text)) 
> >  city (:city (address text)) 
> >  state (:state (address text)) 
> > 
> > ;actually there's a bunch of other bindings, 3 will suffice for the 
> example 
> > 
> > ] 
> > 
> >   (remove nil? 
> >   (conj '()   
> > 
> > (if-not 
> > (blank? street) 
> >   (str "ADDRESS: " street)) 
> > (if-not 
> > (blank? city) 
> >   (str "CITY: " city)) 
> > (if-not 
> > (blank? state) 
> >   (str "STATE: " state)) 
> > 
> > 
> > (defn time-text [time-idx text-var] 
> >  (str some-string (hour-min time-idx) another-string)) 
> > 
> > ;this uses the clojure time library 
> > (defn hour-min [idx] 
> > (format-local-time (plus (local-now) (minutes idx)) 
> :hour-minute-second)) 
> > On Tuesday, July 8, 2014 2:28:52 AM UTC-7, Lee wrote: 
> > 
> > 
> > Sometimes you have to manually stamp out laziness, for this among other 
> reasons. 
> > 
> > In some cases I apply the list function to do this: 
> > 
> > => (str (map inc (range 10))) 
> > "clojure.lang.LazySeq@c5d38b66" 
> > 
> > => (str (apply list (map inc (range 10 
> > "(1 2 3 4 5 6 7 8 9 10)" 
> > 
> >  -Lee 
> > 
> > 
> > > On 8 July 2014 09:49, Glen Rubin  wrote: 
> > > my-fn takes a number and a string as argument and outputs a string.  I 
> am using map-indexed and my-fn to comprehend a list of items with numbered 
> index as follows, 
> > >   
> > >   
> > > (map-indexed (fn [idx itm]  (my-fn idx itm)) '(list-of-crap)) 
> > >   
> > > When i run this on the repl everything works well and I get a single 
> long string of output. But, I am trying to use the output of this function 
> in a report and it is not working in that context. 
> > >   
> > > The code to generate report looks something like this: 
> > >   
> > >  (str 
> > >   string1 
> > >   string2 
> > >   string3 
> > > (map-indexed (fn [idx itm] (my-fn idx itm)) '(listofcrap)) 
> > >   string4etc... 
> > > ) 
> > >   
> > > The code above will just print out 'clojure-lazy-seq' instead of the 
> string output.  If I try: 
> > >   
> > > (apply str  (map-indexed (fn [idx itm] (my-fn idx itm)) 
> '(listofcrap))) 
> > >   
> > > Then I get the last item from my list properly formated in the report, 
> but that's all.  How do I print out everything?  Thanks 
> > > 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>
> -- 
> Lee Spector, Professor of Computer Science 
> Cognitive Science, Hampshire College 
> 893 West Street, Amherst, MA 01002-3359 
> lspe...@hampshire.edu , http://hampshire.edu/lspector/ 
> Phone: 413-559-5352, Fax: 413-559-5438 
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googleg

Re: Why clojure does not have pure lazy-evaluation like Haskell ?

2014-07-08 Thread Magnus Therning
On Tue, Jul 08, 2014 at 08:39:30PM +0200, Colin Fleming wrote:
> I searched for this as well, and found this:
> http://www.cs.nott.ac.uk/~gmh/appsem-slides/peytonjones.ppt
> 
> "Purity is more important than, and quite independent of, laziness"
> 
> and
> 
> "The next ML will be pure, with effects only via monads.  The next Haskell
> will be strict, but still pure."

In the same presentation he also says that laziness has forced Haskell
to stay pure, and that

"Every call-by-value language has given into the siren call of side
effects."

So even if they are independent on the technical level one could say
that they are dependent on a design/social level.

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

Most software today is very much like an Egyptian pyramid with
millions of bricks piled on top of each other, with no structural
integrity, but just done by brute force and thousands of slaves.
 -- Alan Kay


pgpya0QpHNyf9.pgp
Description: PGP signature


Re: IllegalArgumentException when running core.async example

2014-07-08 Thread Tobias Kortkamp
In judge try changing

  (let [out async/chan] ...)

to

  (let [out (async/chan)] ...)



On Wednesday, July 9, 2014 5:57:53 AM UTC+2, endbegin wrote:
>
> Just tried it with Clojure 1.6.0. Still no luck!
>>
>

-- 
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.