Rich Hickey Calls for Book List, Creates Nice Resource as a Side Effect

2018-11-02 Thread Nathan Smutz
Rich requested that people report in on books they wrote about Clojure and when 
the book was first published. 
(He's gathering information for a History of Clojure paper.) 

Lots of people are also chiming in with mentions of Clojure in books they wrote 
on other subjects, online learning materials they've created, and links to 
early material for works in progress.

Here's the Twitter thread:
https://twitter.com/richhickey/status/1057970957040660480?s=09

Booya,
Nathan

-- 
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: "GC overhead limit exceeded": Deceptive message?

2017-08-09 Thread Nathan Smutz
Thanks @Paulus, @Gary and @Peter,

Rearranging the process to let go of the head is good advice.

I believe the problem (should I need to keep all elements in memory) may 
ultimately be lazy collections inside the maps I'm producing. 
I saved 1,917 of these elements to disk and it took only 3 megabytes.

An inner functions creates a lot of lazy sequences, I believe, closing over 
large zipper structures.  
If that's the case, then I need to wrap those sequences in (doall) 
expressions or refactor to something more explicitly eager.

Best,
Nathan





On Tuesday, August 8, 2017 at 9:39:21 AM UTC-7, Paulus Esterhazy wrote:
>
> For background on "holding onto the head of a sequence" type problems, see 
>
> https://stuartsierra.com/2015/04/26/clojure-donts-concat 
>
> and 
>
> https://stackoverflow.com/questions/15994316/clojure-head-retention 
>
> On Tue, Aug 8, 2017 at 6:19 PM, Nathan Smutz  > wrote: 
> > The one thing I'm aware of holding on to is a filtered file-seq: 
> > (def the-files (filter #(s/ends-with? (.getName %) ".xml" ) (rest 
> (file-seq 
> > (io/file dw-path) 
> > There are 7,000+ files; but I'm assuming the elements there are just 
> > file-references and shouldn't take much space. 
> > 
> > The rest of the process is a transducer sequence: 
> > (def requirement-seq (sequence 
> >  (comp 
> >(map xml-zip-from-file) 
> >(remove degree-complete?) 
> >(map student-and-requirements)) 
> >  the-files)) 
> > 
> > Those functions are admittedly space inefficient (lots of work with 
> > zippers); but are pure.  What comes out the other end is a sequence of 
> > Clojure maps.  Could holding on to the file references prevent all that 
> > processing effluvia from being collected? 
> > 
> > The original files add up to 1.3 gigs altogether.  I'd expect the 
> gleaned 
> > data to be significantly smaller; but I'd better check into how close 
> that's 
> > getting to the default heap-size. 
> > 
> > Best, 
> > Nathan 
> > 
> > On Tuesday, August 8, 2017 at 1:20:21 AM UTC-7, Peter Hull wrote: 
> >> 
> >> 
> >> On Tuesday, 8 August 2017 06:20:56 UTC+1, Nathan Smutz wrote: 
> >>> 
> >>> Does this message sometimes present because the non-garbage data is 
> >>> getting too big? 
> >> 
> >> Yes, it's when most of your heap is non-garbage, so the GC has to keep 
> >> running but doesn't succeed in freeing much memory each time. 
> >> See 
> >> 
> https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
>  
> >> 
> >> You can increases the heap but that might only defer the problem. 
> >> 
> >> As you process all your files, are you holding on to references to 
> objects 
> >> that you don't need any more? 
> > 
> > -- 
> > 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: "GC overhead limit exceeded": Deceptive message?

2017-08-08 Thread Nathan Smutz
The one thing I'm aware of holding on to is a filtered file-seq: 
(def the-files (filter #(s/ends-with? (.getName %) ".xml" ) (rest (file-seq 
(io/file dw-path)
There are 7,000+ files; but I'm assuming the elements there are just 
file-references and shouldn't take much space.

The rest of the process is a transducer sequence:
(def requirement-seq (sequence 
 (comp
   (map xml-zip-from-file)
   (remove degree-complete?)
   (map student-and-requirements))
 the-files))

Those functions are admittedly space inefficient (lots of work with 
zippers); but are pure.  What comes out the other end is a sequence of 
Clojure maps.  Could holding on to the file references prevent all that 
processing effluvia from being collected?  

The original files add up to 1.3 gigs altogether.  I'd expect the gleaned 
data to be significantly smaller; but I'd better check into how close 
that's getting to the default heap-size.

Best,
Nathan

On Tuesday, August 8, 2017 at 1:20:21 AM UTC-7, Peter Hull wrote:
>
>
> On Tuesday, 8 August 2017 06:20:56 UTC+1, Nathan Smutz wrote:
>
>> Does this message sometimes present because the non-garbage data is 
>> getting too big?
>>
> Yes, it's when most of your heap is non-garbage, so the GC has to keep 
> running but doesn't succeed in freeing much memory each time.
> See 
> https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
>  
> <https://www.google.com/url?q=https%3A%2F%2Fdocs.oracle.com%2Fjavase%2F8%2Fdocs%2Ftechnotes%2Fguides%2Ftroubleshoot%2Fmemleaks002.html&sa=D&sntz=1&usg=AFQjCNG_3-bT-oubFsBYZ7opNG51ndT1jQ>
>  
> You can increases the heap but that might only defer the problem.
>
> As you process all your files, are you holding on to references to objects 
> that you don't need any more?
>

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


"GC overhead limit exceeded": Deceptive message?

2017-08-07 Thread Nathan Smutz
In the course of processing thousands of XML files (maximum size 388kb; but 
I am doing a lot of operations with zippers) I got this message:
OutOfMemoryError GC overhead limit exceeded 
 com.sun.org.apache.xerces.internal.xni.XMLString.toString

I can process about 2,100 before that pops up.  I set up a transducer 
sequence and I can run count over 2100 of the seq "(count (take 2100 
requirement-seq))" without triggering the error; but much more and I get 
that Garbage Collector message.  If it's just the garbage collector, I'd 
think it should be able to stop between processing elements in the sequence 
and do it's thing.

Does this message sometimes present because the non-garbage data is getting 
too big?

Best,
Nathan




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


core.logic: faking sets and "sufficient" results

2016-12-28 Thread Nathan Smutz
Hi All,

I work for a university and I've been commissioned to write a program that 
proves whether majors can be reasonably completed in 4 years.  core.logic 
has seemed the obvious tool.  The output should be a set of scheduled 
course-offerings satisfying major requirements, course-prereqs, etc. It 
looks like CLP(Set) is still on the wishlist.  
Could someone point me to the current best-practice for faking sets? 
The obvious thing seem to use membero operations on some list L while 
declaring (distincto L) and forcing an ordering so you get combinations 
instead of permutations.  I'm sure there's a better way than (pred L #(= % 
(some-sort-function %)).  If that's the way it's gotta be, then I suppose 
you'd sort on the object IDs to be generic.  (I recall somewhere seeing a 
function returning unique IDs for Clojure objects.)

A further goal would be to output workable education plans without any 
superfluous courses.
I have constraints like "6 credits from any of courses A, B, C, D..." In 
that case if course A is 4 credits and course B is 3 credits, then you want 
[A B] represented in the solution (one more than the six credits required; 
but both are necessary) but you don't want [A B C] for some course C (two 
courses enough and the third is noise).  The ideas I have for that seem 
kind of brute-force.  Is there a built in behavior for this I might not be 
aware of?

The more I think of it, the more complicated this kludge seems to get.  Am 
I barking up the wrong tree?

Best,
Nathan

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


Re: Clojure as a first programming language?

2016-12-04 Thread Nathan Smutz
If you're new to tooling, and want to try Clojure right away, I strongly 
recomend Oakes' Nightcode.  Install the JDK and Nightcode, and you'll have 
Clojure with its popular build tools (Leiningen and Boot) built in, 
beginner-friendly parenthesis management, LightTable-like instant evaluation in 
the margins, and a connected REPL when you run your project.
https://sekao.net/nightcode/

Stack-vomit error messages are the main reason I'd have to think hard before 
recommending Clojure as a first/educational language.  
Apart from the clarity of the smidge of relevant info in there, there's the 
aggravation of having to stop thinking about your problem to play Where's 
Waldo, the Line-Number Edition.

I've heard there have been some attempts at error-mesaage translators.  Does 
anyone have a recommendation?

-- 
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: any? in clojure 1.9.0 alpha

2016-11-13 Thread Nathan Smutz
Is there a Tricky Names for Nubies page?
We might save some stack-overflow searches.

In the spirit of Honest Trailers: if we named functions for what they do:
or-> first-truthy
some  -> first-satisfying
some? -> not-nil?
any?  -> return-true

Are there others?

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


Random xxxx-init.clj files created in root of project.

2016-09-24 Thread Nathan Smutz
I have a Figwheel project that kept generating files with random names 
ending in -init.clj when "lein figwheel" was run.  The files have code 
related to figwhee-sidecar and starting up the REPL.
i followed some breadcrumbs ( 
https://github.com/emezeske/lein-cljsbuild/issues/394 ) suggesting it's to 
do with Lein and an environment variable.
I've confirmed that the files don't appear in the root of my project when I 
unset the environment variable LEIN_FAST_TRAMPOLINE.
Does anyone have any insight on what's going on with that?

Evidently, something I've installed likes that set (LightTable? Cider? 
Spacemacs?); as it seems to be set on startup.  I'm sure other people have 
similar stuff.  
Might there be anything I can fix in my project itself so it doesn't piddle 
into it's root directory when I share it with someone else?


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


grouping and mapping

2016-08-14 Thread Nathan Smutz
Just to put the basic Clojure out there:

(->> (group-by first foos) 
 (map (fn [[key col]] 
  [key (mapv (comp clojure.string/upper-case second) 
 col)]))
 (into {})

Kudos to Moe,Christopher and Simon.

-- 
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: Reduce + merge-with error on lazy sequence of maps

2016-02-13 Thread Nathan Smutz
Thanks James,

There was definitely a missing aggregation step in there.  I appreciate your 
eyeballing it.

Best,
Nathan

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


Reduce + merge-with error on lazy sequence of maps

2016-02-11 Thread Nathan Smutz
Hi all,

I've had a case where reduce with merging operations throws errors on lazy 
sequences.  I thought I should check in for insight before logging a bug. 
 Maybe using maps as keys has something to do with it. too  (I've since 
refactored)

(reduce merge-student-demand everybody)

Throws: 

IllegalArgumentException contains? not supported on type:clojure.lang.LazySeq 
 clojure.lang.RT.contains (RT.java:814)

However: 

(reduce merge-student-demand (take 5 everybody)) 

works just fine.  

As does:
 
(merge-student-demand {} (first everybody))

None of my code uses contains? directly, neither does reduce, so I figure 
it must be one of the invocations of merge-with in my code.
Here are the relevant chunks of code:

;; I can see how this would produce a LazySeq of hash-maps
(defn prioritized-courses [needed-courses]
  (-> 
(for [course-set needed-courses
  :let [demand (course-demand course-set)]]  
  (map #(assoc % :demand demand) (:courses course-set))) 
flatten))

;; There are two merge-with instances here.  This one is used inside the 
next one.
(defn merge-demand [acc m]
  ;; I was admittedly doing something corny here, using a map as a key.
  (merge-with + acc {{:prefix (:prefix m) :number (:number m)} (:demand 
m)})) ;; Sum demand by course

;; Merging again here:
(defn merge-student-demand [acc student]
  (merge-with merge-demand acc {(:id student) (prioritized-courses 
(:needed-courses student))})) 

(reduce merge-student-demand everybody)

=> IllegalArgumentException contains? not supported on 
type:clojure.lang.LazySeq 
 clojure.lang.RT.contains (RT.java:814)

I figure it's likely the Clojure core (1.8.0) merge-with function, being 
the first instance of contains? I could find:

text-mining.core=> (source merge-with)
(defn merge-with
  "Returns a map that consists of the rest of the maps conj-ed onto
  the first.  If a key occurs in more than one map, the mapping(s)
  from the latter (left-to-right) will be combined with the mapping in
  the result by calling (f val-in-result val-in-latter)."
  {:added "1.0"
   :static true}
  [f & maps]
  (when (some identity maps)
(let [merge-entry (fn [m e]
(let [k (key e) v (val e)]
  (if (contains? m k);; contains? invoked here
(assoc m k (f (get m k) v))
(assoc m k v
  merge2 (fn [m1 m2]
   (reduce1 merge-entry (or m1 {}) (seq m2)))]
  (reduce1 merge2 maps

Well that's my mystery.  I should get around to fiddling and seeing if I 
can reproduce this with a more straighforward program.

Best,
Nathan

-- 
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: [Clojurescript] .getElementById returns NULL

2016-01-05 Thread Nathan Smutz
Thanks Francis, that did it.

Rookie mistake, that.
I wonder if there's ever enough page content to make it worth just delaying 
the DOM hooks.   

On Sunday, January 3, 2016 at 7:49:39 PM UTC-8, Francis Avila wrote:
>
> Your problem is unrelated to clojurescript.
>
> Your script runs before the body is loaded, so the test-content element 
> doesn't exist yet.
>
> Either load your script at the end of the body, or wrap your code in a 
> document.onload event handler.
>
>

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


[Clojurescript] .getElementById returns NULL

2016-01-03 Thread Nathan Smutz
Sorry if this is something trivial.  I tried to do some due diligence 
googling with no luck.
The function getElementById seems to be returning null where it shouldn't.

I'm currently using
lein-cljsbuild 1.1.2 
clojure 1.7.0
clojurescript 1.7.170
and compiling with optimizations: :none

Here's my HTML:


  

  
 
Test text
  


Here's my Clojurescript:
(ns gol-cljs.core)
(.log js/console (. js/document getElementById "test-content"))

This prints "null" to Chrome's browser console.
Attempting any operations on (. js/document getElementById "test-content")) 
gives errors about trying to do things with "null".

Is there some requirement I'm missing for accessing the dom?

Best,
Nathan


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


Reviewers needed for new Clojure book!

2015-08-26 Thread Nathan Smutz
I'd be interested.  I've been looking for Clojure books past the introductory 
level.  It sounds like you're aiming for a good "second Clojure book."

-- 
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: Google Clojure REPL

2014-12-16 Thread Nathan Smutz
Hi Daniel,

I just wanted to thank you and say how much I've appreciated your Android REPL. 
In learning Clojure, it's been an amazing resource to have.  Studying books 
away from a computer, or just being comfortable at home: it's been a great 
learning multiplier to launch your app on the spur of the moment and try 
things, or just pull up source/docs for core functions.  Thank you again. 
Please let us know if there's a way to help.

Very best,
Nathan

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