Re: 56 second GC on Heroku - seems a bit long

2014-06-17 Thread Jonah Benton
Some good tactics at bottom: https://blogs.oracle.com/poonam/entry/troubleshooting_long_gc_pauses On Tue, Jun 17, 2014 at 9:38 AM, Brian Marick wrote: > > On Jun 16, 2014, at 2:57 PM, Daniel Compton > wrote: > > > You didn't mention whether this was on the free tier or a paid dyno. I > woul

Re: fn and let are special forms or macros?

2014-06-17 Thread Mark P
Thanks Tassilo for the explanation - much appreciated! I have been searching the web and searching clojure text books for the last two hours trying to find the answer to this same question. Finally I stumbled onto this thread! I realize that hiding the complexity of distinctions between fn / f

[ANN] Eastwood the Clojure lint tool version 0.1.4

2014-06-17 Thread Andy Fingerhut
Eastwood is a Clojure lint tool. It analyzes Clojure source code in Leiningen projects, reporting things that may be errors. Installation instructions are in the documentation here: https://github.com/jonase/eastwood/#installation--quick-usage Updates since the last release are described in

Re: InvokeDynamic

2014-06-17 Thread funkyrod
I wonder if InvokeDynamic could be used to bring more consistency between the 20-argument limit function signatures used for objects and the 4-argument limit function signatures for functions with primitive arguments, by dynamically generating the appropriate method type (with whatever combinat

BeagleBone Black Continuous Analog Reads

2014-06-17 Thread Jeremy Wright
The main way of reading the inputs (analog or digital) on a BeagleBone Black is through the Linux file system. http://beaglebone.cameon.net/home/reading-the-analog-inputs-adc I'm still pretty new to Clojure and come from an object oriented background. I would like to do a continuous read of the

Re: Leiningen 2.4.2 upgrade causing problems

2014-06-17 Thread Sean Corfield
"works for me"... Leiningen 2.4.2; Java build 1.8.0_05-b13; OS X 10.8.5 - lein help new works fine outside of a project and also inside the context of a project that depends on Clojure 1.6.0. Are you running lein inside a project or outside? What do you have in your profiles.clj file? Sean On T

Re: Clojure On Java Friendly Microcontrollers, Beaglebone, etc

2014-06-17 Thread Jeremy Wright
@Kevin - In looking at PyBBIO, I noticed that it supports analog reads on the BeagleBone. It doesn't look like that support got ported over to blackbox though, is that correct? https://github.com/hiredman/blackbox/tree/master/src/blackbox On Tuesday, May 6, 2014 10:58:42 AM UTC-4, Jeremy Wright

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Stuart Sierra
On Tuesday, June 17, 2014 6:14:27 PM UTC-4, Gary Trakhman wrote: > > I'm not sure if the STM guarantees any ordering, but you'd probably want > to be explicit. > Two or more `send`s or `send-off`s from the *same* thread will be delivered in the order they were sent. There are no guarantees abou

Re: online courses for clojure?

2014-06-17 Thread Gustavo Matias
I think it's good to mention this one too: https://tbaldridge.pivotshare.com/ On Tuesday, June 17, 2014 5:17:18 PM UTC-4, Chris Sells wrote: > > Thanks, Blake. That’s the kind of thing I had in mind. > > > > *From:* clo...@googlegroups.com [mailto: > clo...@googlegroups.com ] *On Behalf Of *b

Re: 56 second GC on Heroku - seems a bit long

2014-06-17 Thread Jason Wolfe
Have you tried increasing your permgen size? Loading our codebase uses up just about all of the default Java permgen, and when it gets close to out I believe I've seen it thrashing the GC on the main heap. On Tuesday, June 17, 2014 6:38:46 AM UTC-7, Brian Marick wrote: > > > On Jun 16, 2014

Re: Defs with %

2014-06-17 Thread Mike Thompson
Colin, many thanks. Issue created: https://github.com/cgrand/sjacket/issues/19 On Wednesday, June 18, 2014 4:08:53 AM UTC+10, Colin Jones wrote: > Yeah the latter version parses as 2 symbols in sjacket, whereas the defn > version parses as a single list. > > user=> (p/parser "top%") > #net.

core.async - wait for all given go-blocks to finish

2014-06-17 Thread Shaun Williams
Is there a standard way to wait for a given set of go-blocks to finish? I think this is the same as waiting for a given set of channels to close. GoLang seems to have WaitGroup for this purpose: http://stackoverflow.com/a/21819794/142317 Here's a CLJSfiddle of my current solution: http://cljsfi

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Gary Trakhman
Yes, you could do it with 3 agents, one to order the messages, two to do the work :-). I'm not sure if the STM guarantees any ordering, but you'd probably want to be explicit. On Tue, Jun 17, 2014 at 6:11 PM, Hussein B. wrote: > you mean one agent to deliver the notifications. true? > > > On W

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Hussein B.
you mean one agent to deliver the notifications. true? On Wednesday, June 18, 2014 12:01:42 AM UTC+2, Gary Trakhman wrote: > > Yea, send uses a fixed threadpool, and send-off uses a growing one, so > it's more suitable for IO-bound tasks. I don't think there's any > difference in terms of how i

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Gary Trakhman
Yea, send uses a fixed threadpool, and send-off uses a growing one, so it's more suitable for IO-bound tasks. I don't think there's any difference in terms of how it looks from STM. 2 agents will have 2 independent queues, even though they might share threadpools, if you want to guarantee order,

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Hussein B.
I think send-off is used for IO operations, or? If an agent is started with messages [1 2 3] and then another agent started with messages [4 5] , is it guaranteed that messages [1 2 3] will be delivered before [4 5]? I'm talking about production and really concurrent system. On Tuesday, June 1

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Gary Trakhman
Agent send operations inside a transaction get queued up and don't actually get sent until the transaction commits, that's probably what you want, it's meant for side-effects. On Tue, Jun 17, 2014 at 5:43 PM, Hussein B. wrote: > Hi, > > I have a ServerSocket that stores the client ID and the cl

