Re: ClojureCLR updated

2009-06-01 Thread Johan Berntsson
On Jun 2, 6:51 am, David Miller wrote: > I've watched Mono for a long time, but haven't dived in.  I guess now > is the time. Would be great. I'm very excited about ClojureCLR, but won't be able to use it until it runs on Linux and isn't tightly bound to a specific IDE. /Johan --~--~-~

"run" macro for "executable namespaces"

2009-06-01 Thread Stephen C. Gilardi
Here's a macro I've found useful for loading and running Clojure programs from the REPL: (defmacro run "Loads the specified namespace and invokes its \"main\" function with optional args. ns-name is not evaluated." [ns-name & args] `(do (require '~ns-name :reload-all)

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
Sorry to keep bumping my own post, but I'm becoming very convinced that this is an issue with the 1.5 JVM on PPC OS X. I've been sending very large datasets though on various workstations, and the program behaves perfectly. At this point, I'm going to concentrate on getting this project ready for

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
Code pasted like crap for some reason. You can see it here: http://pastebin.com/f736205f2 On Jun 1, 10:05 pm, tmountain wrote: > I took your advice and pulled my streams up front. This did seem to > offer a small performance benefit, but the issue persists. I've > greatly simplified the reader f

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
I took your advice and pulled my streams up front. This did seem to offer a small performance benefit, but the issue persists. I've greatly simplified the reader function to ensure that there's nothing stupid going on there causing the erratic behavior. (defn connection-read [#^DataInputStream co

Spider with clojure

2009-06-01 Thread sasa
Hey guys, just reading through the book (http://pragprog.com/titles/shcloj/ programming-clojure) and having a lot of of fun learning. I was wondering if there are any examples out there like Dave Thomas' A First Erlang Program http://pragdave.pragprog.com/pragdave/2007/04/a_first_erlang_.html i

Destructuring bind uses nthnext not nthrest

2009-06-01 Thread Sudish Joseph
Hi, I just wanted to point out that the docs (http://clojure.org/ special_forms#let ) say that destructuring uses nthrest, when it uses nthnext in the sources; probably leftover from before the lazier sequences changes. Out of curiosity, does it make sense to have fully lazy destructuring? It

Re: ClojureCLR updated

2009-06-01 Thread David Miller
Getting rid of the vjslib dependency is on the todo list. I started looking at it yesterday. I was going to switch to the Microsoft.Scripting.Math.BigInteger class that comes with the DLR and then implement a BigDecimal on top of that. However, there are some missing pieces for our needs, and t

Re: ClojureCLR updated

2009-06-01 Thread Shawn Hoover
On Mon, Jun 1, 2009 at 4:15 PM, Konrad Hinsen wrote: > > On 01.06.2009, at 19:57, David Miller wrote: > > > :> It'd be much easier to play with if you provide a precompiled > > :> executable :) > > > > I thought about that. Adding assembilies of my code as a download is > > easy enough. However

Re: ClojureCLR updated

2009-06-01 Thread Konrad Hinsen
On 01.06.2009, at 19:57, David Miller wrote: > :> It'd be much easier to play with if you provide a precompiled > :> executable :) > > I thought about that. Adding assembilies of my code as a download is > easy enough. However, to get the thing running, you also need vjslib > from the J# Redis

Re: Using (into {} ...) on a sequence of lists vs. vectors

2009-06-01 Thread Timothy Pratley
user=> (apply hash-map a) {:a 1} might help get around it? On Jun 2, 3:39 am, samppi wrote: > Why does using a list with into and a map throw an exception, while > using a vector is fine? > > Clojure 1.0.0- > user=> (def a (list :a 1)) > #'user/a > user=> (into {} [a]) > java.lang.ClassCastExcep

Re: Weird Issue Reading Socket

2009-06-01 Thread Christopher Wilson
I don't know how relevant this is to what you're trying to do, but I've recently written something that sounds like what you're doing. My approach was to always send the size of the file (this involves sending chunks of a file around) to the server before sending the file. Since read() will block

Re: ClojureCLR updated

2009-06-01 Thread David Miller
:>> Proxying and genclass haven't been attempted yet. :> Can you guess how long they should take to implement? Probably not too long. I cannot do a straight conversion of core_proxy.clj and genclass.clj as I did with other bootstrap files -- the code is heavily dependent on the ASM bytcode libra

Re: Using (into {} ...) on a sequence of lists vs. vectors

2009-06-01 Thread Kevin Downey
two element vectors implement MapEntry, (into {} x) x needs to be something that seq can be called on and will return a seq of MapEntrys On Mon, Jun 1, 2009 at 10:39 AM, samppi wrote: > > Why does using a list with into and a map throw an exception, while > using a vector is fine? > > Clojure 1

Using (into {} ...) on a sequence of lists vs. vectors

2009-06-01 Thread samppi
Why does using a list with into and a map throw an exception, while using a vector is fine? Clojure 1.0.0- user=> (def a (list :a 1)) #'user/a user=> (into {} [a]) java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry (NO_SOURCE_FILE:0) user=> (def b [:a 1]) #'u

Agents, keepalive, and hanging -main / compilation

2009-06-01 Thread Chas Emerick
There has been intermittent chatter over the past months from a couple of people on the group (e.g. http://groups.google.com/group/clojure/browse_thread/thread/409054e3542adc1f) and in #clojure about some clojure scripts hanging, either for a constant time (usually reported as a minute or

Reminder: Bay Area Clojure User Group meeting in SF during JavaOne (6/3) with Rich Hickey

2009-06-01 Thread Tom Faulhaber
I just wanted to remind everyone who might be in the Bay Area this week that we're having a Clojure focused get together with Rich Hickey. It's shaping up to be an exciting meeting with some good work to show off, etc. I also want to remind you that, if you're going to come, you need to RSVP on t

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
I'm not sure if that's related to the problem either, but it may very well improve performance. Thanks for the suggestion. I will try opening the streams ahead of time and see where that takes me. On Jun 1, 10:20 am, MikeM wrote: > I don't know if this is part of the problem, but you appear to b

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
No, it does not call flush. Should I call it everytime a write is performed? If so, will this have a negative impact on performance? Even if it does, it seems calling flush may be unavoidable? (defn connection-write [#^Socket conn #^bytes data] "writes data to the specified socket" (let [#^Ou

Re: syntax-quote asymmetry

2009-06-01 Thread Rock
I'm sorry. A small correction regarding the last post: A simple question (especially for Rich): why not simply make `(x1 x2 x3 ... xn) expand to (clojure.core/apply clojure.core/list (clojure.core/seq (clojure.core/ concat |x1| |x2| |x

syntax-quote asymmetry

2009-06-01 Thread Rock
I've been working on the Wiki lately and I'm stuck on the part about syntax-quotes (that I had already written) which required some updating. There have been some changes (linked to fully lazy sequences I suppose) with the way syntax-quotes are expanded. It used to work like this: -

Re: What is wrong with my code

2009-06-01 Thread Daniel Lyons
On Jun 1, 2009, at 4:55 AM, Emeka wrote: > This gives you the link to the whole code. > http://friendpaste.com/C3xbF1r3F3Mehnn8CCBUm > . It is still not cleaned..pretty ugly, I am ashamed to show it > off at all :) Thanks, and you should be! :) Of course the only way to get better is to

Re: Weird Issue Reading Socket

2009-06-01 Thread Timothy Pratley
Great! That largely indicates that we are reading the right amount of data. So I'm thinking (connection-write) doesn't call flush? On Jun 1, 11:30 pm, tmountain wrote: > You're correct. Debugging with print statements shows that the > otherwise clause is never being reached. That being said, si

Re: Weird Issue Reading Socket

2009-06-01 Thread MikeM
I don't know if this is part of the problem, but you appear to be calling getInputStream repeatedly on the socket. I think more typically the socket connnection is established, input and output streams are obtained one time only, then the streams are used as needed for the duration of the connecti

Re: Weird Issue Reading Socket

2009-06-01 Thread Michael Wood
On Mon, Jun 1, 2009 at 3:30 PM, tmountain wrote: > > You're correct. Debugging with print statements shows that the > otherwise clause is never being reached. That being said, simply > inserting a Thread.sleep(0) before the data is returned makes the > program behave properly. If I remove that sl

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
You're correct. Debugging with print statements shows that the otherwise clause is never being reached. That being said, simply inserting a Thread.sleep(0) before the data is returned makes the program behave properly. If I remove that sleep, the client gives back a malformed packet response. It s

Feedback on clipboard library

2009-06-01 Thread Sean Devlin
Hello Everyone, I've created a library for interacting with the clipboard. It's a wrapper for the AWT clipboard library.You can find it here: http://github.com/francoisdevlin/devlinsf-clojure-utils/tree/master *Note - I changed the location of my string library for anyone following that. =

Re: Weird Issue Reading Socket

2009-06-01 Thread Timothy Pratley
Hi Travis, Indeed. I re-read your code and think I have a clearer understanding of your intent now: You have an open TCP connection down which 'messages' are being sent which are prefaced by 'data length'. The 'messages' should be handled one at a time. So regardless of the maths ; oth

Re: Weird Issue Reading Socket

2009-06-01 Thread tmountain
Thanks for the response. You are correct that there are issues with the subtle maths in the "otherwise" portion of the code. I fixed that issue, and it improved the situation somewhat; however, I was still forced to insert a Thread.sleep inside of connection-read to get predictable results. This p

Re: clojure.contrib.miglayout improved, + new old example

2009-06-01 Thread AlamedaMike
Thanks for contributing this. It will definitely shorten my learning curve with Mig. On May 31, 12:49 am, "Stephen C. Gilardi" wrote: > MiGLayout is a nice layout manager that works with Swing.   > clojure.contrib.miglayout provides a Clojure interface for it. > > I've enhanced clojure.contrib.

Re: What is wrong with my code

2009-06-01 Thread Emeka
Dan and Tim, This gives you the link to the whole code. http://friendpaste.com/C3xbF1r3F3Mehnn8CCBUm. It is still not cleaned..pretty ugly, I am ashamed to show it off at all :) Regards, Emeka On Mon, Jun 1, 2009 at 7:50 AM, Timothy Pratley wrote: > > I agree, chang is most likely not bei

Re: Clojure Book example that has unexpected effect in trunk version of Clojure

2009-06-01 Thread Alen Ribic
For compile errors, all I see is the Stack trace in a new buffer and then when I hit 0, I'm back in my slime-repl buffer as usual. On Mon, Jun 1, 2009 at 10:19 AM, Mark Engelberg wrote: > > What happens to compile errors once you make that change.  Do they end > up in the REPL too? > > > > --~-

Re: Clojure Book example that has unexpected effect in trunk version of Clojure

2009-06-01 Thread Mark Engelberg
What happens to compile errors once you make that change. Do they end up in the REPL too? --~--~-~--~~~---~--~~ 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

Re: Clojure Book example that has unexpected effect in trunk version of Clojure

2009-06-01 Thread Alen Ribic
Thanks Mark. I can confirm that the slime function slime-redirect-inferior-output fixed the problem. Now I see the expected output from the new thread within the same slime buffer. -Alen On Sun, May 31, 2009 at 9:28 PM, Stephen C. Gilardi wrote: > > On May 31, 2009, at 1:00 PM, Mark Engelberg

Re: What is wrong with my code

2009-06-01 Thread Timothy Pratley
I agree, chang is most likely not being passed a ref, specifically the part that does: row-dev (eval (get-next-row inc (first val))) (chang row-dev keyword-dev-right (@alon key)) Looks to me like row-dev is not a ref, but I can't tell for sure! On Jun 1, 4:36 am, Daniel Lyons

Re: Weird Issue Reading Socket

2009-06-01 Thread Timothy Pratley
Hi Travis, connection-read appears to be subtlety wrong. If all the bytes are ready to be read then it is correct, but if only some are read it is incorrect. Now in the large data scenario the latter will appear if there are no delays. Inserting a sleep delays the program per packet such that the