Re: Request Feedback on Clojure Blog Article

2009-03-17 Thread Timothy Pratley
Quite right, thanks for the explanation! On Mar 17, 3:50 pm, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, Mar 16, 2009 at 9:44 PM, Timothy Pratley timothyprat...@gmail.com wrote: Hi Keith, I don't follow the 'lazy-init' part... It seems to me that you create a delay but

Re: I got to use Clojure at work today !!!

2009-03-17 Thread mac
On Mar 17, 4:54 am, Paul Mooser taron...@gmail.com wrote: I've been using clojure in a similar way at work. I run a swank server in a separate thread inside of a running application instance, and I can connect to it remotely using SLIME. It works pretty well! Me too, I put a swank server in

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Tassilo Horn
Paul Mooser taron...@gmail.com writes: Hi Paul, I've been using clojure in a similar way at work. I run a swank server in a separate thread inside of a running application instance, and I can connect to it remotely using SLIME. It works pretty well! I could benefit from such an approach,

Re: Symbols evaluated at compile time?

2009-03-17 Thread Christophe Grand
How do you cope with type-hinted vars or macros? (ok #'declare does not work for macros neither) With autodef, one could have to either move the definition or add a declare just to be able to add a type hint. Christophe Stephen C. Gilardi a écrit : On Mar 16, 2009, at 6:59 PM, Elena

reload modified java class

2009-03-17 Thread linh
Hello, I want to use REPL to quickly test Java code. Is it possible to reload a modified Java class in REPL? I've searched this forum for answers but haven't found any. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Symbols evaluated at compile time?

2009-03-17 Thread Elena
On Mar 17, 12:15 am, Stephen C. Gilardi squee...@mac.com wrote: If *autodef-unresolved-symbols* is true, and if a has never been   mentioned before, this interaction with Clojure:         user= a         java.lang.Exception: Unable to resolve symbol: a in this context would become:      

Re: swank-clojure: swank-clojure-init-files not used

2009-03-17 Thread AndrewC.
On Mar 16, 2:08 pm, David Nolen dnolen.li...@gmail.com wrote: On Mon, Mar 16, 2009 at 3:42 AM, Tassilo Horn tass...@member.fsf.orgwrote: When adding ~/.clojure/ to `swank-clojure-extra-classpaths' and starting SLIME, htop shows that this directory is not in the -cp java option.

Re: Clojure Web Framework, what I want to add

2009-03-17 Thread James Reeves
On Mar 16, 11:17 pm, BerlinBrown berlin.br...@gmail.com wrote: After many years (decade) of web development, here are the things that I want in a framework, mostly based in clojure: What do you think and what you add.  This is ambitious and just a ideas of what I would add.  What would you

SLIME: evaluating forms?

2009-03-17 Thread Elena
I'm writing a Clojure source file. I thought that C-M-x (slime-eval- defun) would send the current toplevel form to the REPL but I was wrong. For instance, if I evaluate: (ns test (:import (java.net InetAddress))) from the source file and then I evaluate *ns* at the REPL, I get:

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Elena
On Mar 17, 1:27 am, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: Only to do a tiny little test w/ not-deployed code.  But still: I am a professional Clojure developer now :) (Please don't kill my dream.) Me too ^_^ I'm writing an automated test suite for a legacy application I've

Re: Symbols evaluated at compile time?

2009-03-17 Thread Elena
On Mar 17, 10:46 am, Michael Wood esiot...@gmail.com wrote: I understand why people want to be able to do things like this: (defn b [] (a)) (defn a [] (...)) That's what I'm asking for. But that's completely different from the above.  The above is more like: (a) (defn a [] (...)) Why

Re: Symbols evaluated at compile time?

2009-03-17 Thread Stephen C. Gilardi
On Mar 17, 2009, at 4:44 AM, Christophe Grand wrote: How do you cope with type-hinted vars or macros? (ok #'declare does not work for macros neither) With autodef, one could have to either move the definition or add a declare just to be able to add a type hint. The class of vars you're

Re: Improving the test suite

2009-03-17 Thread Frantisek Sodomka
Hello Phil, I see that you have your CA in already: http://clojure.org/contributing so you can start with creating issues and posting patches for them: http://code.google.com/p/clojure-contrib/issues/list Then somebody from clojure-contrib members looks at it and eventually checks it in.

Re: Symbols evaluated at compile time?

2009-03-17 Thread Michael Wood
On Tue, Mar 17, 2009 at 1:01 PM, Elena egarr...@gmail.com wrote: On Mar 17, 10:46 am, Michael Wood esiot...@gmail.com wrote: I understand why people want to be able to do things like this: (defn b [] (a)) (defn a [] (...)) That's what I'm asking for. But that's completely different from

Re: swank-clojure: swank-clojure-init-files not used

2009-03-17 Thread Tassilo Horn
AndrewC. mr.bl...@gmail.com writes: On Mar 16, 2:08 pm, David Nolen dnolen.li...@gmail.com wrote: On Mon, Mar 16, 2009 at 3:42 AM, Tassilo Horn tass...@member.fsf.orgwrote: When adding ~/.clojure/ to `swank-clojure-extra-classpaths' and starting SLIME, htop shows that this directory is

Re: Symbols evaluated at compile time?

2009-03-17 Thread Stephen C. Gilardi
On Mar 17, 2009, at 7:20 AM, Elena wrote: I wanted to say that entering: (defn a [] (b)) should issue a warning (and I don't think an exception is the right way to warn the user). The autodef I described would not warn, nor throw an exception in this case. I think warn on autodef

Re: Clojure Web Framework, what I want to add

2009-03-17 Thread Hubert Iwaniuk
Hi Jeffrey, I was recently thinking of adding support for https://grizzly.dev.java.net/ in http://github.com/weavejester/compojure/tree/master. Just need some time to get my head around compojure. Cheers, Hubert. On Tue, Mar 17, 2009 at 12:52 AM, Jeffrey Straszheim straszheimjeff...@gmail.com

implement into with reduce

2009-03-17 Thread Dex Wood
On IRC we were discussing the behavior of into, and this lead us to dive into core.clj to look at its implementation. We discovered that it was not implemented with reduce, which would produce the same behavior, and we also discovered that implementing it with reduce may have a performance

Re: filter1 interesting?

2009-03-17 Thread Rich Hickey
On Mar 16, 3:38 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Mar 16, 8:14 am, Rich Hickey richhic...@gmail.com wrote: Sorry to jump in late, but one problem with seek is that it is a homophone of seq. Did anyone consider ffilter or find-first? I thought find-first was too

Re: Which Java book(s) to order

2009-03-17 Thread Stuart Sierra
On Mar 16, 4:35 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Of course, with respect to Clojure, probably the most important thing is to learn the Java *libraries*.  What are good books about that? The Sun Java tutorials are actually pretty good: http://java.sun.com/docs/books/tutorial/

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Luc Prefontaine
It depends which SVN release you use. We pulled version 1242 and went to production with it. It's used in services running non stop 24/24 7 days a week. No crashes, no glitches, ... That's before the lazy branch became the base for all future developments. Of course we were expecting some

Re: Clojure Web Framework, what I want to add

2009-03-17 Thread Jeffrey Straszheim
I hadn't heard of Grizzly before. Thanks for the pointer (er..., reference, or whatever we're calling them these days). On Tue, Mar 17, 2009 at 5:31 AM, Hubert Iwaniuk neo...@kungfoo.pl wrote: Hi Jeffrey, I was recently thinking of adding support for https://grizzly.dev.java.net/ in

Re: Symbols evaluated at compile time?

2009-03-17 Thread Laurent PETIT
Hello Rich, 2009/3/17 Rich Hickey richhic...@gmail.com I remain opposed, and here are some more reasons: when you say (def foo [x] (bar x 42)) you are as likely to be referring to a forgot-to-require bar-lib as you are to a to-be-defined bar. The compiler can only default the latter,

Re: SLIME: evaluating forms?

2009-03-17 Thread Shawn Hoover
On Tue, Mar 17, 2009 at 6:40 AM, Elena egarr...@gmail.com wrote: I'm writing a Clojure source file. I thought that C-M-x (slime-eval- defun) would send the current toplevel form to the REPL but I was wrong. For instance, if I evaluate: (ns test (:import (java.net InetAddress)))

Re: Behavior of 'empty'

2009-03-17 Thread Rich Hickey
On Mar 16, 7:13 pm, Mark Engelberg mark.engelb...@gmail.com wrote: On Mon, Mar 16, 2009 at 3:54 PM, Frantisek Sodomka fsodo...@gmail.com wrote: (empty (seq [1 2])) = nil Now that there is the concept of empty sequences, maybe this should actually return an empty sequence, such as ().

Producing HTML

2009-03-17 Thread Jeffrey Straszheim
Is there a good standalone library to create HTML from Clojure, preferably something like the CL-WHO? This will be for a standalone application, not an application server. I just need to generate some populated HTML and put it in to a file. Thanks.

Re: Request Feedback on Clojure Blog Article

2009-03-17 Thread Timothy Pratley
I have another question! I've found your article very interesting. I really like how you have buttons and keybindings to the same AbstractAction. However when I run your app if I press ctrl-x while in a textbox nothing happens... If I'm not in a textbox it exits. I believe this is because the

Clojure STM and deadlocks

2009-03-17 Thread Mark Volkmann
Is there a summary somewhere of the steps Clojure STM takes to avoid deadlocks? I'm just trying to understand the basics of what, if anything, it does to avoid them. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ You received this message

Re: implement into with reduce

2009-03-17 Thread Rich Hickey
On Mar 16, 7:58 pm, Dex Wood slash2...@gmail.com wrote: On IRC we were discussing the behavior of into, and this lead us to dive into core.clj to look at its implementation. We discovered that it was not implemented with reduce, which would produce the same behavior, and we also discovered

Re: Clojure STM and deadlocks

2009-03-17 Thread Jeffrey Straszheim
The code isn't too hard to follow, 'cept the barging stuff gets a bit tricky. A nice 10,000 foot overview would be nice, however. On Tue, Mar 17, 2009 at 8:04 AM, Mark Volkmann r.mark.volkm...@gmail.comwrote: Is there a summary somewhere of the steps Clojure STM takes to avoid deadlocks? I'm

Clojure 1, PHP 0

2009-03-17 Thread Onorio Catenacci
Hi all, I thought this article might present some ideas of interest to everyone. http://briancarper.net/blog/clojure-1-php-0 Originally found via HackerNews. -- Onorio Catenacci III It is the greatest of all mistakes to do nothing because you can only do a little. -Sydney Smith, writer and

Re: Producing HTML

2009-03-17 Thread Jeffrey Straszheim
Awesome! Thanks. On Tue, Mar 17, 2009 at 8:08 AM, Timothy Pratley timothyprat...@gmail.comwrote: I can highly recommend clojure.contrib.prxml James Reeves gave a really good example in the 2nd last post of this thread:

Re: Behavior of 'empty'

2009-03-17 Thread Frantisek Sodomka
And what about lazy sequences? Is this behavior correct? user= (lazy-seq ()) () user= (empty (lazy-seq ())) nil user= (empty (lazy-seq [])) nil user= (lazy-seq [1 2]) (1 2) user= (empty (lazy-seq [1 2])) nil Thank you, Frantisek On 17 Bře, 13:54, Rich Hickey richhic...@gmail.com wrote: On

Re: Improving the test suite

2009-03-17 Thread Shawn Hoover
On Tue, Mar 17, 2009 at 12:03 AM, Phil Hagelberg p...@hagelb.org wrote: OK, so I've posted a fair amount of smack talk about test suites and how important they are--I figure it's time to help out. What are some ways in which test-clojure is lacking? How can I help improve the coverage?

Re: swank-clojure: swank-clojure-init-files not used

2009-03-17 Thread AndrewC.
On Mar 17, 11:10 am, Tassilo Horn tass...@member.fsf.org wrote: AndrewC. mr.bl...@gmail.com writes: snip The other problem is that it uses add-to-list so if you reload slime to refresh the value of slime-lisp-implementations, you end up with two clojure entries in the list. Why do

Re: Behavior of 'empty'

2009-03-17 Thread Rich Hickey
On Mar 17, 2009, at 9:18 AM, Frantisek Sodomka wrote: And what about lazy sequences? Is this behavior correct? user= (lazy-seq ()) () user= (empty (lazy-seq ())) nil user= (empty (lazy-seq [])) nil user= (lazy-seq [1 2]) (1 2) user= (empty (lazy-seq [1 2])) nil Fixed in svn 1332

Re: SLIME: evaluating forms?

2009-03-17 Thread Elena
On Mar 17, 12:51 pm, Shawn Hoover shawn.hoo...@gmail.com wrote: If you want to set the REPL package from your .clj buffer, use C-c M-p (slime-repl-set-package). That worked, thanks. For newbies, I'll add that slime-repl-set-package is in a slime contribution not available by default, so

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Elena
On Mar 17, 12:43 pm, Luc Prefontaine lprefonta...@softaddicts.ca wrote: It depends which SVN release you use. We pulled version 1242 and went to production with it. It's used in services running non stop 24/24 7 days a week. No crashes, no glitches, ... I didn't mean I don't trust the

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Luc Prefontaine
Sometimes I feel lucky to be able to take my own decisions and turn our development strategy on a dime :. My partners rely on me for these decisions and we never regretted one so far. 1.0 should not be too far away so your waiting is near it's end... :))) Luc On Tue, 2009-03-17 at 07:23

Re: android app development with clojure

2009-03-17 Thread Remco van 't Veer
Sorry, missed your message. See: http://github.com/remvee/clojurehelloandroid/ for a hello world example. On Thu, Mar 12, 2009 at 3:04 PM, rob r.p.l...@gmail.com wrote: Ok, duh, somehow didn't catch that this link was the code I was wondering about:

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Paul Mooser
It's actually fairly straightforward. In my (ordinary java) application, I create a thread which loads a clojure program passed on the command line (I don't have the source in front of me, but if you need it, I can give you a hand), and that program typically contains something like the

