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 functions which return assoc list. 

I could handle the task if the map values where always explicit list. My
real problem is how do I write out a Clojure function to an external
file and later reconstruct it? Ideally the file would be pure text but
that's not an absolute requirement.  Are there any standard methods for
doing such a thing? 


Thanks 

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 ...) with:

(defn add-entry [log entry]
  (send log conj entry))

You can keep the receive and transmit functions unchanged, but the dotimes
block should be changed by something along the lines of:

(let [t1 (Thread. (fn [] (dotimes [_ 10] (transmit async-log writer socket
request
t2 (Thread. (fn [] (dotimes [_ 10] (receive async-log reader socket]
  (.start t1) (.start t2)
  (.join t1) (.join t2))

dosync is for refs (the ones created with (ref ...), not references in
the general sense), and delimits a transaction in which all refs are
updated atomically (so refs are mainly useful when you want to update
multiple mutable references at the same time).

send-off is only useful if you're doing a blocking operation within the
function that handles the agent.

I must admit I have no idea how the given code can yield inconsistent
results. Does anyone know if agents, like refs, call the given functions
speculatively? It would seem strange if an agent did not serialize the
functions you send it.



On Thursday, 15 May 2014, Dylan Gleason dgleason8...@gmail.com wrote:

 I have a TCP socket connection in which I need to process several requests
 and conj each request and it's corresponding response to a vector for
 logging purposes. I need to transmit and receive via two asynchronous
 threads, where a transmit function is responsible for sending requests
 and a receive function is responsible for receiving responses from a
 server.

 My understanding is that for asynchronous transmission, I need to use
 agent in Clojure to accomplish this. However, I also need to ensure
 serial access to the vector, since both threads are trying to modify it at
 any given time.

 I tried to get something working, but my agent ends up in a failed state
 after making a few requests and processing a few responses. Below is the
 code showing what I am attempting to do. If anyone could give me some
 guidance, it would be greatly appreciated.

 ;; the shared resource


 (def async-log (agent []))


 ;; I thought this needed to be synchronized for serial access, so I
 used

 ;; dosync, but I am not sure if this is right. In any case, it doesn't

 ;; seem to make a difference


 (defn add-entry

   [coll entry]

   (dosync (conj coll entry)))


 ;; transmit function


 (defn transmit

   [log writer socket request]

   (let [request   (request-String request socket)

 bytes-out (request-bytes request)

 length(count bytes-out)]

 (.writeShort writer length)

 (.write writer bytes-out 0 length)

 (add-entry log request)))


 ;; Receive function


 (defn receive

   [log reader socket]

   (let [length   (read-length reader)

 bytes-in (byte-array request/max-message-size)]

 (.read reader bytes-in 0 length)

 (add-entry log (to-string bytes-in


 ;; process each request, n times


 (defn process-requests

   [request socket iters]

   (with-open [reader (DataInputStream. (.getInputStream socket))

   writer (DataOutputStream. (.getOutputStream socket))]

 (dotimes [x iters]

   (send-off async-log transmit writer socket request)

   (send-off async-log receive reader socket)

   (Thread/sleep 50

 --
 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 that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit 

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 12:04:25 AM UTC-7, Gary Verhaegen wrote:

 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 ...) with:

 (defn add-entry [log entry]
   (send log conj entry))

 You can keep the receive and transmit functions unchanged, but the dotimes 
 block should be changed by something along the lines of:

 (let [t1 (Thread. (fn [] (dotimes [_ 10] (transmit async-log writer socket 
 request
 t2 (Thread. (fn [] (dotimes [_ 10] (receive async-log reader 
 socket]
   (.start t1) (.start t2)
   (.join t1) (.join t2))

 dosync is for refs (the ones created with (ref ...), not references in 
 the general sense), and delimits a transaction in which all refs are 
 updated atomically (so refs are mainly useful when you want to update 
 multiple mutable references at the same time).

 send-off is only useful if you're doing a blocking operation within the 
 function that handles the agent.

 I must admit I have no idea how the given code can yield inconsistent 
 results. Does anyone know if agents, like refs, call the given functions 
 speculatively? It would seem strange if an agent did not serialize the 
 functions you send it.



 On Thursday, 15 May 2014, Dylan Gleason dgleas...@gmail.com javascript: 
 wrote:

 I have a TCP socket connection in which I need to process several requests 
 and conj each request and it's corresponding response to a vector for 
 logging purposes. I need to transmit and receive via two asynchronous 
 threads, where a transmit function is responsible for sending requests 
 and a receive function is responsible for receiving responses from a 
 server.

 My understanding is that for asynchronous transmission, I need to use 
 agent in Clojure to accomplish this. However, I also need to ensure 
 serial access to the vector, since both threads are trying to modify it at 
 any given time.

 I tried to get something working, but my agent ends up in a failed state 
 after making a few requests and processing a few responses. Below is the 
 code showing what I am attempting to do. If anyone could give me some 
 guidance, it would be greatly appreciated.

 ;; the shared resource


 (def async-log (agent []))


 ;; I thought this needed to be synchronized for serial access, so I 
 used 

 ;; dosync, but I am not sure if this is right. In any case, it 
 doesn't 

 ;; seem to make a difference


 (defn add-entry

   [coll entry]

   (dosync (conj coll entry)))


 ;; transmit function


 (defn transmit

   [log writer socket request]

   (let [request   (request-String request socket)

 bytes-out (request-bytes request)

 length(count bytes-out)]

 (.writeShort writer length)

 (.write writer bytes-out 0 length)

 (add-entry log request)))


 ;; Receive function


 (defn receive

   [log reader socket]

   (let [length   (read-length reader)

 bytes-in (byte-array request/max-message-size)]

 (.read reader bytes-in 0 length)

 (add-entry log (to-string bytes-in


  ;; process each request, n times


 (defn process-requests

   [request socket iters]

   (with-open [reader (DataInputStream. (.getInputStream socket))

   writer (DataOutputStream. (.getOutputStream socket))]

 (dotimes [x iters]

   (send-off async-log transmit writer socket request)

   (send-off async-log receive reader socket)

   (Thread/sleep 50

 -- 
 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 that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

  

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To 

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 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 functions which return assoc list.

 I could handle the task if the map values where always explicit list. My
 real problem is how do I write out a Clojure function to an external
 file and later reconstruct it? Ideally the file would be pure text but
 that's not an absolute requirement.  Are there any standard methods for
 doing such a thing?


 Thanks

 --
 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 that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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: 
http://vijaykiran.com/2012/02/web-application-development-with-clojure-part-5/ 
woks well so far!



 




Am Dienstag, 13. Mai 2014 14:18:32 UTC+2 schrieb Ivan Schuetz:

 Hi,

 I'm new to Clojure and have little experience with api development. I'm 
 looking for a way to implement REST api authentication. As far I 
 understand, the best way to do this is using an authentication token. The 
 goal is use this for mobile apps.

 I would prefer to avoid sending the login data in each request, since this 
 would mean I have to store the password in the app. This is unwanted.


 I have looked in the available options for authentication in Clojure, but 
 no one seems to provide a complete method to do this. I started with Friend 
 - thanks to help I got in this 
 threadhttps://groups.google.com/forum/#!topic/clojure/A4O0lWHtqVI I 
 was able to implement a service to login a user via JSON. I see the 
 credentials function returns me an identity id - which so far I understand, 
 is what the client would use to identify subsequent requests. I printed 
 this identity, it looks like this:

 {:cemerick.friend/identity {:current user1, :authentications {user1 
 {:identity user1, :username user1

 I assume I can provide a custom function to generate a token instead and 
 insert it in the headers of the response...

 Now I need to insert this in subsequent requests and check it using a new 
 middleware? I came across this 
 onehttps://github.com/jstewart/ring-token-authentication which 
 would do this. Probably, since I'm using Friend, I could implement it as a 
 workflow instead, which checks the headers, and if the token is correct 
 passes control to the handler, otherwise returns an error (via JSON).


 This just looks very cumbersome to me and I wonder if I'm missing the 
 correct way to do it, or isn't there a complete solution for REST 
 authentication yet...? Also some things missing about my solution, like the 
 TTL of this token, how I generate it, security aspects, etc...

 I would appreciate pointing me in the right direction, how this is 
 typically done in Clojure, etc.


 Thanks in advance!


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 way to stick a DOI (
http://en.wikipedia.org/wiki/Digital_object_identifier )
to a repository:

https://github.com/blog/1840-improving-github-for-science

it was on HN, https://news.ycombinator.com/item?id=7744735 .

Cheers,
GGhh

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 DOI (
 http://en.wikipedia.org/wiki/Digital_object_identifier )
 to a repository:

 https://github.com/blog/1840-improving-github-for-science

 it was on HN, https://news.ycombinator.com/item?id=7744735 .



Again, based on the dubious ID that an DOI makes things citable.

A URL is already citable!

Phil

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 :socket socket :count 
 util/max-message-size}]*
 *(log info)*
 *(.read reader bytes-in 0 util/max-message-size)*
 *bytes-in))*

 
Inputstream#read will not necessarily read all bytes from an input stream. 
See 
http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html#read(byte[], 
int, int) 

This question on SO might 
help: 
https://stackoverflow.com/questions/23018870/how-to-read-a-whole-binary-file-nippy-into-byte-array-in-clojure

-billy.

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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, but now it is failing. The problem is that I get a
file full of clojure.lang.LazySeq@ lines. The problem comes from LazySeq
directly, as this demonstration with range shows.

user (str (list 1 2 3 4 5 ))
(1 2 3 4 5)
user (str (range 4))
clojure.lang.LazySeq@e1b83
user (println (range 4))
(0 1 2 3)
nil


println is using prn and a multimethod to print out. In fact,
clojure.lang.LazySeq doesn't implement toString, nor does it's super class.

The best solution that I have come up with so far is to do

(str (apply list (range 4)))

I guess I can see why LazySeq doesn't implement toString by printing
everything out, but is there a better way around my problem?

Phil

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 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, but now it is failing. The problem is that I get a
 file full of clojure.lang.LazySeq@ lines. The problem comes from LazySeq
 directly, as this demonstration with range shows.

 user (str (list 1 2 3 4 5 ))
 (1 2 3 4 5)
 user (str (range 4))
 clojure.lang.LazySeq@e1b83
 user (println (range 4))
 (0 1 2 3)
 nil


 println is using prn and a multimethod to print out. In fact,
 clojure.lang.LazySeq doesn't implement toString, nor does it's super class.

 The best solution that I have come up with so far is to do

 (str (apply list (range 4)))

 I guess I can see why LazySeq doesn't implement toString by printing
 everything out, but is there a better way around my problem?

 Phil

 --
 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 that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 - C 
D

(B is depending on A, C is depending on B, D has no dependencies)

There might also be a required service or product for the above, lets 
denote them by lower case letters, which should be available at the same 
time or before the main product, and it cannot be billed after. It could be 
a modem for an internet connection.

Finally there might be a fee, lets call them fX e.g. fA if it is a fee for 
A. These should be billed at the same time as the main product but can be 
billed after.

So when you bill the customer you want to make sure that the product and 
the products it depends on are usable, delivered, provisioned (or whatever 
the case). For this we calculate a date from which we bill the customer for 
each of the products based on the date he requested the product.

So the customer might have placed the following order:

Product | Req. date | Bill date (calculated)

A   | 3 | 3
fA  | 3 | 3
B   | 2 | 4
b   | 4 | 4
C   | 1 | 4
fC  | 1 | 4
D   | 1 | 1

B and C are bumped to time 3, because they depend on A (B directly, C 
indirectly) while D stays at 1 because it has no dependencies. However 
because b was only available at 4 (maybe due being out of stock), B and 
therefore C and fC are bumped to 4

What we are currently doing is looking at this as a tree of dependencies 
and transfer the dates from the dependencies to the product if the date is 
bigger (done per product in topological order to get the right 
propagation). The problem here are the required services that need to be 
able to bump the date of the main product but also not be billed after, 
this is modeled as B - b and then having a post action to bump b up to B 
if it was before (but this feels like a hack). There cannot be a dependency 
in both directions as the topological order then cannot be found due to a 
circular dependency.

(I hope this is making sense, I am finding it a bit hard to explain)

So my question is, what other approaches are there? 

The ones that come to mind are:
 - core.logic, however I can't figure out how to get propagation through 
multiple dependencies.
 - rule engine of some sort, like clara-rules, but again can't get the 
propagation going.

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 
explore other ways to write these generators.

Best,
Reid

On Wednesday, May 14, 2014 12:13:14 PM UTC-5, miner wrote:


 On May 14, 2014, at 10:44 AM, Reid Draper reidd...@gmail.comjavascript: 
 wrote: 
  * Limit the number of retries for gen/such-that. A two-arity version 
 is 
provided if you need to retry more than 10 times. This should be a 
code-smell, though. 

 I think the limit is a good idea, but it's an extra wrinkle and maybe too 
 tight. 

 I had a such-that that failed due to the new limit.  Unfortunately, the 
 error message didn't help much in tracking it down.  I ended up changing 
 all my such-that calls to use a unique number of retries so I could figure 
 which one was failing. 

 I suppose my situation is unusual in that I generate generators and tests 
 from schemas and data.  The stack traces aren't very pretty when there are 
 errors. 

 It might help if you added the 'pred' and 'tries' to the ex-info data in 
 such-that-helper.  Might as well put something in the ex-info data. 

 By the way, it turns out 25 was a sufficient number of retries for my 
 test.  Works fine now. 


 Steve Miner 



-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 3000}}.
Can you guess what the same command would produce given the second case?  

If you're like me, you wouldn't guess {:options {:port true}}. :-/
It is worth noting that in earlier versions of this library --port did 
result in {:options {:port 3000}}, so this is a change in behavior from 
previous versions.  


The current behavior is neither simple nor easy to understand, and 
complects the behavior of the flag with the definition of the long option.  

I suggest that this implicit behavior be removed and that all options be 
treated as required unless :required false is explicitly declared. 

Or perhaps there should be :boolean flag similar to :parse-fn or :default, 
since :required feels a little overloaded. 
That way given lein run -p 3000, [-p --port A port number] would 
result in {:options {:port 3000}} and 
[-p --port A port number :boolean true] would result in {:options 
{:port true}}.

That would make when a flag will be treated as a boolean explicit and 
obvious, and make this library a little less frustrating and foot-gunish.

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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:
http://blog.clojurewerkz.org/blog/2014/04/26/major-breaking-public-api-changes-coming-in-our-projects/

1. http://clojurecassandra.info
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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. I removed 
and reinstalled Java as well.

Has anyone else come across this? I have no clue what I did or what the 
problem could be. Any help would be greatly appreciated.

-bash-4.1$ java -version
java version 1.7.0_55
OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

-bash-4.1$ lein version
Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 project works fine on my macbook pro, and another CentOS box.

 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I removed
 and reinstalled Java as well.

 Has anyone else come across this? I have no clue what I did or what the
 problem could be. Any help would be greatly appreciated.

 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM

 --
 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 that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 mkw...@gmail.comjavascript:
  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 project works fine on my macbook pro, and another CentOS box.

 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I removed 
 and reinstalled Java as well.

 Has anyone else come across this? I have no clue what I did or what the 
 problem could be. Any help would be greatly appreciated.

 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM
  
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 
 code-smell if you need such-that to retry that many times. Happy to help 
 explore other ways to write these generators.

I'm generating generators from schemas [1].  I have generators for all my 
simple schemas -- int corresponds to gen/int, etc.  The tougher case is when 
I have to convert a conjunction of schema expressions into a generator.  For 
example, a schema (and int pos) specifies a positive integer, essentially like 
testing (fn [x] (and (integer? x) (pos? x)).  

My current implementation finds some element of the AND that I can map to a 
generator and uses such-that to filter against a predicate created from the 
rest of the AND elements.

A simple example does something like this...

(make-generator '(and int pos odd))
---  (gen/such-that (make-predicate '(and pos odd)) (make-generator 'int))
---  (gen/such-that (fn [x] (and (pos? x) (odd? x))) gen/int)

Of course, it would be better to use gen/s-pos-int.  I'm thinking that I need 
to look for a few common combinations of simple schemas, especially if there's 
already a good generator for those cases.

However, I still need to try to handle the general case, and it looks like the 
such-that approach will have to be my fallback position.  I'll probably give 
the user the option of adding custom generators to match more complicated 
schema expressions.

Now, if you could provide an efficient AND generator combinator, that would 
solve all my problems.  :-)

It occurs to me that automatically deriving generators is something like 
running a predicate backwards so maybe there's a way to do it with core.logic, 
but I haven't tried to do that yet.

I'd be happy to consider any suggestions.

Thanks,
Steve Miner


[1] https://github.com/miner/herbert


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 clean out ~/.lein/profiles.clj?
 
 
 On Thu, May 15, 2014 at 2:34 PM, Mark Watson mkw...@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 project works fine on my macbook pro, and another CentOS box.
 
 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I removed and 
 reinstalled Java as well.
 
 Has anyone else come across this? I have no clue what I did or what the 
 problem could be. Any help would be greatly appreciated.
 
 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
 
 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
 
 
 -- 
 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 that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: Message signed with OpenPGP using GPGMail


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.



 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 mkw...@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 project works fine on my macbook pro, and another CentOS box.

 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I 
 removed and reinstalled Java as well.

 Has anyone else come across this? I have no clue what I did or what the 
 problem could be. Any help would be greatly appreciated.

 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM

 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 despite the documentation that pr output is a readable format,
when I attempt to read it I get a runtime exception of Unreadable form 


(pr foo)
-- #core$foo edntest.core$foo@7dce092nil

#core$foo edntest.core$foo@7dce092
-- RuntimeException Unreadable form  clojure.lang.Util.runtimeException 
(Util.java:219)



Any help greatly appreciated. 



-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 May 2014, at 20:56, Mark Watson mkw...@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 clean out ~/.lein/profiles.clj?


 On Thu, May 15, 2014 at 2:34 PM, Mark Watson mkw...@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 project works fine on my macbook pro, and another CentOS box.

 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I
 removed and reinstalled Java as well.

 Has anyone else come across this? I have no clue what I did or what the
 problem could be. Any help would be greatly appreciated.

 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


  --
 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 that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 some 
memory has fixed it for me.

On Thursday, May 15, 2014 11:34:36 AM UTC-7, Mark Watson 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 project works fine on my macbook pro, and another CentOS box.

 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I removed 
 and reinstalled Java as well.

 Has anyone else come across this? I have no clue what I did or what the 
 problem could be. Any help would be greatly appreciated.

 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 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 some
 memory has fixed it for me.


 On Thursday, May 15, 2014 11:34:36 AM UTC-7, Mark Watson 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 project works fine on my macbook pro, and another CentOS box.

 I deleted ~/.m2 and reinstalled Leiningen. I updated Leiningen. I removed
 and reinstalled Java as well.

 Has anyone else come across this? I have no clue what I did or what the
 problem could be. Any help would be greatly appreciated.

 -bash-4.1$ java -version
 java version 1.7.0_55
 OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
 OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

 -bash-4.1$ lein version
 Leiningen 2.3.4 on Java 1.7.0_55 OpenJDK 64-Bit Server VM

  --
 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 that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 pr. It returns a string containing the text representing 
data.

 Second despite the documentation that pr output is a readable format,
 when I attempt to read it I get a runtime exception of Unreadable form 
 
 
 (pr foo)
 -- #core$foo edntest.core$foo@7dce092nil
 
 #core$foo edntest.core$foo@7dce092
 -- RuntimeException Unreadable form  clojure.lang.Util.runtimeException 
 (Util.java:219)


There is no built-in way to access an existing function value as readable data. 
Searching the google group history for serializable function yields some 
discussion of the issues involved.

If you have access to the code for the function at the time it's being loaded 
into clojure (read and compiled), you can write code to capture the text of the 
function definition from there.  This lib woks along those lines and might be 
useful to you: https://github.com/technomancy/serializable-fn/

You may also want to consider another representation for function values, 
something like registering them by name and serializing the name could work. It 
depends on how much control you have over the environment around serializing 
and deserializing and how general the capabilities of the serialized code need 
to be.

--Steve

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 the 
duration for each edge may not gain you anything compared to your current 
solution. 
If it ain't broke ...

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 b's and just bundle them 
into the bill for B when you generate it.

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 well). 

The problem is that the way I am currently solving it, by propagating dates 
from dependencies, can only have a dependency in one direction. So if b is 
2 and B is 1 I want B to be bumped to 2, but if b is 1 and B is 2 i want b 
to be bumped to 2 - the current solution can only support one of the two 
though, so I do the first in the main propagation and after that have a 
post action to bump all required services (lower case) to the date of their 
main product (upper case). 

This is actually what makes me want to look for another solution. Not so 
much because I want to replace the current implementation, (it works fine), 
but because I feel like there is something to be learned here for me.









 

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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, (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 b's and just bundle 
 them into the bill for B when you generate it.


-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 of interest to you:
 propaganda https://github.com/tgk/propaganda
 prismatic 
 graphhttps://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fprismatic%2Fplumbingsa=Dsntz=1usg=AFQjCNF0UDUdf_emNVKQOLkFfvSo0aKoLA

 

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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
foo/other-stuff.cljs

bar/public.cljs
bar/other-stuff.cljs

  Now, Chrome + clojurescript (not sure who is at fault) appears to
display not the _full name_, but only the _last part of the pathname_,
so I get a bunch of lines saying things like:

   public.cljs:23
   public.cljs:68

  and I have no idea whether it's foo/public.cljs or bar/public.cljs
without clicking on it.


* question:

  Is there anyway to get Chrome / clojurescript to display the full
name of the *.cljs file rather than just the last part?

Thanks!

-- 
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 that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.