Re: tool.namespace reload not working

2017-04-03 Thread Joachim De Beule
Hi JPatrick. I'm having the same sort of problems. Quite annoying! Did you 
manage to fix this in the end?

Hello,
>>> I'm trying to implement the Component ideology. When run something 
>>> manually with component/start-system and stop, it works fine. The main 
>>> method calls component/start-system works fine too. But sadly when I try to 
>>> get the user reflow to work (I copied user namespace from the README on 
>>> GitHub), my main namespace is not reloading.
>>>
>>> :reloading (deusdatsolutions.views deusdatsolutions.dynamics 
>>> deusdatsolutions.handler deusdatsolutions.system.route 
>>> deusdatsolutions.data 
>>> deusdatsolutions.data-impl deusdatsolutions.system.database 
>>> deusdatsolutions.system.common deusdatsolutions.system.server 
>>> deusdatsolutions.system.core deusdatsolutions.user deusdatsolutions.
>>> handler-test deusdatsolutions.dynamics-test deusdatsolutions.data-impl-test 
>>> deusdatsolutions.core user)
>>> :error-while-loading deusdatsolutions.user
>>> #>> 'deusdatsolutions.system.core' not found, 
>>> compiling:(deusdatsolutions/user.clj:1:1)>
>>>
>>> deusdatsolutions.system.core is there. It's in the user namespace that 
>>> starts everything off.
>>> (ns deusdatsolutions.user
>>>   (:require [com.stuartsierra.component :as component]
>>> [clojure.tools.namespace.repl :refer [refresh]]
>>> [deusdatsolutions.system.core :as site-core]))
>>>
>>> (def system nil)
>>>
>>> (defn init []
>>>   (alter-var-root #'system
>>> (constantly (site-core/create-system
>>>
>>> (defn start []
>>>   (alter-var-root #'system site-core/start-server))
>>>
>>> (defn stop []
>>>   (alter-var-root #'system
>>> (fn [s] (when s (site-core/stop-server s)
>>>
>>> (defn go []
>>>   (init)
>>>   (start))
>>>
>>> (defn reset []
>>>   (stop)
>>>   (refresh :after 'deusdatsolutions.user/go))
>>>
>>> This loads fine, runs the go fine, runs the stop fine too. (reset) gets 
>>> that error.
>>>
>>> One thing that might be causing a problem is that I'm using a 
>>> profiles.clj for dev. Something looks off in lein because I have to include 
>>> the tools dependency in dev profile.
>>>
>>> Thanks,
>>> JPD
>>>
>>

-- 
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 it normal for exercise-fn to return examples that don't conform?

2017-04-03 Thread Didier
Do you know why they are not unique? Was that on purpose or an accidental 
behaviour of the implementation?

-- 
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 it normal for exercise-fn to return examples that don't conform?

2017-04-03 Thread Jason Felice
That's a complicated question, but the simplified answer is:

test.check (which clojure.spec uses) generates random test cases.  This is
advantageous when the state space is very large, where tracking previous
examples is hard and gives very little advantage.  When the state space is
small, there will be a lot of repeats.

(There is also a feature where it starts "small" and grows.  This means
that repeated examples are more likely at first.)

I would definitely recommend unit testing if the state space is small
enough to enumerate and fit in your head.

-Jason

On Mon, Apr 3, 2017 at 5:31 AM, Didier  wrote:

> Do you know why they are not unique? Was that on purpose or an accidental
> behaviour of the implementation?
>
> --
> 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: How do I just use AOT compiled class files over clj(c) source with a leiningen uberjar?

2017-04-03 Thread Alex Miller
core_instant18.clj is conditionally loaded if you are using >= Java 1.8 to 
extend the Inst protocol to java.time.Instant (which didn't exist in prior 
JDKs). This is set up at:

https://github.com/clojure/clojure/blob/7aad2f7dbb3a66019e5cef3726d52d721e9c60df/src/clj/clojure/core.clj#L6661-L6665

There is some similar conditional loading for clojure.core.reducers 
(dealing with whether using JDK 1.6 with jsr-166 jar or JDK 1.7+) in:

https://github.com/clojure/clojure/blob/f572a60262852af68cdb561784a517143a5847cf/src/clj/clojure/core/reducers.clj#L24

Those are the two things like that that I know of in Clojure. There are a 
handful of other namespaces that are not AOT compiled - clojure.parallel 
(deprecated, also has forkjoin dependencies), clojure.instant, and 
clojure.uuid. I think the last two may just be an oversight.


On Saturday, April 1, 2017 at 1:49:22 PM UTC-5, lvh ‌ wrote:
>
> Hi,
>
>
> Context: I'm using Proguard to try to minimize an uberjar produced with 
> lein uberjar. This is failing, because when I run the resulting jar with 
> java -jar minimized.jar, I get errors about missing classes while trying to 
> load/compile .clj files.  proguard is renaming classes and removing unused 
> ones. In this case, the class is still in the jar, but under another name. 
> As long as the _class_ files are loaded, this should be fine (it's 
> proguard's job to rename all references). But proguard doesn't know about 
> Clojure, so the Clojure files don't get the same treatment. I understand 
> that Clojure generally imports source files as resources, but I was hoping 
> with an :aot :all uberjar, that wouldn't be the (primary) case. Removing 
> clj[csx]? files from the jar (via :uberjar-exclusions) (which I was hoping 
> would force it to try the class files), breaks:
>
> Caused by: java.io.FileNotFoundException: Could not locate 
> clojure/core_instant18__init.class or clojure/core_instant18.clj on 
> classpath. Please check that namespaces with dashes use underscores in the 
> Clojure file name.
>
> This appears to be due to this source file: 
> https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_instant18.clj
>  
> ; and the lack of matching class file can be explained because it is in the 
> clojure.core namespace.
>
> Do I misunderstand how :aot :all works? Are clj files always going to 
> exist in the resulting uberjar if I want Clojure to work?
>  
>
> lvh
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I just use AOT compiled class files over clj(c) source with a leiningen uberjar?

2017-04-03 Thread Alex Miller

On Saturday, April 1, 2017 at 2:24:30 PM UTC-5, Daniel Compton wrote:
>
> Zach Tellman talked 
>  about 
> making Clojure work better with Proguard in August 2016. I couldn’t find 
> any open JIRA tickets about this though.
>

Zach and I actually talked about this again at Clojure/west this week and I 
think he's going to do some work on it. I can't really comment as I don't 
know what is being requested.


-- 
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: I can not find any function that might give rise tothisStackOverflow error

2017-04-03 Thread piastkrakow
I apologize for my ignorance, but why is this lazy?
 
 (conj vector-of-maps-of-vector-key-and-score 
(find-related-positive-negative-true-false-records scores (first scores

Assuming the functions are not called eagerly simply because I am in a 
loop. But what would the eager version of this be? I 


On Sunday, April 2, 2017 at 1:42:20 AM UTC-4, Sean Corfield wrote:
>
> > But does that mean one can't use functions to build up sequences in a 
> loop? That seems to limit loops a great deal. 
>
> You just need to ensure you are building the sequences in an eager manner, 
> rather than a lazy manner.
>
>  
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>  
>
> *From: *piast...@gmail.com 
> *Sent: *Saturday, April 1, 2017 9:56 PM
> *To: *Clojure 
> *Subject: *Re: I can not find any function that might give rise 
> tothisStackOverflow error
>
>  
>
>
> > Because when you recur in your loop, you’re passing in lazy sequences, 
> so those 
> > are essentially building up a giant stack of delayed evaluations – and 
> when you hit bottom 
> > and try to realize those, that’s when your stack overflow hits you.
>
> I was thinking the answer had something to do with the lazyness, but I 
> wasn't sure because the app seemed to die before the loop finished -- which 
> I assume is before the functions were realized. But it is possible the 
> logging functions were slow and didn't show the whole truth. I am grateful 
> to have someone with your experience clarify this. 
>
> But does that mean one can't use functions to build up sequences in a 
> loop? That seems to limit loops a great deal. 
>
>
>
> On Saturday, April 1, 2017 at 10:22:04 PM UTC-4, Sean Corfield wrote:
>
> Because when you recur in your loop, you’re passing in lazy sequences, so 
> those are essentially building up a giant stack of delayed evaluations – 
> and when you hit bottom and try to realize those, that’s when your stack 
> overflow hits you.
>
>  
>
> By contrast, your reduce code is eager so the work is done as you work 
> through the sequence, instead of “stacked up” lazily, to be done later.
>
>  
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>  
>
> *From: *piast...@gmail.com
> *Sent: *Saturday, April 1, 2017 6:52 PM
> *To: *Clojure
> *Subject: *Re: I can not find any function that might give rise to 
> thisStackOverflow error
>
>  
>
>
> Crazy! I re-wrote the (loop) to use (reduce) instead and now everything 
> works: 
>
>
> (defn loop-over-scores
>   [set-of-scores]
>   "2017-03-08 -- called from start.clj"
>   (reduce
>;; 2017-04-01 -- we assume vector-with-path-score looks like this:
>;;  [[:positive :true 0.88 19 60 10 12 3 1 3 1 2 1] 1]
>;; so we do a minor bit of destructuring
>(fn [vector-of-maps-of-vector-key-and-score [vector-with-path score]]
>  (conj vector-of-maps-of-vector-key-and-score
>(dire/supervise #'map-of-vector-path-and-true-false-scores 
> vector-with-path)))
>[]
>set-of-scores))
>
>
> The StackOverflow error is gone. 
>
> Sad to say, I'm left with a feeling as if I know nothing about Clojure. I 
> don't know why (loop) gave me a StackOverflow error whereas (reduce) works 
> just fine. This is black magic to me, which, sad to say, is not a 
> comfortable feeling. 
>
>
>
>
>
>
> On Saturday, April 1, 2017 at 7:51:08 PM UTC-4, piast...@gmail.com wrote:
>
> Well, I am out of ideas. Let's assume I'll re-write this some other way. 
> What would be better than using (loop)? What would be less likely to cause 
> StackOverflow, or at least reveal why I'm seeing it. 
>
>
> On Saturday, April 1, 2017 at 6:23:29 PM UTC-4, piast...@gmail.com wrote:
>
>
> I have a function that will run repeatedly, so I use the at-at library to 
> call it:
>
> https://github.com/overtone/at-at
>
> I don't think this is the problem. 
>
> Sad to say, the Error is catching a StackOverflow, which I'm having 
> trouble finding. I don't see a place where I call a function recursively, 
> so I don't see where any of this becomes stackoverflow. 
>
> I'm using Dire to catch errors, but for now I'm just logging them. I don't 
> see anything fancy or clever that would give me a stackoverflow, and yet 
> this anonymous function called by at-at is definitely giving rise to 
> StackOverflow.
>
> (defn- calculate--scores []
>   (let [my-pool (at/mk-pool)]
> (at/every 18
>   (fn []
> (append-to-file "/var/log/example/-scores.log" "Will 
> attempt to write scores")
> (future 
>   (try 
> (let [
>   map-of-all-sums   
> (api/get-accuracy-and-precision)
>   set-of-all-scores (dire/supervise 
> #'api/path-entries map

Re: I can not find any function that might give rise tothisStackOverflow error

2017-04-03 Thread Sean Corfield
This is lazy:  (remove #{(first scores)} scores)

 

Since find-related-positive-negative-true-false-records does not realize 
set-of-scores in order to return its value, then you still have laziness on 
scores.

 

I think, in your original, if you wrap that remove call with doall, you won’t 
get a stack overflow.

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

On 4/3/17, 9:24 AM, "clojure@googlegroups.com on behalf of 
piastkra...@gmail.com"  wrote:

 

I apologize for my ignorance, but why is this lazy?

 

 (conj vector-of-maps-of-vector-key-and-score 
(find-related-positive-negative-true-false-records scores (first scores

 

Assuming the functions are not called eagerly simply because I am in a loop. 
But what would the eager version of this be? I 

 


On Sunday, April 2, 2017 at 1:42:20 AM UTC-4, Sean Corfield wrote:

> But does that mean one can't use functions to build up sequences in a loop? 
> That seems to limit loops a great deal. 

You just need to ensure you are building the sequences in an eager manner, 
rather than a lazy manner.

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

From: piast...@gmail.com
Sent: Saturday, April 1, 2017 9:56 PM
To: Clojure
Subject: Re: I can not find any function that might give rise 
tothisStackOverflow error

 


> Because when you recur in your loop, you’re passing in lazy sequences, so 
> those 
> are essentially building up a giant stack of delayed evaluations – and when 
> you hit bottom 
> and try to realize those, that’s when your stack overflow hits you.

I was thinking the answer had something to do with the lazyness, but I wasn't 
sure because the app seemed to die before the loop finished -- which I assume 
is before the functions were realized. But it is possible the logging functions 
were slow and didn't show the whole truth. I am grateful to have someone with 
your experience clarify this. 

But does that mean one can't use functions to build up sequences in a loop? 
That seems to limit loops a great deal. 



On Saturday, April 1, 2017 at 10:22:04 PM UTC-4, Sean Corfield wrote:

Because when you recur in your loop, you’re passing in lazy sequences, so those 
are essentially building up a giant stack of delayed evaluations – and when you 
hit bottom and try to realize those, that’s when your stack overflow hits you.

 

By contrast, your reduce code is eager so the work is done as you work through 
the sequence, instead of “stacked up” lazily, to be done later.

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

From: piast...@gmail.com
Sent: Saturday, April 1, 2017 6:52 PM
To: Clojure
Subject: Re: I can not find any function that might give rise to 
thisStackOverflow error

 


Crazy! I re-wrote the (loop) to use (reduce) instead and now everything works: 


(defn loop-over-scores
  [set-of-scores]
  "2017-03-08 -- called from start.clj"
  (reduce
   ;; 2017-04-01 -- we assume vector-with-path-score looks like this:
   ;;  [[:positive :true 0.88 19 60 10 12 3 1 3 1 2 1] 1]
   ;; so we do a minor bit of destructuring
   (fn [vector-of-maps-of-vector-key-and-score [vector-with-path score]]
 (conj vector-of-maps-of-vector-key-and-score
   (dire/supervise #'map-of-vector-path-and-true-false-scores 
vector-with-path)))
   []
   set-of-scores))


The StackOverflow error is gone. 

Sad to say, I'm left with a feeling as if I know nothing about Clojure. I don't 
know why (loop) gave me a StackOverflow error whereas (reduce) works just fine. 
This is black magic to me, which, sad to say, is not a comfortable feeling. 






On Saturday, April 1, 2017 at 7:51:08 PM UTC-4, piast...@gmail.com wrote:

Well, I am out of ideas. Let's assume I'll re-write this some other way. What 
would be better than using (loop)? What would be less likely to cause 
StackOverflow, or at least reveal why I'm seeing it. 


On Saturday, April 1, 2017 at 6:23:29 PM UTC-4, piast...@gmail.com wrote:


I have a function that will run repeatedly, so I use the at-at library to call 
it:

https://github.com/overtone/at-at

I don't think this is the problem. 

Sad to say, the Error is catching a StackOverflow, which I'm having trouble 
finding. I don't see a place where I call a function recursively, so I don't 
see where any of this becomes stackoverflow. 

I'm using Dire to catch errors, but for now I'm just logging them. I don't see 
anything fancy or clever that would give me a stackoverflow, and yet this 
anonymous function called by at-at is definitely giving rise to StackOverflow.

(defn- calculate--scores []
  (let [my-pool (at/mk-pool)]
(at/every 18
 

Re: How do I just use AOT compiled class files over clj(c) source with a leiningen uberjar?

2017-04-03 Thread lvh
Thanks, Alex! That helps a lot.

Is my understanding of how uberjars with aot complication work otherwise
correct? I.e. apart from the dynamically loaded

One thing I particularly care about is compile-time precomputation. My app
uses source JSON data (that I don't control) that's pretty big, but the
stuff it produces from that data is pretty small. In ClojureScript, I did
this by just using macros, since ClojureScript conveniently guarantees
those will be evaluated on the JVM and compile time. So, for example, when
I was using ClojureScript to write a GreaseMonkey script/WebExtension
(where there are good reasons to keep everything in a single file) and i
wanted to include e.g. some literal CSS in the source, I'd just use a macro.

Does a similar trick work with Clojure and AOT compilation + uberjar, or
should I use a resource as an intermediate? I'm fine with it loading e.g.
instant18.clj (although it'd certainly be neater if I didn't have to :)))

thanks in advance,
lvh


On Mon, Apr 3, 2017 at 9:24 AM, Alex Miller  wrote:

> core_instant18.clj is conditionally loaded if you are using >= Java 1.8 to
> extend the Inst protocol to java.time.Instant (which didn't exist in prior
> JDKs). This is set up at:
>
> https://github.com/clojure/clojure/blob/7aad2f7dbb3a66019e5c
> ef3726d52d721e9c60df/src/clj/clojure/core.clj#L6661-L6665
>
> There is some similar conditional loading for clojure.core.reducers
> (dealing with whether using JDK 1.6 with jsr-166 jar or JDK 1.7+) in:
>
> https://github.com/clojure/clojure/blob/f572a60262852af68cdb
> 561784a517143a5847cf/src/clj/clojure/core/reducers.clj#L24
>
> Those are the two things like that that I know of in Clojure. There are a
> handful of other namespaces that are not AOT compiled - clojure.parallel
> (deprecated, also has forkjoin dependencies), clojure.instant, and
> clojure.uuid. I think the last two may just be an oversight.
>
>
> On Saturday, April 1, 2017 at 1:49:22 PM UTC-5, lvh ‌ wrote:
>>
>> Hi,
>>
>>
>> Context: I'm using Proguard to try to minimize an uberjar produced with
>> lein uberjar. This is failing, because when I run the resulting jar with
>> java -jar minimized.jar, I get errors about missing classes while trying to
>> load/compile .clj files.  proguard is renaming classes and removing unused
>> ones. In this case, the class is still in the jar, but under another name.
>> As long as the _class_ files are loaded, this should be fine (it's
>> proguard's job to rename all references). But proguard doesn't know about
>> Clojure, so the Clojure files don't get the same treatment. I understand
>> that Clojure generally imports source files as resources, but I was hoping
>> with an :aot :all uberjar, that wouldn't be the (primary) case. Removing
>> clj[csx]? files from the jar (via :uberjar-exclusions) (which I was hoping
>> would force it to try the class files), breaks:
>>
>> Caused by: java.io.FileNotFoundException: Could not locate
>> clojure/core_instant18__init.class or clojure/core_instant18.clj on
>> classpath. Please check that namespaces with dashes use underscores in the
>> Clojure file name.
>>
>> This appears to be due to this source file: https://github.com/cloju
>> re/clojure/blob/master/src/clj/clojure/core_instant18.clj ; and the lack
>> of matching class file can be explained because it is in the clojure.core
>> namespace.
>>
>> Do I misunderstand how :aot :all works? Are clj files always going to
>> exist in the resulting uberjar if I want Clojure to work?
>>
>>
>> lvh
>>
> --
> 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: I can not find any function that might give rise tothisStackOverflow error

2017-04-03 Thread piastkrakow

Thank you again. This has been educational. 



On Monday, April 3, 2017 at 1:07:18 PM UTC-4, Sean Corfield wrote:
>
> This is lazy:  (remove #{(first scores)} scores)
>
>  
>
> Since find-related-positive-negative-true-false-records does not realize 
> set-of-scores in order to return its value, then you still have laziness on 
> scores.
>
>  
>
> I think, in your original, if you wrap that remove call with doall, you 
> won’t get a stack overflow.
>
>  
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>  
>
> On 4/3/17, 9:24 AM, "clo...@googlegroups.com  on behalf of 
> piast...@gmail.com "  
> on behalf of piast...@gmail.com > wrote:
>
>  
>
> I apologize for my ignorance, but why is this lazy?
>
>  
>
>  (conj vector-of-maps-of-vector-key-and-score 
> (find-related-positive-negative-true-false-records scores (first scores
>
>  
>
> Assuming the functions are not called eagerly simply because I am in a 
> loop. But what would the eager version of this be? I 
>
>  
>
>
> On Sunday, April 2, 2017 at 1:42:20 AM UTC-4, Sean Corfield wrote:
>
> > But does that mean one can't use functions to build up sequences in a 
> loop? That seems to limit loops a great deal. 
>
> You just need to ensure you are building the sequences in an eager manner, 
> rather than a lazy manner.
>
>  
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>  
>
> *From: *piast...@gmail.com
> *Sent: *Saturday, April 1, 2017 9:56 PM
> *To: *Clojure
> *Subject: *Re: I can not find any function that might give rise 
> tothisStackOverflow error
>
>  
>
>
> > Because when you recur in your loop, you’re passing in lazy sequences, 
> so those 
> > are essentially building up a giant stack of delayed evaluations – and 
> when you hit bottom 
> > and try to realize those, that’s when your stack overflow hits you.
>
> I was thinking the answer had something to do with the lazyness, but I 
> wasn't sure because the app seemed to die before the loop finished -- which 
> I assume is before the functions were realized. But it is possible the 
> logging functions were slow and didn't show the whole truth. I am grateful 
> to have someone with your experience clarify this. 
>
> But does that mean one can't use functions to build up sequences in a 
> loop? That seems to limit loops a great deal. 
>
>
>
> On Saturday, April 1, 2017 at 10:22:04 PM UTC-4, Sean Corfield wrote:
>
> Because when you recur in your loop, you’re passing in lazy sequences, so 
> those are essentially building up a giant stack of delayed evaluations – 
> and when you hit bottom and try to realize those, that’s when your stack 
> overflow hits you.
>
>  
>
> By contrast, your reduce code is eager so the work is done as you work 
> through the sequence, instead of “stacked up” lazily, to be done later.
>
>  
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>  
>
> *From: *piast...@gmail.com
> *Sent: *Saturday, April 1, 2017 6:52 PM
> *To: *Clojure
> *Subject: *Re: I can not find any function that might give rise to 
> thisStackOverflow error
>
>  
>
>
> Crazy! I re-wrote the (loop) to use (reduce) instead and now everything 
> works: 
>
>
> (defn loop-over-scores
>   [set-of-scores]
>   "2017-03-08 -- called from start.clj"
>   (reduce
>;; 2017-04-01 -- we assume vector-with-path-score looks like this:
>;;  [[:positive :true 0.88 19 60 10 12 3 1 3 1 2 1] 1]
>;; so we do a minor bit of destructuring
>(fn [vector-of-maps-of-vector-key-and-score [vector-with-path score]]
>  (conj vector-of-maps-of-vector-key-and-score
>(dire/supervise #'map-of-vector-path-and-true-false-scores 
> vector-with-path)))
>[]
>set-of-scores))
>
>
> The StackOverflow error is gone. 
>
> Sad to say, I'm left with a feeling as if I know nothing about Clojure. I 
> don't know why (loop) gave me a StackOverflow error whereas (reduce) works 
> just fine. This is black magic to me, which, sad to say, is not a 
> comfortable feeling. 
>
>
>
>
>
>
> On Saturday, April 1, 2017 at 7:51:08 PM UTC-4, piast...@gmail.com wrote:
>
> Well, I am out of ideas. Let's assume I'll re-write this some other way. 
> What would be better than using (loop)? What would be less likely to cause 
> StackOverflow, or at least reveal why I'm seeing it. 
>
>
> On Saturday, April 1, 2017 at 6:23:29 PM UTC-4, piast...@gmail.com wrote:
>
>
> I have a function that will run repeatedly, so I use the at-at library to 
> call it:
>
> https://github.com/overtone/at-at
>
> I don't think this is the problem. 
>
> Sad to say, the Error is catching a StackOverflow, which I'm having 
> trouble finding. 

spec docs

2017-04-03 Thread Gregg Reynolds
i think the spec docs could be improved; my question is whether suggestions
should go into jira.  one can always write a blog post, and one does not
want to pollute jira.  case in point: validating maps, in particular taking
some action if a map contains an unrecognized key. it might be fine to do
nothing, but in many cases you want to at least emit a warning.  minimum
case: user just misspells an optional key, and then wonders why it doesn't
work.

there are various ways to do this, i expect. i just discovered that you can
use s/and with s/keys plus a (fn [x] .. ) predicate - but if you do not
include the s/keys bit, the checker will not recur. seems to me that this
kind of thing merits at least a mention in the official docs.

-gregg

-- 
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: Cognitect acquired by Microsoft

2017-04-03 Thread Matthew Boston
Not believable at all.

Everyone knows Cognitect will be acquired by Oracle 😉

On Saturday, April 1, 2017 at 2:00:16 PM UTC-6, Gregg Reynolds wrote:
>
> made ya look!
>

-- 
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: spec docs

2017-04-03 Thread Sean Corfield
For clojure.org, the source is on GitHub, and you can submit a Pull Request (as 
long as you have a CA on file I believe?). The clojure.spec Guide page is:

 

    
https://github.com/clojure/clojure-site/blob/master/content/guides/spec.adoc

 

You could draft a PR for an enhancement to the Entity Maps section…

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

On 4/3/17, 2:36 PM, "Gregg Reynolds"  wrote:

 

i think the spec docs could be improved; my question is whether suggestions 
should go into jira.  one can always write a blog post, and one does not want 
to pollute jira.  case in point: validating maps, in particular taking some 
action if a map contains an unrecognized key. it might be fine to do nothing, 
but in many cases you want to at least emit a warning.  minimum case: user just 
misspells an optional key, and then wonders why it doesn't work.

 

there are various ways to do this, i expect. i just discovered that you can use 
s/and with s/keys plus a (fn [x] .. ) predicate - but if you do not include the 
s/keys bit, the checker will not recur. seems to me that this kind of thing 
merits at least a mention in the official docs.

 

-gregg

-- 
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: Cognitect acquired by Microsoft

2017-04-03 Thread Gregg Reynolds
On Mon, Apr 3, 2017 at 5:19 PM, Matthew Boston 
wrote:

> Not believable at all.
>
> Everyone knows Cognitect will be acquired by Oracle 😉
>

Haha.  Or maybe Cognitect will acquire Microsoft.  Stranger things have
happened, heh.


>
> On Saturday, April 1, 2017 at 2:00:16 PM UTC-6, Gregg Reynolds wrote:
>>
>> made ya look!
>>
> --
> 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: spec docs

2017-04-03 Thread Gregg Reynolds
On Mon, Apr 3, 2017 at 5:38 PM, Sean Corfield  wrote:

> For clojure.org, the source is on GitHub, and you can submit a Pull
> Request (as long as you have a CA on file I believe?). The clojure.spec
> Guide page is:
>
>
>
> https://github.com/clojure/clojure-site/blob/master/
> content/guides/spec.adoc
>
>
>
> You could draft a PR for an enhancement to the Entity Maps section…
>
>
> Thanks, didn't know about that.

-- 
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: spec docs

2017-04-03 Thread Gregg Reynolds
On Mon, Apr 3, 2017 at 6:20 PM, Gregg Reynolds  wrote:

>
>
> On Mon, Apr 3, 2017 at 5:38 PM, Sean Corfield  wrote:
>
>> For clojure.org, the source is on GitHub, and you can submit a Pull
>> Request (as long as you have a CA on file I believe?). The clojure.spec
>> Guide page is:
>>
>>
>>
>> https://github.com/clojure/clo
>> jure-site/blob/master/content/guides/spec.adoc
>>
>>
>>
>> You could draft a PR for an enhancement to the Entity Maps section…
>>
>>
>> Thanks, didn't know about that.
>

So it would be better to just sub a PR for the docs than to make a Jira
ticket, I reckon. ?

-- 
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: spec docs

2017-04-03 Thread Alex Miller
Either an issue or a PR on the clojure-site repo is best for the site.

On Monday, April 3, 2017 at 6:21:57 PM UTC-5, Gregg Reynolds wrote:
>
>
>
> On Mon, Apr 3, 2017 at 6:20 PM, Gregg Reynolds  wrote:
>
>>
>>
>> On Mon, Apr 3, 2017 at 5:38 PM, Sean Corfield  wrote:
>>
>>> For clojure.org, the source is on GitHub, and you can submit a Pull 
>>> Request (as long as you have a CA on file I believe?). The clojure.spec 
>>> Guide page is:
>>>
>>>  
>>>
>>> 
>>> https://github.com/clojure/clojure-site/blob/master/content/guides/spec.adoc
>>>
>>>  
>>>
>>> You could draft a PR for an enhancement to the Entity Maps section…
>>>
>>>
>>> Thanks, didn't know about that. 
>>
>
> So it would be better to just sub a PR for the docs than to make a Jira 
> ticket, I reckon. ? 
>
>

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