Save map contentns to external file?

2014-05-15 Thread Steven Jones
Hi I am developing an Overtone MIDI application and wish to save/read the state of a map to an external file. The map keys are always integers, specifically MIDI program numbers. The map values however have one of two forms. They are either explicit association list of key/value pairs or

Re: Asynchronous socket communication with agents

2014-05-15 Thread Gary Verhaegen
While an agent is probably what you want, you should not use it like that. I'm not sure how you can get a failed state with the given code, but here's how I would do it. First off, the agent is only meant for logging, so let's keep it on that job alone. In log-entry, replace the (dosync ...)

Re: Asynchronous socket communication with agents

2014-05-15 Thread Dylan Gleason
Thanks for your response, Gary. Just out of curiosity, what is the advantage of using the java Thread as opposed to using the Clojure future? Will it yield the same effect or must I use Thread to explicitly join the threads when they are done executing? -- Dylan On Thursday, May 15, 2014

Re: Save map contentns to external file?

2014-05-15 Thread Daniel Kersten
To write the data to a file, you could do something like this: (spit filename (pr data)) And to read it back in, you could do something like: (clojure.edn/read-string (slurp filename)) On 15 May 2014 07:20, Steven Jones ple...@gmail.com wrote: Hi I am developing an Overtone MIDI

Re: Best method for REST api authentication?

2014-05-15 Thread Ivan Schuetz
Ok, I was confused, the solution for this is just to use a session - if the authentication is done using a cookie the server is basically stateless, which would comply to REST. I implemented cookie store session following this tutorial:

require multiple file

2014-05-15 Thread Tony Francis
(ns foo.core (foo-require foo.bar.*) ) how to write a function to require or load file with specfic path or namespace like above -- 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

Re: citing Clojure and EDN?

2014-05-15 Thread Giovanni Gherdovich
Hello, On Wed, Apr 23, 2014 at 4:42 AM, vrak...@gmail.com wrote: For the purposes of academic publications (in areas well outside of SIGPLAN and such), are there any preferred citations for Clojure and EDN? loosely related to this old thread, today I have read that github has worked out a

Re: citing Clojure and EDN?

2014-05-15 Thread Phillip Lord
Giovanni Gherdovich g.gherdov...@gmail.com writes: For the purposes of academic publications (in areas well outside of SIGPLAN and such), are there any preferred citations for Clojure and EDN? loosely related to this old thread, today I have read that github has worked out a way to stick a

Re: clojurescript: modifying function definitions

2014-05-15 Thread t x
Dave, Mike: Noted. Will study this. Thanks! On Wed, May 14, 2014 at 6:46 AM, Mike Haney txmikes...@gmail.com wrote: There's a library for that - https://github.com/technomancy/robert-hooke/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Clojure TCP client using Java Socket

