Re: System calls

2010-08-06 Thread Adrian Cuthbertson
> :) (inc ":)") On Sat, Aug 7, 2010 at 7:27 AM, Meikel Brandmeyer wrote: > Hi, > > Am 07.08.2010 um 05:06 schrieb j-g-faustus: > >> I don't think there's a direct way to create a String array in Clojure > > (defn to-env >  [env-vars-map] >  (->> env-vars-map >    (map #(str (name (key %)) "=" (

Re: System calls

2010-08-06 Thread Meikel Brandmeyer
Hi, Am 07.08.2010 um 05:06 schrieb j-g-faustus: > I don't think there's a direct way to create a String array in Clojure (defn to-env [env-vars-map] (->> env-vars-map (map #(str (name (key %)) "=" (val %))) into-array)) And an invocation: user=> (to-env {:PATH "/bin:/usr/bin" :HOME

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 7, 5:06 am, j-g-faustus wrote: > I don't think there's a direct way to create a String array > in Clojure Correction - there is: (into-array String ["a" "b"]) jf -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 6, 11:50 pm, Dave wrote: > I get the error: > > Cannot run program "pdb_to_xyzr": error=2, No such file or directory >   [Thrown class java.io.IOException] You may have a path problem. Try running "env" in the same fashion - I get a very basic path (just "/bin" and "/usr/bin") and none of

lein-daemon problems

2010-08-06 Thread Mark Rathwell
Anyone using lein-deamon and have success getting it working? When trying to start a daemon with 'lein daemon start daemon-name', I'm getting java.lang.IllegalArgumentException: No matching method: with-bindings (daemonProxy.clj:27). The entire error log is at http://gist.github.com/512327. I get

Re: thread running throwing error java.lang.Thread cannot be cast to clojure.lang.IFn

2010-08-06 Thread foop1
Aha! i see what you are saying thank you for pointing the real subtleness of the way command is return, this group is really excellent and awesome in helpfullness On Aug 6, 11:51 am, Armando Blancas wrote: > In addition to that, prnTime should have no parens: > #(on-thread prnTime) > > As it was,

Clojure 1.2 RC2

2010-08-06 Thread Stuart Halloway
Clojure 1.2 RC 2 is now available, along with a corresponding Clojure Contrib, at: http://clojure.org/downloads There is one important change since RC1. Record/map equality is now symmetric in all cases. There are two variants: * In most cases, you should use =. Calls to = include ty

Re: System calls

2010-08-06 Thread Dave
Also, this only shows the 2nd call (with ls-arg2): (defn test-execute [ls-arg1 ls-arg2] (execute (str "ls -" ls-arg1)) (execute (str "ls -" ls-arg2))) so maybe the difficulty above is some problem with how the multiple system calls are performed. If I only use this: (defn get-msms-pts-OSX

Re: Slightly Off Topic: .NET books

2010-08-06 Thread Mark Rathwell
+1 for: _The C# Programming Language, 3rd Edition_ by Anders Hejlsberg, Mads Torgersen, Scott Wiltamuth, and Peter Golde Pretty decent book, but I'm not sure if it's been updated since 2.0 (a lot of cool stuff came in 3.0 and 4.0 [LINQ, implicit type (inference), initializers, extension methods,

System calls

2010-08-06 Thread Dave
I having some trouble with system calls using clojure (actually a whole lot more than that but this is the current day's difficulty). Below, test-execute works, but get-msms-pts-OSX seems to hang, as in nothing happens and the REPL is unresponsive afterwards. If I run the output of the (str **

Re: Slightly Off Topic: .NET books

2010-08-06 Thread dmiller
We have a ten-week program for experienced developers moving to the .NET platform. Our recommended text is Troelson's "Pro C# 2010 and the .NET 4 Platform, Fifth Edition". http://www.apress.com/book/view/1430225491 All 1752 pages of it. It has a lot of things you won't need for understanding

Re: Slightly Off Topic: .NET books

2010-08-06 Thread Dan Moniz
On Fri, 06 Aug 2010 08:33 -0700, "Sean Devlin" wrote: > Are there any good .NET books you guys could recommend? I'm looking > for a range of resources. I don't need "C# in 21 days" or "C# for > dummies", but something an experienced Java hacker could start out > with, similar to Core Java. Als

eval and threads...

2010-08-06 Thread Jules
I have a server which loads some compiled classes/functions then starts accepting requests and handing them off onto a thread pool for processing. No problem - so far... One of the requests allows the passing and evaluation of an arbitrary piece of clojure. This is causing me to lose hair ! The

Re: (java.io BufferedReader FileReader) versus [clojure.contrib.duck-streams :only (read-lines)]

2010-08-06 Thread Dave
Awesome! Thank you so much for your help -- I really appreciate it. On Aug 6, 12:43 pm, Nikita Beloglazov wrote: > Hi Dave, > There are really 2 functions, -> and ->> > First -> > Sometimes you need to perform several functions on after another. You can > write something like > (func1 (func2 (fu

Re: (java.io BufferedReader FileReader) versus [clojure.contrib.duck-streams :only (read-lines)]

2010-08-06 Thread Nikita Beloglazov
Hi Dave, There are really 2 functions, -> and ->> First -> Sometimes you need to perform several functions on after another. You can write something like (func1 (func2 (func3 value))) But you also can write like: (-> value (func3) (func2) (func1)) It takes value, insert it into (func1) form a

Re: (java.io BufferedReader FileReader) versus [clojure.contrib.duck-streams :only (read-lines)]

2010-08-06 Thread Dave
Hi Nikita, Your function works! Could you explain the "->>" a bit? Thanks, - Dave On Aug 5, 5:53 pm, Nikita Beloglazov wrote: > See my variant of your > application:https://gist.github.com/efdb66487e899446332f > I don't know if it works, because I can't test :( > > My thoughts about your exam

Re: thread running throwing error java.lang.Thread cannot be cast to clojure.lang.IFn

2010-08-06 Thread Armando Blancas
In addition to that, prnTime should have no parens: #(on-thread prnTime) As it was, prnTime was running before going into on-thread, which was acting on a runnable that's nil (the return value of prn). The difference between the two can be seen in the output. When prnTime runs inside the threads,

Slightly Off Topic: .NET books

2010-08-06 Thread Sean Devlin
Are there any good .NET books you guys could recommend? I'm looking for a range of resources. I don't need "C# in 21 days" or "C# for dummies", but something an experienced Java hacker could start out with, similar to Core Java. Also, a more advanced book so I could learn to follow the ClojureCL

Re: thread running throwing error java.lang.Thread cannot be cast to clojure.lang.IFn

2010-08-06 Thread Nikita Beloglazov
What do you mean "close threads"? As I know threads aren't supposed to be closed. There is no mechanism to do this. They are not connections or smth like that. On Fri, Aug 6, 2010 at 3:46 PM, foop1 wrote: > thank you for the reply, is there any way to close this 4 threads > after the job is done

Re: thread running throwing error java.lang.Thread cannot be cast to clojure.lang.IFn

2010-08-06 Thread foop1
thank you for the reply, is there any way to close this 4 threads after the job is done? On Aug 6, 8:34 am, Nikita Beloglazov wrote: > Hi, foop > Your error in this line: > (r4t (on-thread (prnTime))) > You pass to function r4t thread instead of functions. Because > (on-thread (prnTime)) returns

Re: thread running throwing error java.lang.Thread cannot be cast to clojure.lang.IFn

2010-08-06 Thread Nikita Beloglazov
Hi, foop Your error in this line: (r4t (on-thread (prnTime))) You pass to function r4t thread instead of functions. Because (on-thread (prnTime)) returns thread You must pass #(on-thread (prnTime)) instead Regards, Nikita Beloglazov On Fri, Aug 6, 2010 at 3:13 PM, foop1 wrote: > Hi, > > Iam try

thread running throwing error java.lang.Thread cannot be cast to clojure.lang.IFn

2010-08-06 Thread foop1
Hi, Iam trying to run a function in a thread assuming that threads are runnable, below is my program i want to print 4 time the current date (defn- on-thread [f] (doto (Thread. #^Runnable f) (.start))) (defn prnTime [] (prn (System/currentTimeMillis))) (defn r4t [f] (d