[ANN] clojure.data.priority-map 0.0.3

2013-10-22 Thread Mark Engelberg
https://github.com/clojure/data.priority-map/ A priority map is similar to a sorted map, but sorts the entries by the values rather than the keys in the map. Think of it as a kind of priority queue with a full map-like API to query, add, adjust, and remove items and their priorities. The new 0.0

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 wrote: > I'm do

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

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

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

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 b

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 insert

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 can

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 se

Re: Overwrite equals in defrecord

2013-10-22 Thread Marc Dzaebel
http://cmayes.wikispaces.com/PracticalClojure13: ... > defrecord does not support Java class inheritance, so it cannot override > methods of Java classes, even abstract classes. However, it does permit you > to override methods of java.lang.Object such as hashCode, equals, and > toString. Simpl

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 argumen

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 name&signature in class ...". Do I have to use extend-type?* -- -- You received this message bec

Remote Clojure job opportunities

2013-10-22 Thread givenbygod
Hello! Sorry for bringing this topic once again, but after delving into functional programming and Clojure in particular I really want to try to use it for something bigger than just small scripts and test programs. Hence the question - are there any open Clojure developer positions for which a

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 tha

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 wa

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 defin

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 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 will thrash in G

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 wor

Re: Request for help optimising a Clojure program

2013-10-22 Thread Paul Butcher
On 22 Oct 2013, at 19:55, David Nolen 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 on the timing whatso

Re: Request for help optimising a Clojure program

2013-10-22 Thread Paul Butcher
On 22 Oct 2013, at 18:45, Mark Engelberg 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 performance differenc

Re: binding and lazy seqs

2013-10-22 Thread Tassilo Horn
Brian Craft 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 text. I'm

Re: Request for help optimising a Clojure program

2013-10-22 Thread David Nolen
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. You also haven't said whether the timings for the smaller problems are significantly different between Scala and Clojure. David On

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

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

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

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

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

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

problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
I originally posted this in Stack Overflow, but realised I might get more response from the google group. Apologies for duplication. I'm seeing some issues using a parser mon

Re: Macro problem: passing a function to a macro

2013-10-22 Thread Phillip Lord
Tassilo Horn writes: > Phillip Lord 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 l

Re: Macro problem: passing a function to a macro

2013-10-22 Thread Tassilo Horn
Phillip Lord 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 themselves in maps, but I don't

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

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 in

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