Re: REPL integration in a existing java project

2009-10-01 Thread ngocdaothanh
You can create-repl-server: http://richhickey.github.com/clojure-contrib/server-socket-api.html and access the server remotely from telnet. On Oct 1, 9:29 pm, DomS wrote: > Hello all, > > I'm trying to integrate an REPL in a existing java project, but i dont > know how it works or where to star

Re: Citing clojure

2009-10-01 Thread Krukow
On Oct 1, 10:17 pm, John Harrop wrote: > > @conference{hickey2008clojure, > >  title={{The Clojure programming language}}, > >  author={Hickey, R.}, > >  booktitle={Proceedings of the 2008 symposium on Dynamic languages}, > >  year={2008}, > >  organization={ACM New York, NY, USA} > > } > > Eeeu

Re: server-socket on exit event

2009-10-01 Thread ngocdaothanh
> I'm not sure TCP/IP has a native facility for that. I'm afraid John's statement is correct: http://www.velocityreviews.com/forums/t125620-client-socket-disconnection-event-not-received-on-server-socket-java-nio.html and trying to read and write until something wrong happens as demonstrated in R

Two minor typos in the cheatsheet

2009-10-01 Thread AlamedaMike
odd and even should be odd? and even? Thanks for creating this. Most useful. --~--~-~--~~~---~--~~ 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 pos

Re: Syntax for proxy methods?

2009-10-01 Thread timc
Oops, I spoke too hastily -- thank you Jarkko. On Oct 1, 8:38 pm, timc wrote: > No, its a proxy for an interface. > > On Oct 1, 7:22 pm, Jarkko Oranen wrote: > > > On Oct 1, 9:18 pm, timc wrote: > > > > > > (def prx (proxy [IX][] > > >   (doit > > >     ([] (doseq [x someSeq] (doit x)) > > >

Re: server-socket on exit event

2009-10-01 Thread John Harrop
On Thu, Oct 1, 2009 at 4:02 PM, Roger Gilliar wrote: > Am 01.10.2009 um 21:28 schrieb ngocdaothanh: > > Roger, your code is not event based. > What do you mean by not event based ? He means he wants automatic notification if a connection is dropped. I'm not sure TCP/IP has a native facility fo

Re: Citing clojure

2009-10-01 Thread John Harrop
On Thu, Oct 1, 2009 at 3:42 PM, Dragan Djuric wrote: > > I usualy cite Rich's conference paper and Stuart's book. > > @conference{hickey2008clojure, > title={{The Clojure programming language}}, > author={Hickey, R.}, > booktitle={Proceedings of the 2008 symposium on Dynamic languages}, > yea

Re: Problem using shell-out in Windows command prompt

2009-10-01 Thread John Harrop
On Thu, Oct 1, 2009 at 1:39 PM, Nick Day wrote: > > Hey, > > I've just been trying to run a couple of simple commands using shell- > out (e.g. (sh "dir")) in a repl in Windows command prompt, but am > running up against errors of the type > > java.io.IOException: Cannot run program "dir": CreateP

Re: Problem using shell-out in Windows command prompt

2009-10-01 Thread Stefan Tilkov
On Oct 1, 2009, at 7:39 PM, Nick Day wrote: > > Hey, > > I've just been trying to run a couple of simple commands using shell- > out (e.g. (sh "dir")) in a repl in Windows command prompt, but am > running up against errors of the type > > java.io.IOException: Cannot run program "dir": CreateProce

Re: server-socket on exit event

2009-10-01 Thread Roger Gilliar
Am 01.10.2009 um 21:28 schrieb ngocdaothanh: > Roger, your code is not event based. What do you mean by not event based ? Regards Roger --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: Citing clojure

2009-10-01 Thread Dragan Djuric
I usualy cite Rich's conference paper and Stuart's book. @conference{hickey2008clojure, title={{The Clojure programming language}}, author={Hickey, R.}, booktitle={Proceedings of the 2008 symposium on Dynamic languages}, year={2008}, organization={ACM New York, NY, USA} } This paper so

Re: Syntax for proxy methods?

2009-10-01 Thread timc
No, its a proxy for an interface. On Oct 1, 7:22 pm, Jarkko Oranen wrote: > On Oct 1, 9:18 pm, timc wrote: > > > > (def prx (proxy [IX][] > >   (doit > >     ([] (doseq [x someSeq] (doit x)) > >     ([y] (print y > > > When I tried something of this form, it looks like the call of the 1- >

Re: server-socket on exit event

2009-10-01 Thread ngocdaothanh
Roger, your code is not event based. I'm new to Clojure and as a small exercise I just want to create a simple chat server for telnet clients, any usable socket library is OK: * Chat messages are broadcast to all clients * When a client disconnect, all others will receive "A client has disconnect

Re: server-socket on exit event

2009-10-01 Thread Roger Gilliar
> > I want to write a simple socket server in Clojure. I want to perform > some action when a client disconnects. --- The following code works for me. read-input returns nil if the socket is closed (the client disconnects) Regards Roger (defn read-inp

server-socket on exit event

2009-10-01 Thread ngocdaothanh
I want to write a simple socket server in Clojure. I want to perform some action when a client disconnects. I tried server-socket: http://richhickey.github.com/clojure-contrib/server-socket-api.html but it does not support on exit event. Is there a solution? Should I look at something like Grizz

Re: Syntax for proxy methods?

2009-10-01 Thread Jarkko Oranen
On Oct 1, 9:18 pm, timc wrote: > (def prx (proxy [IX][] >   (doit >     ([] (doseq [x someSeq] (doit x)) >     ([y] (print y > > When I tried something of this form, it looks like the call of the 1- > arg function from the 0-arg function can't be resolved. > > Thanks in advance I'm not cert

Problem using shell-out in Windows command prompt

2009-10-01 Thread Nick Day
Hey, I've just been trying to run a couple of simple commands using shell- out (e.g. (sh "dir")) in a repl in Windows command prompt, but am running up against errors of the type java.io.IOException: Cannot run program "dir": CreateProcess error=2, The system cannot find the file specified (NO_S

Syntax for proxy methods?

2009-10-01 Thread timc
Can someone please advise me if this is possible: // --- IX.java --- interface IX { void doit(); void doit(int n); } ; --- x.clj --- (def prx (proxy [IX][] (doit ([] (doseq [x someSeq] (doit x)) ([y] (print y When I tried something of this form, it looks like the call of th

Re: RFC: laziness-safe, semi-dynamic environment Var(Lite)

2009-10-01 Thread Rich Hickey
On Thu, Oct 1, 2009 at 12:03 PM, jon wrote: > > On Sep 29, 10:31 pm, Rich Hickey wrote: >> On Tue, Sep 29, 2009 at 4:04 PM, jon wrote: >> >> Before leaping to implementation/performance issues, I think it is >> important to think about the semantics of this - what does it mean? I >> think you w

Re: Re: "Schema" for data structures

2009-10-01 Thread Emeka
Artyom, > (provide/contract >[interp (-> AE? number?)]) > > ;; interpret an arithmetical expression yielding a number > (define (interp exp) > ;; type-case is very much like a "case ... of" in Haskell/ML > (type-case AE exp > (num (n) n) > (plus (l r) (+ (interp l) (interp r))) >

Re: Timing, JIT, Heisen-code

2009-10-01 Thread Jonathan Smith
On Sep 30, 1:18 pm, Matt Brown wrote: > Hi. > > Thanks all, for your comments. > > > You need to use a bigger number than 1000 for these results to be > > meaningful. > > Out of curiousity, why is this? > Does the JIT do something different after 1000 iterations? > Or is the concern simply tha

Re: RFC: laziness-safe, semi-dynamic environment Var(Lite)

2009-10-01 Thread jon
On Sep 29, 10:31 pm, Rich Hickey wrote: > On Tue, Sep 29, 2009 at 4:04 PM, jon wrote: > > Before leaping to implementation/performance issues, I think it is > important to think about the semantics of this - what does it mean? I > think you will get a lot of confusion, given: > > (defn foo [] >

Citing clojure

2009-10-01 Thread Hadley Wickham
Hi all, Are there any preferences for citing clojure in academic publications? Thanks, Hadley --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: ClojureCLR and CLR structs

2009-10-01 Thread Shawn Hoover
Works for me. Thanks! On Thu, Oct 1, 2009 at 1:24 AM, David Miller wrote: > > Should be fixed in the latest commit. > Any of the following will work. > > > (System.Reflection.Assembly/Load "WindowsBase, Version=3.0.0.0, > Culture=neutral, PublicKeyToken=31bf3856ad364e35") > (import '(System.Wind

REPL integration in a existing java project

2009-10-01 Thread DomS
Hello all, I'm trying to integrate an REPL in a existing java project, but i dont know how it works or where to start. At first it should only have the functionality from an ordinary clj repl. Later we want to extend it with some functions and macros, to control our software via "console". Help

Re: Timing, JIT, Heisen-code

2009-10-01 Thread Fredrik Ohrstrom
Oh, and by the way: the expression (+ 1 2 3) is indeed a constant. Be very wary of tests that verify the execution speed of constants since it is definitely the goal of the JVM developers to make the JVM compile these into a single constant mov in the machine code! Of course such code is so fast

Re: Timing, JIT, Heisen-code

2009-10-01 Thread Fredrik Ohrstrom
You are trusting nanoTime to actually return values that are useful! They might be completely useless for your timing purposes. :-) It all depends on the hardware you are running. Read the spec: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#nanoTime() The reason for this is that

Debugging questions

2009-10-01 Thread Ze maria
Hello guys,I've read the Stuart Halloway's book, worked through it, and I've being programming in clojure in the last few weeks. I'm using Clojure 1.0.1-alpha-SNAPSHOT with emacs + slime + swank. Until now, everything went smoothly, however as my code went bigger it become harder to debug obviousl