Re: Request Feedback on Clojure Blog Article

2009-03-17 Thread Timothy Pratley
I found one way to make 'global hotkeys' (its a bit verbose though): http://groups.google.com/group/clojure/web/global-hotkey.clj adapted from http://www.javaspecialists.eu/archive/Issue007.html Just mentioning it for interest seeing key controls in swing has been driving me nuts :P Regards,

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Tassilo Horn
Paul Mooser taron...@gmail.com writes: Hi Paul, It's actually fairly straightforward. In my (ordinary java) application, I create a thread which loads a clojure program passed on the command line (I don't have the source in front of me, but if you need it, I can give you a hand), That

Issue 34

2009-03-17 Thread Joshua
I think I have a fix for Issue 34 (Disable EvalReader with a *read- eval* flag). I added the *read-eval* variable and also created a dispatch reader that sets the value at read time. Let me know any comments. Joshua ### Eclipse Workspace Patch 1.0 #P Clojure Index:

Re: Issue 34

2009-03-17 Thread Joshua
Sample syntax is: #r() #r(eval (def x 3)) works fine #r(#=(eval (def x 3))) will throw an exception Joshua --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: reload modified java class

2009-03-17 Thread Meikel Brandmeyer
Hi, Am 17.03.2009 um 09:46 schrieb linh: I want to use REPL to quickly test Java code. Is it possible to reload a modified Java class in REPL? I've searched this forum for answers but haven't found any. I'm not a Java expert, but I get that this is difficult. Maybe Java Rebel could help you