Doing Socket IO inside STM transaction

2014-06-17 Thread Hussein B.
Hi, I have a ServerSocket that stores the client ID and the client socket object into a ref type. And I also have a thread that is running in the background that checks if a specific condition is met, then it will start send notifications to the clients (it will use the client-id-ref and messa

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Nice! :) Thanks all for help. On Tuesday, June 17, 2014 9:00:06 PM UTC+2, Thomas Heller wrote: > > > > On Tuesday, June 17, 2014 8:16:36 PM UTC+2, Hussein B. wrote: >> >> Oh, this works >> >> (dosync (alter v #(update-in %1 [1] (fnil conj [ ]) %2) 33)) >> > > Not sure what %2 or 33 are doing the

RE: online courses for clojure?

2014-06-17 Thread Chris Sells
Thanks, Blake. That’s the kind of thing I had in mind. From: clojure@googlegroups.com [mailto:clojure@googlegroups.com] On Behalf Of blake Sent: Tuesday, June 17, 2014 1:15 PM To: clojure@googlegroups.com Subject: Re: online courses for clojure? This one is not complete: http://mooc.cs.helsinki

Re: online courses for clojure?

2014-06-17 Thread Marcus Blankenship
Agreed, this class is fantastic. Dan G. @ U of W is amazing. On Jun 17, 2014, at 11:11 AM, Charlie Griefer wrote: > On Jun 17, 2014, at 11:05 AM, Chris Sells wrote: > >> I'm familiar with the PluralSight and Safari Books Online series of video >> presentations on Clojure, but haven't yet see

Re: online courses for clojure?

2014-06-17 Thread blake
This one is not complete: http://mooc.cs.helsinki.fi/clojure But as far as it goes it is very good. On Tue, Jun 17, 2014 at 11:17 AM, Łukasz Kożuchowski < lukasz.kozuchow...@gmail.com> wrote: > Here you are: > http://mooc.cs.helsinki.fi/clojure > > Łukasz Kożuchowski > On Jun 17, 2014 8:12 PM,

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Thomas Heller
On Tuesday, June 17, 2014 8:16:36 PM UTC+2, Hussein B. wrote: > > Oh, this works > > (dosync (alter v #(update-in %1 [1] (fnil conj [ ]) %2) 33)) > Not sure what %2 or 33 are doing there but you can skip the #() function, alter (just like update-in) uses apply internally so you can just use:

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread James Henderson
Ah, you got there first :) James On Tuesday, 17 June 2014 19:20:52 UTC+1, James Henderson wrote: > > 'alter' expects your anonymous function to take at least one argument (the > current value of the ref being altered), whereas you've passed a 0-arg > function - there's no mention of a '%' so Cl

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread James Henderson
'alter' expects your anonymous function to take at least one argument (the current value of the ref being altered), whereas you've passed a 0-arg function - there's no mention of a '%' so Clojure expands it to: (fn [] (update-in @v (fnil conj []))) Indeed, I suspect you want a 2-arg function

Re: online courses for clojure?

2014-06-17 Thread Łukasz Kożuchowski
Here you are: http://mooc.cs.helsinki.fi/clojure Łukasz Kożuchowski On Jun 17, 2014 8:12 PM, "Charlie Griefer" wrote: > On Jun 17, 2014, at 11:05 AM, Chris Sells > wrote: > > I’m familiar with the PluralSight and Safari Books Online series of video > presentations on Clojure, but haven’t yet se

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Oh, this works (dosync (alter v #(update-in %1 [1] (fnil conj [ ]) %2) 33)) On Tuesday, June 17, 2014 8:05:10 PM UTC+2, Hussein B. wrote: > > Thanks, it works. > > In case, my initial map is a ref type > > (def m (ref { } )) > > Why this isn't working? > > (dosync > >(alter m #(update-in @v

Re: online courses for clojure?

2014-06-17 Thread Charlie Griefer
On Jun 17, 2014, at 11:05 AM, Chris Sells wrote: > I'm familiar with the PluralSight and Safari Books Online series of video > presentations on Clojure, but haven't yet seen anything on Coursera or > Udacity with an actual set of homework, deadlines, etc. Does anyone know of > such an online c

Re: Defs with %

2014-06-17 Thread Colin Jones
Yeah the latter version parses as 2 symbols in sjacket, whereas the defn version parses as a single list. user=> (p/parser "top%") #net.cgrand.parsley.Node{:tag :net.cgrand.sjacket.parser/root, :content [#net.cgrand.parsley.Node{:tag :symbol, :content [#net.cgrand.parsley.Node{:tag :name, :con

online courses for clojure?

2014-06-17 Thread Chris Sells
I'm familiar with the PluralSight and Safari Books Online series of video presentations on Clojure, but haven't yet seen anything on Coursera or Udacity with an actual set of homework, deadlines, etc. Does anyone know of such an online course for Clojure? Thanks. -- You received this message b

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Thanks, it works. In case, my initial map is a ref type (def m (ref { } )) Why this isn't working? (dosync (alter m #(update-in @v [1] (fnil conj [ ])) 11)) On Tuesday, June 17, 2014 7:55:14 PM UTC+2, Mauricio Aldazosa wrote: > > For updating the value of a map given a key you can use upd

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread James Reeves
On 17 June 2014 18:54, Mauricio Aldazosa wrote: > > user> (update-in {} [1] (fnil conj []) 22) > {1 [22]} > Good use of the fnil function! It's one of those functions I always forget exists. - James -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread James Reeves
Something like this, perhaps: (assoc m k (conj (m k []) v)) Where m is the map, k is the key, and v is the new value you want to append. This works because (m k []) will default to [] if the key k isn't in the map m. Usually if a key cannot be found, it defaults to nil. If you don't care so

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Mauricio Aldazosa
For updating the value of a map given a key you can use update-in: user> (update-in {1 [11]} [1] conj 22) {1 [11 22]} Now, to handle the case when the key is not present, you can use fnil: user> (update-in {} [1] (fnil conj []) 22) {1 [22]} ​ Cheers, Mauricio -- You received this message becau

Leiningen 2.4.2 upgrade causing problems

2014-06-17 Thread gvim
OS X Mountain Lion / lein 2.4.2 / clojure 1.6.0 / Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Running `lein help new` I'm getting an exception including this: Caused by: java.io.FileNotFoundException: Could not locate clojure/data/priority_map__init.class or clojure/data/priority_map

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Please keep in mind that I'm starting from an empty map. So, I'm looking for an idiomatic Clojure code to achieve my purpose where if the map doesn't has that specific key, it will create an entry of that key and add the value to the newly created vector. And if the key exists, then add the val

How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Hi, This is a very basic question, so be patient please! :) I have an empty map where key is an integer and the value is a vector. How I can add an element to the vector of a specific key? For example: {1 [11]} Then {1 [ 11 22]} Thanks for help and time. -- You received this message becau

Re: lein dependcies and exclusions

2014-06-17 Thread Laurent PETIT
Yeah, these two dependencies are part of what Leiningen includes. I don't exactly remember when it appeared exactly, somewhere in the 1.2 branch I guess. I see the exact same result when creating a new basic project in counterclockwise. It's hard-wired somewhere in Leiningen source code. I susp

Re: Defs with %

2014-06-17 Thread Dave Ray
I believe this is a problem with the Leiningen REPL. It works fine from the built-in REPL: $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar Clojure 1.5.1 user=> (def top% 4) #'user/top% user=> top% 4 Dave On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson wrote: > At the

From Maker Spaces to Seeing Spaces

2014-06-17 Thread Timothy Washington
Brett Victor posted a video for a new kind of maker space. Seeing inside behaviours, across time and across possibilities. Summary excerpt: *"I think people need to work in a space that moves them away from the kinds of non-scientific thinking that you do when you can't see

Help with writing a function to merge two maps

2014-06-17 Thread Mike Fikes
I want to use merge-with * to solve your problem. To do so, define a couple of helper functions (defn v->m [v] (into (sorted-map) (for [{:keys [id val]} v] [id val]))) (defn m->v [m] (mapv (fn [[k v]] {:id k :val v}) m)) that can convert your structure to and from sorted maps. With these,

Re: Help with writing a function to merge two maps

2014-06-17 Thread Ray Miller
On 17 June 2014 13:24, Shoeb Bhinderwala wrote: > Can someone help me write the following function: > > I have two lists of maps as inputs: > > (def xs [{:id 1 :val 10} > {:id 2 :val 20} > {:id 3 :val 30} > {:id 4 :val 40}]) > > (def ys [{:id 2 :val 20} >

Re: learning to think a better way

2014-06-17 Thread Timothy Washington
Functional Geekery has a nice audio discussion with Simon Peyton Jones, one of Haskell's founders. As well as discussing computational concepts, Simon talks about bringing Computer Science as a subject, to the English National school curriculum. He also delves into what that

Re: Help with writing a function to merge two maps

2014-06-17 Thread Di Xu
(let [trans (fn [ent] (reduce #(assoc %1 (:id %2) (:val %2)) {} ent))] (for [i (merge-with * (trans xs) (trans ys))] {:id (first i) :val (second i)})) ​you can sort on the result of above expression to get sorted vector.​ Thanks,

Re: Help with writing a function to merge two maps

2014-06-17 Thread Jeb Beich
Here's what I came up with: (require '[clojure.set :as set]) (let [->map-fn (fn [s] (->> s (map (juxt :id :val)) (into {}))) xs-m (->map-fn xs) ys-m (->map-fn ys)] (->> (set/union (keys xs-m) (keys ys-m)) (map (fn [k] {:id k :val (* (get xs-m k 1) (get ys-m k 1))} On Tue

Re: lein dependcies and exclusions

2014-06-17 Thread Phillip Lord
Phillip Lord writes: > Softaddicts writes: >> You are using swank aren't you ? > > No, not as far as I can tell. Being using nrepl for a long time. > >> This is the completion library it uses. Check your lein default profile. >> Maybe you requiring it there. Just tested this on a clean machine

Re: lein dependcies and exclusions

2014-06-17 Thread Softaddicts
We always use a separate profile to package stuff for delivery. And of course we never refer to these profiles in the global lein config. >From the pom it seems it's not brought in by one of the top level dependencies. Did you check the output of lein deps :tree ? It's a bit more obvious to find

Re: 56 second GC on Heroku - seems a bit long

2014-06-17 Thread Brian Marick
On Jun 16, 2014, at 2:57 PM, Daniel Compton wrote: > You didn't mention whether this was on the free tier or a paid dyno. I would > expect the paid dynos to not be as heavily provisioned and could possibly > alleviate this. Paid. (And using 2X dynos didn't seem to make a difference.) --

Help with writing a function to merge two maps

2014-06-17 Thread Shoeb Bhinderwala
Can someone help me write the following function: I have two lists of maps as inputs: (def xs [{:id 1 :val 10} {:id 2 :val 20} {:id 3 :val 30} {:id 4 :val 40}]) (def ys [{:id 2 :val 20} {:id 3 :val 30} {:id 5 :val 50}

Re: lein dependcies and exclusions

2014-06-17 Thread Phillip Lord
Softaddicts writes: > You are using swank aren't you ? No, not as far as I can tell. Being using nrepl for a long time. > This is the completion library it uses. Check your lein default profile. > Maybe you requiring it there. As I said, I've removed by profile.clj for this test. Now, maybe I h

Re: lein dependcies and exclusions

2014-06-17 Thread Softaddicts
You are using swank aren't you ? This is the completion library it uses. Check your lein default profile. Maybe you requiring it there. If you want to avoid this being included, create a lein profile like prod or deploy and respecify your dependencies explicitly. Use it then to package your targ

lein dependcies and exclusions

2014-06-17 Thread Phillip Lord
I'm struggling a little with dependencies in lein for an artifact that is a dependency of a maven project. I have the following test sample working. This is project.clj (defproject test-exclusion "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME"; :l

learning to think a better way

2014-06-17 Thread douglas smith
Hey all, I am taking entry level classes with Udacity now but I would much prefer to be learning to think the 'clojure' way. With interest and support from (insert company with IT needs) and the clojure community we could/should implement a training program along similar lines. http://www.at

Defs with %

2014-06-17 Thread Mike Thompson
At the REPL ... user=> (def top% 4) ;; an unusually named var #'user/top% But later, it I try to use this var, trouble ... user=> top% CompilerException java.lang.RuntimeException: Unable to resolve symbol: top in this context, compiling:(Local\Temp\form-init6773082655831127234.clj:1: