Re: printf output from threads

2010-12-26 Thread Alex Osborne
justinhj writes: > I tried passing *out* to my thread function and then binding it to > *out* in the thread, and this works but then makes the threads execute > one at a time, and I'm presuming that is because my use of *out* in > the binding block is blocking for the other threads which use it.

Re: Knuth's literate programming "tangle" function in Clojure

2010-12-26 Thread Tim Daly
On 12/26/2010 8:33 PM, Robert McIntyre wrote: That's really cool. I was _just reading_ your comments from 2006 at http://www.mail-archive.com/gardeners@lispniks.com/msg01006.html and wondering about how hard something like this would be to write. If possible, could you expand on how one might

Re: Knuth's literate programming "tangle" function in Clojure

2010-12-26 Thread Tim Daly
On 12/26/2010 9:56 PM, Praki Prakash wrote: Tim, This approach is very interesting. My choice of mode for LP has always been noweb-mode but it doesn't seem to work with my version of emacs anymore. My current approach is to embed prose and clojure code in a latex document and generate a .te

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread David Nolen
On Sun, Dec 26, 2010 at 9:00 PM, Ken Wesson wrote: > On Sun, Dec 26, 2010 at 9:25 PM, Alex Osborne wrote: > > Ken Wesson writes: > > > >>> Actually you don't need to AOT compile records or types. They work fine > >>> for interactive development. > >> > >> Eh. That's not what I saw written elsew

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Ken Wesson
On Sun, Dec 26, 2010 at 10:00 PM, Ken Wesson wrote: > On Sun, Dec 26, 2010 at 9:25 PM, Alex Osborne wrote: >> Ken Wesson writes: >> Actually you don't need to AOT compile records or types. They work fine for interactive development. >>> >>> Eh. That's not what I saw written elsewhere.

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Ken Wesson
On Sun, Dec 26, 2010 at 9:25 PM, Alex Osborne wrote: > Ken Wesson writes: > >>> Actually you don't need to AOT compile records or types. They work fine >>> for interactive development. >> >> Eh. That's not what I saw written elsewhere. Or is it just protocols? >> Though usually those are used han

Re: Knuth's literate programming "tangle" function in Clojure

2010-12-26 Thread Praki Prakash
Tim, This approach is very interesting. My choice of mode for LP has always been noweb-mode but it doesn't seem to work with my version of emacs anymore. My current approach is to embed prose and clojure code in a latex document and generate a .tex file with formatted clojure code and .clj contain

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Alex Osborne
Ken Wesson writes: >> Actually you don't need to AOT compile records or types. They work fine >> for interactive development. > > Eh. That's not what I saw written elsewhere. Or is it just protocols? > Though usually those are used hand-in-hand with records. Perhaps you're thinking of gen-class?

Re: complex number performance enhancement...

2010-12-26 Thread Alex Osborne
Sunil S Nandihalli writes: > thanks Alex for your response . I tried it ... It compiled fine .. but the > double dispatch does not seem to work correctly .. > > It some how reverses the arguments and then dispatches to the correct > function for the reversed arguments and the function works prop

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Ken Wesson
On Sun, Dec 26, 2010 at 8:20 PM, Alex Osborne wrote: > Ken Wesson writes: > >> On Sun, Dec 26, 2010 at 7:18 PM, Alex Osborne wrote: > >>> Struct maps were in the language for a long time before defrecord was >>> added.  Records are supposed to replace them for most purposes.  So if >>> in doubt

Re: complex number performance enhancement...

2010-12-26 Thread Sunil S Nandihalli
thanks Alex for your response . I tried it ... It compiled fine .. but the double dispatch does not seem to work correctly .. It some how reverses the arguments and then dispatches to the correct function for the reversed arguments and the function works properly .. i.e. when I do (- (Complex. 1

Re: Knuth's literate programming "tangle" function in Clojure

2010-12-26 Thread Robert McIntyre
That's really cool. I was _just reading_ your comments from 2006 at http://www.mail-archive.com/gardeners@lispniks.com/msg01006.html and wondering about how hard something like this would be to write. If possible, could you expand on how one might use this in a development work-flow with emacs or

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Alex Osborne
Ken Wesson writes: > On Sun, Dec 26, 2010 at 7:18 PM, Alex Osborne wrote: >> Struct maps were in the language for a long time before defrecord was >> added.  Records are supposed to replace them for most purposes.  So if >> in doubt between the two use a defrecord. > > Isn't one advantage of st

Re: complex number performance enhancement...

2010-12-26 Thread Alex Osborne
Sunil S Nandihalli writes: > http://paste.lisp.org/display/93387 > > It uses protocols and deftype I noticed that it was an old post .. I > could not get it to compile to try it out.. I was complaining about > likes of trying to convert a name-space-qualified to a type name > .. w.r.t ::Complex .

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Ken Wesson
On Sun, Dec 26, 2010 at 7:18 PM, Alex Osborne wrote: > Damon Snyder writes: > >> One of the decisions I wasn't sure about was whether to use a protocol >> or a struct map for the (socket, reader, writer) tuple. I started >> using a struct-map and then switched over to defprotocol/defrecord. >> Se

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Alex Osborne
Damon Snyder writes: > One of the decisions I wasn't sure about was whether to use a protocol > or a struct map for the (socket, reader, writer) tuple. I started > using a struct-map and then switched over to defprotocol/defrecord. > See > https://github.com/drsnyder/beanstalk/blob/82f301f1f825b

Re: websockets w/ clojure

2010-12-26 Thread Jay Fields
I don't have any publicly available jetty/clojure/websocket code. I'll see if I can throw something together tomorrow. Cheers, Jay On Dec 24, 2010, at 11:58 PM, Sean Allen wrote: > Jay, > > Do you have any publicly released code I could take a look at? > I've only found a couple of jetty/cloju

complexity

2010-12-26 Thread Thiago Dantas
Hi everyone, I was in the project euler page and i tried to solve the question 8 using clojure. No big deal, was really cool. So , i cant figure out what is the time complexity for the *code* below I thought that was O(n^2), but running the code for different input seems that the complexity

Re: partitioning iterative list

2010-12-26 Thread Ken Wesson
On Fri, Dec 24, 2010 at 8:38 PM, Glen Rubin wrote: > Can I do the following without using loops?? > > I have list, e.g. > > '(4 6 66 33 26 6 83 5) > > I want to partition it so that I get a subset of lists that build up > to the original: > > ( (4) (4 6) (4 6 66) (4 6 66 33) ) (defn sublists

printf output from threads

2010-12-26 Thread justinhj
What do people use for logging debug output from threads? Either native threads created with Thread. or implicit threads via agents or pmap etc? I tried passing *out* to my thread function and then binding it to *out* in the thread, and this works but then makes the threads execute one at a time,

Re: Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Baishampayan Ghose
> But one issue I encountered with defprotocol is that there appears to > be a possible symbol table/space issue. When I compile, I get warnings > like the following: > > Warning: protocol #'beanstalk.core/BeanstalkObject is overwriting > function read > Warning: protocol #'beanstalk.core/Beanstalk

Question about when to use protocol+record and compilation warnings

2010-12-26 Thread Damon Snyder
Hello, In an effort to learn a little more about clojure (and possibly introduce it at work) I decided to write a native client for the Beanstalk work queue. See http://kr.github.com/beanstalkd/ for more information about the queue and https://github.com/drsnyder/beanstalk for the client. One of t

Re: Let's see how fast we can make this

2010-12-26 Thread Ivan
I don't know why I thought Java used UTF-8, thank you for the correction. So yeah, would be interesting to see the tests on C done with wide char in UTF-16. On Dec 26, 1:54 am, Glen Stampoultzis wrote: > On 26 December 2010 03:00, Ivan wrote: > > > Would be interesting to see tests done on UTF-8

complex number performance enhancement...

2010-12-26 Thread Sunil S Nandihalli
Hello everybody, I have a numerically intensive code. after getting it to work I started profiling the code .. and zeroed down that my complex number operations are the most called functions and probably among the slowest due to my naive implementation. The code I am using is in the following post

Re: ANN: Clojure web application using NHPM for server push

2010-12-26 Thread Anders Rune Jensen
On Thu, Dec 23, 2010 at 1:53 AM, rob levy wrote: > Hi Anders, thanks.  If I understand what you are asking, in fact the server > in my case does not care if anyone is listening, however you can set how > long the messages live in the queue.  The client holds the responsibility of > keeping track o