Re: Issue 34

2009-03-17 Thread Joshua
Updated the patch based on comments from rhickey. New sample syntax is: (binding [*read-eval* false] (read-string #=(eval (def x 3)) )) throws an Exception Joshua ### Eclipse Workspace Patch 1.0 #P Clojure Index: src/clj/clojure/core.clj

Reading decimal numbers (doubles)

2009-03-17 Thread Frantisek Sodomka
Hello Rich all! I have question about the reader http://clojure.org/reader Numbers say as per Java. I found that e.g. 2. reads Java as double and Clojure as int. All these read as double in Java: 2. .1 +.0 -.0 +2. -2. Clojure either sees them as ints or errors out. I am wondering about

Printing, Reading, and Serializing (+ bug?)

2009-03-17 Thread Jason Wolfe
Does anyone have suggestions on the best way to store Clojure objects to a file and later read them back in? The obvious option would be to use the build-in printer and reader. One limitation here, which I'm OK with for now, is that this doesn't work for arbitrary serializable objects (which

Re: Printing, Reading, and Serializing (+ bug?)

2009-03-17 Thread Phil Hagelberg
Jason Wolfe jawo...@berkeley.edu writes: Finally, has anyone tried printing something with closures in it, and then reading it back in another JVM instance? Closures are dependent upon their lexical environment. While you can serialize the code they contain, you can't serialize their whole

Re: Clojure STM and deadlocks

2009-03-17 Thread Mark Volkmann
On Tue, Mar 17, 2009 at 8:08 AM, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: The code isn't too hard to follow, 'cept the barging stuff gets a bit tricky.  A nice 10,000 foot overview would be nice, however. On Tue, Mar 17, 2009 at 8:04 AM, Mark Volkmann r.mark.volkm...@gmail.com

Re: Clojure STM and deadlocks

2009-03-17 Thread Rich Hickey
On Mar 17, 2:32 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Tue, Mar 17, 2009 at 8:08 AM, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: The code isn't too hard to follow, 'cept the barging stuff gets a bit tricky. A nice 10,000 foot overview would be nice, however.

Re: Printing, Reading, and Serializing (+ bug?)

2009-03-17 Thread MikeM
I've used print-dup and read for saving and restoring data and it worked well for me once I defined the needed print-dup methods. Since you said it's ok for you to read your struct back in as a hash map, you can do the following: (defmethod print-dup clojure.lang.PersistentStructMap [o w]

Re: I got to use Clojure at work today !!!

2009-03-17 Thread Victor Rodriguez
On Tue, Mar 17, 2009 at 12:21 PM, Tassilo Horn tass...@member.fsf.org wrote: Paul  Mooser taron...@gmail.com writes: Hi Paul, It's actually fairly straightforward. In my (ordinary java) Take a look at this blog post:

Re: reload modified java class

2009-03-17 Thread Stuart Sierra
On Mar 17, 4:46 am, linh nguyenlinh.m...@gmail.com wrote: Is it possible to reload a modified Java class in REPL? You could write a custom ClassLoader to load (and then reload) your Java classes. Not impossible, but not trivial. -Stuart Sierra

Re: Clojure STM and deadlocks

2009-03-17 Thread Rich Hickey
On Mar 17, 3:21 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Tue, Mar 17, 2009 at 1:41 PM, Rich Hickey richhic...@gmail.com wrote: On Mar 17, 2:32 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Tue, Mar 17, 2009 at 8:08 AM, Jeffrey Straszheim straszheimjeff...@gmail.com

Re: Producing HTML

2009-03-17 Thread atreyu
Maybe Clojure-Haml helps you http://github.com/antoniogarrote/clj-haml/tree/master On 17 mar, 14:01, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: Is there a good standalone library to create HTML from Clojure, preferably something like the CL-WHO?  This will be for a standalone

Re: Clojure STM and deadlocks

2009-03-17 Thread Mark Volkmann
On Tue, Mar 17, 2009 at 3:21 PM, Rich Hickey richhic...@gmail.com wrote: On Mar 17, 3:21 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Tue, Mar 17, 2009 at 1:41 PM, Rich Hickey richhic...@gmail.com wrote: On Mar 17, 2:32 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Tue,

Small rand-int suggestion

2009-03-17 Thread James Reeves
A quick suggestion about rand-int. It would be useful if you could supply it with a second argument to give a random integer over a range. For example, (rand-int 5 10) to give a random integer between 5 (inclusive) and 10 (exclusive):

Re: Clojure STM and deadlocks

2009-03-17 Thread Luc Prefontaine
Do we have to know how Oracle deals with concurrency issues internally in a specific application transaction when coding a database centric application ?!?!?! Most of the time, you do not really care about these things. You stick to a few minimal rules and that's it. These rules vary a bit

Re: Symbols evaluated at compile time?

2009-03-17 Thread Laurent PETIT
2009/3/17 Stephen C. Gilardi squee...@mac.com On Mar 16, 2009, at 8:25 PM, Laurent PETIT wrote: Hi Laurent, Your solution is indeed close to what I had in mind in terms of requirements. I was currently hacking with clojure java class Compiler to enhance Timothy's patch and add a

Unit Testing Macros

2009-03-17 Thread Sean
Hey everyone, I'm writing a macro library for myself, and I'm thinking about publishing it. Before I do so, I'd like to write run some unit tests for it. I was hoping the crowd could chime in on how they test macros. Any links examples would be great. Thanks!

Re: filter1 interesting?

2009-03-17 Thread Stuart Sierra
On Mar 16, 8:14 am, Rich Hickey richhic...@gmail.com wrote: Did anyone consider ffilter or find-first? I've changed it to find-first in seq-utils. That seems to be the least objectionable name, all things considered, and has the virtue of being easy to remember. -Stuart Sierra

Re: Symbols evaluated at compile time?

2009-03-17 Thread Stephen C. Gilardi
On Mar 17, 2009, at 5:52 PM, Laurent PETIT wrote: I give up on this one. I've now been half convinced that it's even less an ideal solution than I expected at first, and I prefer use the little free time I have to enhance clojuredev. Sounds good. Thanks for closing the loop on this.

Re: Clojure STM and deadlocks

2009-03-17 Thread camponoblanco
On 17 mar, 14:04, Mark Volkmann r.mark.volkm...@gmail.com wrote: Is there a summary somewhere of the steps Clojure STM takes to avoid deadlocks? I'm just trying to understand the basics of what, if anything, it does to avoid them. -- R. Mark Volkmann Object Computing, Inc. Perhaps this

Re: Symbols evaluated at compile time?

2009-03-17 Thread Elena
On 17 Mar, 13:23, Rich Hickey richhic...@gmail.com wrote: I remain opposed, and here are some more reasons: when you say (def foo [x]   (bar x 42)) you are as likely to be referring to a forgot-to-require bar-lib as you are to a to-be-defined bar. The compiler can only default the

Re: Symbols evaluated at compile time?

2009-03-17 Thread Elena
And of course, if somebody agrees that is a worth proposal and could provide some directions, I'm here ready to churn out some code. Here in Italy we say Help yourself and God will help you along the way ^_^ Did I mention I'm Italian? I bet you guessed it already since I talk too much for sure.

Re: filter1 interesting?

2009-03-17 Thread e
Another way to look at it - people are always asking for sequential versions of find/contains?, so seq-find, seq-contains? Both would take predicates instead of keys, and do sequential lookup. those discussions are what made me think of 'get'. (seq-get ...) or your names is starting to

Re: filter1 interesting?

2009-03-17 Thread Paul Mooser
I think I prefer find-first as well, rather than ffilter. I worry that ffilter isn't clear enough, and reads too similarly to filter. On Mar 16, 7:51 am, Laurent PETIT laurent.pe...@gmail.com wrote: Just to make me more enemies ;-), I would prefer, on the other hand, find-first over ffirst