2014-05-15 Thread Philipp Meier
Hi, Am Donnerstag, 8. Mai 2014 07:41:48 UTC+2 schrieb Dylan Gleason: *(defn- receive* * Given a socket create a DataInputStream and process the server* * response* * [reader socket]* * (let [bytes-in (make-array Byte/TYPE util/max-message-size)* *info {:type :receive

printing lazy lists

2014-05-15 Thread Phillip Lord
I am trying to dump a representation of the contents of a list to file. I've recently changed how I generated this list and it's now lazy (not really by design more by side-effect, if you will excuse the poor choice of words). I was using (spit file (str lst \n)) which worked quite nicely,

Re: printing lazy lists

2014-05-15 Thread Michał Marczyk
Use pr-str: user= (str (lazy-seq (list 1 2 3))) clojure.lang.LazySeq@7861 user= (pr-str (lazy-seq (list 1 2 3))) (1 2 3) Cheers, Michał On 15 May 2014 16:29, Phillip Lord phillip.l...@newcastle.ac.uk wrote: I am trying to dump a representation of the contents of a list to file. I've

Propagating data through dependencies

2014-05-15 Thread Casper
This is not strictly a Clojure question, but I'll ask it here since I am solving it in Clojure. I have already made one solution which works, but I am interested in whether there are other and better approaches. I have a number of different products and some are dependant on others: A - B B -

Re: [ANN] clojure.test.check 0.5.8

2014-05-15 Thread Reid Draper
Sorry you ran into an issue, Steve. I like your idea of including more information in the ex-info data. Is there a specific generator you're having trouble writing without such-that? In general, I've found that it's a code-smell if you need such-that to retry that many times. Happy to help

implicit :required behavior in Tools.cli is deceptive

2014-05-15 Thread Bob Larrick
A single element in the cli-options can be as brief as [-p --port A port number] What is non-obvious is that specifying --port PORT has entirely different semantics than specifying --port In the first case the command lein run -p 3000 will result in an options map of {:options {:port

ANN Cassaforte 1.3.0 is released

2014-05-15 Thread Michael Klishin
Cassaforte [1] is a Clojure client for Cassandra built around CQL. Release notes: http://blog.clojurewerkz.org/blog/2014/05/15/cassaforte-1-dot-3-0-is-released/ Next Cassaforte release will be 2.0 and will introduce a major public API change:

Leiningen just hangs

2014-05-15 Thread Mark Watson
I'm running Leiningen on CentOS 6.5. Everything was working fine, and today when I try lein run it just hangs. It takes about 15 minutes for lein version to return. The project works fine on my macbook pro, and another CentOS box. I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen.

Re: Leiningen just hangs

2014-05-15 Thread Gary Trakhman
Did you try to clean out ~/.lein/profiles.clj? On Thu, May 15, 2014 at 2:34 PM, Mark Watson mkw5...@gmail.com wrote: I'm running Leiningen on CentOS 6.5. Everything was working fine, and today when I try lein run it just hangs. It takes about 15 minutes for lein version to return. The

Re: Leiningen just hangs

2014-05-15 Thread Mark Watson
I don't have a ~/.lein/profiles.clj file. I removed all the Leiningen files, tried with a fresh install, still no luck. On Thursday, May 15, 2014 2:38:34 PM UTC-4, Gary Trakhman wrote: Did you try to clean out ~/.lein/profiles.clj? On Thu, May 15, 2014 at 2:34 PM, Mark Watson

Re: [ANN] clojure.test.check 0.5.8

2014-05-15 Thread Steve Miner
On May 15, 2014, at 1:03 PM, Reid Draper reiddra...@gmail.com wrote: Sorry you ran into an issue, Steve. I like your idea of including more information in the ex-info data. Is there a specific generator you're having trouble writing without such-that? In general, I've found that it's a

Re: Leiningen just hangs

2014-05-15 Thread Mimmo Cosenza
try removing ~/.m2 On 15 May 2014, at 20:56, Mark Watson mkw5...@gmail.com wrote: I don't have a ~/.lein/profiles.clj file. I removed all the Leiningen files, tried with a fresh install, still no luck. On Thursday, May 15, 2014 2:38:34 PM UTC-4, Gary Trakhman wrote: Did you try to

Re: Leiningen just hangs

2014-05-15 Thread Mark Watson
Tried it On Thursday, May 15, 2014 3:17:58 PM UTC-4, Magomimmo wrote: try removing ~/.m2 On 15 May 2014, at 20:56, Mark Watson mkw...@gmail.com javascript: wrote: I don't have a ~/.lein/profiles.clj file. I removed all the Leiningen files, tried with a fresh install, still no luck.

Re: Save map contentns to external file?

2014-05-15 Thread Steven Jones
Thanks, edn looks like the way to go but your example is not quite working. The issue appears to be with pr. (defn foo [] 'foo) (def data {0 foo, 1 '[a b c]}) (spit filename (pr data)) First pr prints the data to *out* but then returns nil so spit is writing an empty file. Second

Re: Leiningen just hangs

2014-05-15 Thread Gary Trakhman
At this point, I'd suspect a networking timeout issue, do you get a different result if you disable all your connections? On Thu, May 15, 2014 at 3:31 PM, Mark Watson mkw5...@gmail.com wrote: Tried it On Thursday, May 15, 2014 3:17:58 PM UTC-4, Magomimmo wrote: try removing ~/.m2 On 15

Re: Leiningen just hangs

2014-05-15 Thread Armando Blancas
I've had this problem and I suspect is low memory. It happened often with an old box with 1G running Fedora 20, but I've also seen it with my laptop if I leave too many leftover jvm processes running (with 4G allocated for a virtual box instance); on my 16G mac it never happens. So freeing up

Re: Leiningen just hangs

2014-05-15 Thread Gary Trakhman
Oh yea, GC churn can take up a lot of time. The illusion of 'infinite memory' :-). On Thu, May 15, 2014 at 3:47 PM, Armando Blancas abm221...@gmail.comwrote: I've had this problem and I suspect is low memory. It happened often with an old box with 1G running Fedora 20, but I've also seen it

Re: Save map contentns to external file?

2014-05-15 Thread Stephen Gilardi
On May 15, 2014, at 3:35 PM, Steven Jones ple...@gmail.com wrote: Thanks, edn looks like the way to go but your example is not quite working. The issue appears to be with pr. (defn foo [] 'foo) (def data {0 foo, 1 '[a b c]}) (spit filename (pr data)) Use pr-str instead of

Propagating data through dependencies

2014-05-15 Thread David Pidcock
You said b can't be billed after B. But it sounds like it can't be billed before. Say b is ready at 1, can you bill it at 1 and then B at 2? Anyway, my first thought was using weights on the edges equal to the duration between the dependencies and use a max cost on the graph. But calculating

Propagating data through dependencies

2014-05-15 Thread David Pidcock
If, say C cannot depend on any b directly, (I.e. C can only depend on B), and your domain rules say you can only bill for all b's when you bill B, then really you have a self contained sub-graph with only one bill date for the root node B. You can simply ignore backfilling the billing date for

Re: Propagating data through dependencies

2014-05-15 Thread François Rey
I'm not sure I totally understand your use case, but somehow it sounds like these libraries may be of interest to you: propaganda https://github.com/tgk/propaganda prismatic graph https://github.com/prismatic/plumbing -- You received this message because you are subscribed to the Google Groups

Re: Propagating data through dependencies

2014-05-15 Thread Casper
On Thursday, May 15, 2014 11:18:31 PM UTC+2, David Pidcock wrote: You said b can't be billed after B. But it sounds like it can't be billed before. Say b is ready at 1, can you bill it at 1 and then B at 2? They should actually be billed at the same time (yeah, I didn't explain that very

Re: Propagating data through dependencies

2014-05-15 Thread Casper
Yeah maybe, but both b and B should basically be billed at max of their associated dates, which might affect the things that depend on B. So I don't think b can be dropped completely. On Thursday, May 15, 2014 11:30:35 PM UTC+2, David Pidcock wrote: If, say C cannot depend on any b directly,

Re: Propagating data through dependencies

2014-05-15 Thread Casper
Nice thanks, I didn't know propaganda. I am not sure if it applies to this problem, but it looks interesting so I'll have a look. On Friday, May 16, 2014 12:10:29 AM UTC+2, François Rey wrote: I'm not sure I totally understand your use case, but somehow it sounds like these libraries may be

clojurescript, sourcemaps, and debugging info

2014-05-15 Thread t x
Hi, * background: * I have clojurescript + lein cljsbuild auto working perfectly fine. * I have source maps working (when I click on a file in Chrome, it jumps me to the corresponding *.cljs file) * problem I am facing: * I like to name my modules: foo/public.cljs

Re: Save map contentns to external file?

2014-05-15 Thread Steven Jones
Thanks that gives me a few options. I am leaning towards the latter approach of registering the functions somewhere and then serializing the information needed to retrieve them. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this