Re: how to define a variable of type collection to keep other functions.

2014-05-23 Thread Sean Corfield
On May 23, 2014, at 2:19 AM, sorin cristea wrote: > Thank Philippe for your advices,I came from java environment and seems I > still remain with some 'bad' habits. Coming from Java, the main thing to bear in mind in Clojure is that you do not have "variables" in the sense you are used to and yo

Re: How to refactor data safely?

2014-05-23 Thread Armando Blancas
Jakub, I'll be interested to learn how you work this out. I also work with data whose structure is known to functions in various modules, thus its very shape is a contract. This is coming from the other end of encapsulating everything in Java classes and interfaces. Also, I write test cases at

Re: Using records as handles vs. complete representations

2014-05-23 Thread Stuart Sierra
I would say do one of: - define your own constructor functions like (defn user [id] ...) - use the map->User constructors created by defrecord - do not specify the non-required keys as fields in the defrecord - use plain maps On Friday, May 23, 2014 4:47:43 PM UTC-4, Elliot wrote: > > There see

Using records as handles vs. complete representations

2014-05-23 Thread Elliot
There seem to be two kinds of definitions of what a record could be: 1. A full representation of a resource,e.g. (defrecord User [id name age gender address]) 2. A *handle* to a resource, e.g. (defrecord User [id]), e.g. [wikipedia] below Some protocols only ever need a handle, not the full res

Re: Question regarding tools.analyzer.jvm and the :tag, :o-tag, and :class entries

2014-05-23 Thread guns
On Fri 23 May 2014 at 01:29:54AM +0200, Bronsa wrote: > When using tools.analyzer.jvm you have to remember that its primary > use-case is as a front-end for a compiler, in this case :tag and > :o-tag serve to inform tools.emitter.jvm when to emit a cast thus > might not always reflect the :tag met

Re: Help with a memory leak

2014-05-23 Thread Pablo Nussembaum
It should be related somehow. Although, in my case I'm not dynamically generating protocols or multimethods, the app only generates a plain old functions. In the ticket it says that there is a way to clear the protocols internal cache. So I'll try to switch my code to generate protocols and tes

Re: Help with a memory leak

2014-05-23 Thread Andy Fingerhut
I haven't looked into the details, but you might want to check out this Clojure ticket to see if it is related: http://dev.clojure.org/jira/browse/CLJ-1152 Andy On Fri, May 23, 2014 at 8:53 AM, Pablo Nussembaum wrote: > I have been working hard to understand the issue, and it seems to re

Re: [RFC] Roundtripping namespaced xml documents for data.xml

2014-05-23 Thread Paul Gearon
Hi Herwig, I spent some time going through the design, and a email thread (particularly Chouser and Christophe's responses), plus I spent a bit more time on my own implementation where it was clear that I'd missed some things. I've yet to go through your code in fine detail, so I'll still have so

Re: Help with a memory leak

2014-05-23 Thread Pablo Nussembaum
I have been working hard to understand the issue, and it seems to related to the creation of lots of functions using eval. for instance if you run: (for [_ (range 1)] (eval (read-string "(fn [x] (inc x))"))) 2 or 3 time it will consume all PermGen. Is there any way to palliate this problem?

Re: How to refactor data safely?

2014-05-23 Thread Bertrand Dechoux
It's only a reformulation of Ulises comment but I would say: 1) abstract away how the data is accessed 2) introduce change one function at a time by swapping the past accessor with the new accessor (really it is like a getter/setter) 3) if you have final consumer(s) you might need to introduce a

Re: [ANN] core.async (and more) video tutorials

2014-05-23 Thread Juan Manuel Gimeno Illa
The videos look very good and seem very interesting. One idea: some video about how to create & configure a project in cursive would be helpful as well. Juan Manuel El viernes, 23 de mayo de 2014 05:56:45 UTC+2, tbc++ escribió: > > I'm using Cursive Clojure (Intelij). It has a "Presentation Mod

Re: Code Poetry

2014-05-23 Thread Gregg Reynolds
On Fri, May 23, 2014 at 8:23 AM, wrote: > Ok, so I'm a bit over the edge about how good code should be written, > as many of you might have guessed... > > but it could be worse: > http://sourcecodepoetry.com > "good code reads well, best code rhymes" > > and, best of all, it is a contest! > > Ti

Code Poetry

2014-05-23 Thread daly
Ok, so I'm a bit over the edge about how good code should be written, as many of you might have guessed... but it could be worse: http://sourcecodepoetry.com "good code reads well, best code rhymes" and, best of all, it is a contest! Tim Daly /me mutters about being one-upped :-( -- You recei

Re: How should I implement an elevator state-machine with loops and core.async?

2014-05-23 Thread Jesse
I have got in a shape where it works fine, but with slightly unusual behavior. I am looking for advice on refactoring, So if someone could please have a look. https://gist.github.com/gamma235/4ea0d7a0d0efb8d4399f Jesse On Thursday, May 22, 2014 8:25:39 PM UTC+9, Rob Day wrote: > > I haven

Re: How should I implement an elevator state-machine with loops and core.async?

2014-05-23 Thread Jesse
On Thursday, May 22, 2014 8:17:51 PM UTC+9, Jesse wrote: > > Hey guys, I am trying to build a program that can instruct a single > elevator, 2 floor system how to behave based on the state of an atom that > is being constantly checked for updates by a loop. The state of the atom at > a given t

Re: Community Interest in a Clojure Application Config Library, using Zookeeper?

2014-05-23 Thread Stathis Sideris
You guys should check stoic: https://github.com/juxt/stoic >From the readme: This library marries Stuart Sierras Component library with distributed > config. Feed Stoic a SystemMap and it will ensure that the relevant > components are bounced when their config changes. Config-suppliers are >

Re: how to define a variable of type collection to keep other functions.

2014-05-23 Thread sorin cristea
Thank Philippe for your advices,I came from java environment and seems I still remain with some 'bad' habits. On Friday, May 23, 2014 12:04:52 PM UTC+3, Philippe Guillebert wrote: > > Hello > > This is not written as functional code. You have to understand that : > > (cons f futures) > > cre

Re: how to define a variable of type collection to keep other functions.

2014-05-23 Thread Philippe Guillebert
Hello This is not written as functional code. You have to understand that : (cons f futures) creates a new "version" of futures with f in front of it and cons *returns it to you*. Put another way,* futures is not modified by cons*. In your dotimes construct, the consed value is lost each loo

how to define a variable of type collection to keep other functions.

2014-05-23 Thread sorin cristea
Hi all, do you have any idea how I can define a variable, global or inside a function, used to store for example the FutureTask objects resulted from ExecutorService submit(fn) call,I want to put all futures in a collection and later call 'get' on each of them. bellow is a sample of that code:

emacs + assert + syntax highlighting

2014-05-23 Thread t x
Hi, In my code, I have many lines like: (assert ) (assert ) (assert ) Now, is there a way to have the entire sexp highlighted in light grey? (Rather than as normal code). The logic being "assertions are meant more like comments", and when reading, I'd prefer to not se