Re: core.async and channel flushing

2013-10-22 Thread Alexander L.
Sorry for bringing this back up, but I was wondering if anyone figured out something better... On Saturday, September 14, 2013 10:49:08 PM UTC+3, Alexander L. wrote: I am developing an application and I use core.async to push data from multiple threads within an infinite (go (while true

Macro problem: passing a function to a macro

2013-10-22 Thread Tassilo Horn
Hi all, I'd like to have a macro that I can call and pass it some function that the macro uses inside. Concretely, the macro iterates over some class model and should expand to a ns declaration with one defn per class in the model. Currently, the macro calls a generate-defn-for-class function

Re: Compulsive over-optimization

2013-10-22 Thread Niels van Klaveren
I can imagine this behavior. Unlike premature performance optimization, readability / terseness are well worth optimizing for when learning Clojure, as long as you value readability over terseness to keep well away from code golf territory. With Clojure, I always have the idea that things

RE: Macro problem: passing a function to a macro

2013-10-22 Thread Phillip Lord
Is it because you're expansion returns the symbol and not the function. ('inc 2) returns nil which is what I think is happening. From: clojure@googlegroups.com [clojure@googlegroups.com] on behalf of Tassilo Horn [t...@gnu.org] Sent: 22 October 2013

Re: [ANN] Timeline - a library for time-varying data values

2013-10-22 Thread Mikera
Just released Timeline 0.3.0 to clojars: https://clojars.org/net.mikera/timeline Some new (still experimental) features: - timelines are now Counted for you can do (count timeline) in the normal way - timelines can be sliced with arbitrary start and end times (exploiting the efficiency of

Re: Macro problem: passing a function to a macro

2013-10-22 Thread Tassilo Horn
Phillip Lord phillip.l...@newcastle.ac.uk writes: Is it because you're expansion returns the symbol and not the function. ('inc 2) returns nil which is what I think is happening. Ah, indeed. I really whished that would throw an error. I mean, it's cool that keywords can lookup

Re: Macro problem: passing a function to a macro

2013-10-22 Thread Phillip Lord
Tassilo Horn t...@gnu.org writes: Phillip Lord phillip.l...@newcastle.ac.uk writes: Is it because you're expansion returns the symbol and not the function. ('inc 2) returns nil which is what I think is happening. Ah, indeed. I really whished that would throw an error. I mean, it's

problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
I originally posted this in Stack Overflowhttp://stackoverflow.com/questions/19505334/clojure-algo-monad-strange-m-plus-behaviour-with-parser-m-why-is-second-m-plus, but realised I might get more response from the google group. Apologies for duplication. I'm seeing some issues using a parser

[ANN] latest-clojure-libraries emacs plugin

2013-10-22 Thread Adam Clements
This is an emacs plugin which uses lein-ancient[1] to automatically insert the latest version vector of a library at the cursor in emacs. This works with clojars, maven central and even compatible private repositories. Simply M-x latest-clojure-libraries-insert-dependency, type the name of your

Getting lengths/dimensions in vectorz-clj

2013-10-22 Thread P Martin
Hi there, I am using vectors-clj to do some optimization work, but I am having trouble getting the dimensions of the matrices I build. I come from Matlab, so I am used to commands such as size(M) which returns the (n,m) dimensions of the matrix M. I am including clojure.core.matrix in my code

Re: Getting lengths/dimensions in vectorz-clj

2013-10-22 Thread Mikera
You probably want: (shape M) ;; returns a vector [4 6] for a 4x6 Matrix Though you can also access the individual dimension sizes as follows, which is sometimes useful: (dimension-count M 0) ;; returns 4 as the count of the first dimension (dimension-count M 1) ;; returns 6 as the count

Request for help optimising a Clojure program

2013-10-22 Thread Paul Butcher
I've been playing around with a generalised version of the N-Queens problem that handles other chess pieces. I have a Scala implementation that uses an eager depth-first search. Given enough RAM (around 12G - it's very memory hungry!) it can solve a 6x9 board with 6 pieces in around 2.5 minutes

Re: Request for help optimising a Clojure program

2013-10-22 Thread Mark Engelberg
I looked briefly at the code and can confirm that to my eye, the two implementations appear to be implementing the same algorithm. My first guess would be that the performance difference comes from Clojure's use of boxed numbers for all the positions. Possibly you could get better performance by

Re: Getting lengths/dimensions in vectorz-clj

2013-10-22 Thread P Martin
Great! Thanks for the clarification. Patrick On Tuesday, October 22, 2013 12:21:33 PM UTC-4, Mikera wrote: You probably want: (shape M) ;; returns a vector [4 6] for a 4x6 Matrix Though you can also access the individual dimension sizes as follows, which is sometimes useful:

binding and lazy seqs

2013-10-22 Thread Brian Craft
I just came across this example in Clojure Programming, chapt 4: (def ^:dynamic *max-value* 255) (defn valid-value? [v] (= v *max-value*)) (binding [*max-value* 500] (map valid-value? [299])) ;= (false) It's not really explained in the text. I'm guessing this happens because when the

Re: binding and lazy seqs

2013-10-22 Thread Tassilo Horn
Brian Craft craft.br...@gmail.com writes: Hi Brian, I just came across this example in Clojure Programming, chapt 4: (def ^:dynamic *max-value* 255) (defn valid-value? [v] (= v *max-value*)) (binding [*max-value* 500] (map valid-value? [299])) ;= (false) It's not really explained in the

Re: Request for help optimising a Clojure program

2013-10-22 Thread Paul Butcher
On 22 Oct 2013, at 18:45, Mark Engelberg mark.engelb...@gmail.com wrote: I looked briefly at the code and can confirm that to my eye, the two implementations appear to be implementing the same algorithm. Thanks - always good to have a second pair of eyes :-) My first guess would be that the

Re: Request for help optimising a Clojure program

2013-10-22 Thread Paul Butcher
On 22 Oct 2013, at 19:55, David Nolen dnolen.li...@gmail.com wrote: I note that the Clojure version isn't being given 12gigs of RAM, is this something you're giving to the JVM after when you run a AOTed version of the Clojure code. Yeah - I have tried giving it more RAM without any effect

Re: Compulsive over-optimization

2013-10-22 Thread Alex Baranosky
Well said Niels. As far as performance optimization. Imo that's premature until you profile. On Tue, Oct 22, 2013 at 2:42 AM, Niels van Klaveren niels.vanklave...@gmail.com wrote: I can imagine this behavior. Unlike premature performance optimization, readability / terseness are well worth

Re: Request for help optimising a Clojure program

2013-10-22 Thread David Nolen
On Tue, Oct 22, 2013 at 3:11 PM, Paul Butcher p...@paulbutcher.com wrote: Yeah - I have tried giving it more RAM without any effect on the timing whatsoever. And I couldn't see the point of stopping people with less RAM than that from being able to run it :-) But without enough RAM most JVMs

Re: problems with state-t monad transformer

2013-10-22 Thread Sean Corfield
It sounds like you're running into the chunked sequence behavior of map (it's lazy but it realizes chunks of the sequence for efficiency rather than strictly on-demand). I'd say the possibilities are: don't use side-effecting functions in your monads or define a fully lazy version of map and

Re: Compulsive over-optimization

2013-10-22 Thread Kendall Shaw
Optimizing too much for readability, can't be well worth doing, I think. It's a contradiction in terms. Watching out for changes that make the code shorter instead of more readable seems like useful advice and maybe a sign that I am optimizing too much. I'm pretty sure I could figure out a way

Re: problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
It's difficult to see how it's a chunked issue, the original code is just calling monadic functions, the only map is the state (the latter part of my post was an attempt to manually recreate what the monad macros are doing and I'm sure i didn't do a perfect job of it). It's my understanding

Overwrite equals in defrecord

2013-10-22 Thread Marc Dzaebel
(defrecord R [x y]) automatically defines a reasonable *equals* method using x y. However, is it possible to overwrite the method as it should use X only? My tries resulted in *Duplicate method namesignature in class Do I have to use extend-type?* -- -- You received this message

Re: problems with state-t monad transformer

2013-10-22 Thread Ben Wolfson
based on what you posted to stack overflow I would guess it's because the side-effects (the prints) are coming too soon---you have a println as the first line of check-k-v, so if the expression (mplus (check-k-v ...) (check-k-v ...)) is evaluated, then, given that mplus is not a macro, both

Re: problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
The state modifications are both happening, if i inspect it after the 2nd function does an update the change is there, but the wind out of the return value from the first function is a different object, and immutability is giving me it before the 2nd update, which is a discarded object. I am

Re: Overwrite equals in defrecord

2013-10-22 Thread Jim - FooBar();
use deftype which is more low-level and I think doesn't define equals or put y in meta data that don't participate in equality...:) Jim On 22/10/13 22:44, Marc Dzaebel wrote: http://cmayes.wikispaces.com/PracticalClojure13: ... defrecord does not support Java class inheritance, so it

structuring a db load, back pressure

2013-10-22 Thread Brian Craft
I'm doing a load to db, which looks roughly like read, transform, insert, repeat. Blocking on the inserts leaves the cores sitting cold while they could be doing the next read/transform. It's tempting to try an agent for the inserts. If I understand them correctly, that would queue the inserts

apps uploaded using lein-beanstalk don't show up in amazon beanstalk management console.

2013-10-22 Thread Romeo Van Snick
Hi, I'm pretty new to clojure webdev as well as amazon aws but I'm trying to build a small vanilla web app using lein-beanstalk to deploy the app without having to know the gritty details of aws-hosting. I'm getting along with lein-beanstalk since I can succesfully upload and use the webapp

Re: Clojure can't import some Java classes

2013-10-22 Thread Alex Miller
I'd love to see a stack trace when that happens (could even be triggered by dumping stack in your static initializer if nothing else). On Saturday, October 12, 2013 3:17:50 AM UTC-5, Wujek Srujek wrote: So you are saying compilation is trying to instantiate class and run static initializers?

Re: Clojure can't import some Java classes

2013-10-22 Thread Zach Oakes
Here's the error I get when I import LibGDX's Timer class: http://pastebin.com/q7wys8yi On Tuesday, October 22, 2013 9:55:16 PM UTC-4, Alex Miller wrote: I'd love to see a stack trace when that happens (could even be triggered by dumping stack in your static initializer if nothing else).

Re: structuring a db load, back pressure

2013-10-22 Thread Shantanu Kumar
Hi Brian, On Wednesday, 23 October 2013 05:33:30 UTC+5:30, Brian Craft wrote: I'm doing a load to db, which looks roughly like read, transform, insert, repeat. Blocking on the inserts leaves the cores sitting cold while they could be doing the next read/transform. It's tempting to try an

[JOB] Clojure Job Posting

2013-10-22 Thread Michael Lim
Hi, We are a Singapore-based company that specializing social media analytics and insights, and we are looking to hire people for the role of system engineer, ideally someone who knows Clojure. Systems Engineer === - 2+ years software development experience - Knowledge of

Re: structuring a db load, back pressure

2013-10-22 Thread Jonah Benton
I tend to think of pull operations in these situations. So perhaps wrap a lazy sequence around a chunked form of the read + transform operation, perhaps parallelizing the transform, and do the insert in a doseq on the lazy sequence? On Tue, Oct 22, 2013 at 8:03 PM, Brian Craft