debug-repl now uses defmacro's new implicit &env arg

2010-02-01 Thread George Jahad
I've also added an (exit-dr) function that allows you to exit the debug-repl all the way, if you are nested many levels. You can get it here: http://clojars.org/org.clojars.gjahad/debug-repl (Use the "0.2.0-SNAPSHOT" of the debug-repl if you are not using the latest Clojure with the new &env arg

Re: How to Initiate Clojure Application

2010-02-01 Thread ataggart
You can generate a Java class with a main method (as you have done), or you can use clojure.main: http://clojure.org/repl_and_main On Jan 31, 2:32 pm, Wardrop wrote: > I'm having trouble finding any resources on the net for telling me how > to initiate a Clojure application. I'm currently using

Transients question/feedback

2010-02-01 Thread Moss Prescott
Hi, As a very green Clojure user and a big fan of persistent data structures, I'm struggling to grasp the significance of transients in Clojure 1.1. In particular, the implementation seems to be less safe and less consistent than it could be. Consider this somewhat silly REPL session: user=> (de

Re: Domain Modelling

2010-02-01 Thread Erik Price
On Sun, Jan 31, 2010 at 10:33 PM, Barry Dahlberg wrote: > Perhaps I'll write up my findings once the language stops intimidating > me. > > At the moment I'm writing an account "object".  I have some standard > CRUD type functions which operate on a map behind the scenes.  I would > like to add som

Re: Transients question/feedback

2010-02-01 Thread Stuart Halloway
My guess is that the resulting ephemeral garbage would have only a small effect on performance, retaining most of the advantage of transients, but improving their safety. Would any of the Clojure experts care to comment on whether this seems like a worthwhile exercise? Having spent a ton of hour

Re: About releasing clj-peg under the EPL 1.0

2010-02-01 Thread Joop Kiefte
If you are the copyright owner, you always have the final word on what you do with your stuff. The license is for users of your product. This means you can arrange another license for paying people if you want, this is what is done when dual-licensing. If you reuse things of other people however,

Re: update-in and get-in why no default?

2010-02-01 Thread Timothy Pratley
> Am 31.01.2010 um 18:29 schrieb Daniel Werner: >> If I understand this arity version of get-in correctly, won't the >> default also be used if the value stored in the nested data structure >> evaluates to something false-y? Thanks for spotting that early! On 1 February 2010 05:46, Meikel Brandm

Re: How to Initiate Clojure Application

2010-02-01 Thread Timothy Pratley
On 1 February 2010 09:32, Wardrop wrote: > Could someone step me through the idea behind the -main function > (which I've also seen written as just "main" without the hyphen). Is "-main" special in any way, or is this just a convention that some environments select? In the past I think I've used

Re: update-in and get-in why no default?

2010-02-01 Thread Meikel Brandmeyer
Hi, On Feb 1, 1:57 pm, Timothy Pratley wrote: > Good idea, but peek and pop work differently on vectors and sequences, > seeing get-in is not constrained to use vectors this could lead to an > unexpected behavior: > user=> (def m  {:a 1, :b 2, :c {:d 3, :e 4}, :f nil}) > #'user/m > user=> (get-i

Re: How to Initiate Clojure Application

2010-02-01 Thread Jarkko Oranen
On Feb 1, 3:16 pm, Timothy Pratley wrote: > On 1 February 2010 09:32, Wardrop wrote: > > > Could someone step me through the idea behind the -main function > > (which I've also seen written as just "main" without the hyphen). > > Is "-main" special in any way, or is this just a convention that

Re: How to Initiate Clojure Application

2010-02-01 Thread mac
> Is "-main" special in any way, or is this just a convention that some > environments select? In the past I think I've used a manifest to > specify the main entry point... is that really necessary or does -main > map to the default main entry point regardless of build tool? Just > curious really!

Re: clojure.contrib.test-contrib.test-jmx build error

2010-02-01 Thread Michał Marczyk
On 30 January 2010 02:35, Michał Marczyk wrote: > Well, with sources freshly pulled from github just now, I was able to > build contrib with no trace of the problem... Doing a (require > 'clojure.contrib.jmx) followed by run-tests at the REPL also works. > Still no idea what it was about, hoping i

Re: clojure.contrib.test-contrib.test-jmx build error

2010-02-01 Thread Stuart Halloway
The official JMX API is a programmer-usability disaster (IMO), and I wrote the contrib jmx wrapper by trial-and-error to get minimal functionality working. A few thoughts: * I will take a look at this (but won't be able to get to it today). Feel free to make assembla guilt that points to me

Re: clojure.contrib compile fail

2010-02-01 Thread Jeff Schwab
Stuart Sierra wrote: On Jan 30, 9:07 am, Jeff Schwab wrote: The clojure-contrib I just pulled from github fails to compile, with an error that the ColumnWriter class extended by PrintWriter is not found. This has been fixed now. Thanks. I see that you made an end-run around Maven. I di

file-seq and recursive directories

2010-02-01 Thread Jim Van Donsel
The simple: (file-seq (java.io.File. ".")) will loop forever if it hits a directory structure with recursive links. Short of writing ugly code myself to detect such loops, is there already a Clojure thingamabob that does this safely? -Jim -- You received this message because you are

Re: making instances of a parameterised class...efficiently...

2010-02-01 Thread Jules
Guys, Thanks for your answers. I'll give both of these solutions a try out this week and get back to the list with results and thoughts. Thanks again for your help. Jules -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Transients question/feedback

2010-02-01 Thread Sudish Joseph
Moss Prescott writes: > My guess is that the resulting ephemeral garbage would have only a > small effect on performance An interesting data point on ephemeral garbage that was quite eye-opening: Somewhere in the talk below, Cliff Click says that the problem with high-volume ephemeral garbage lie

Re: clojure.contrib compile fail

2010-02-01 Thread Stuart Sierra
On Feb 1, 10:53 am, Jeff Schwab wrote: > Thanks.  I see that you made an end-run around Maven.  I didn't know you > could use gen-class that way. It's more an end-run around gen-class than around Maven. gen-class is an ordinary macro; it can be used anywhere, not just in ns declarations. Puttin

Re: file-seq and recursive directories

2010-02-01 Thread Sean Devlin
Hmmm... to the best of my knowledge this has to be handled by the end developer. Could you post what you find out? Sean On Feb 1, 9:22 am, Jim Van Donsel wrote: > The simple: > >      (file-seq (java.io.File. ".")) > > will loop forever if it hits a directory structure with recursive > links. >

Re: return value of use, requires?

2010-02-01 Thread Raoul Duke
On Fri, Jan 29, 2010 at 9:29 PM, Timothy Pratley wrote: > Would it be better to throw an exception if nothing was specified to > load instead of returning true/false... Because :foo is a keyword, > making it a valid argument to use and require, but no load target is > specified. I've uploaded a pa

Contrib library renames

2010-02-01 Thread Stuart Sierra
As the first stage in a much-needed code cleanup, the following changes are now on the "master" branch of clojure-contrib: * Rename c.c.str-utils3 => c.c.string * Rename c.c.duck-streams => c.c.io * Rename c.c.java-utils => c.c.java * Rename c.c.seq-utils => c.c.seq * Rename c.c.shell-out => c.c.s

Re: idiom question: infinite sequence as data source for many threads?

2010-02-01 Thread Daniel Werner
On Jan 30, 8:09 am, Timothy Pratley wrote: > Below I present 'submit-future' which is similar to the existing > 'future' call in that it spawns a thread to execute a task, but > differs in that it will block if n submitted futures are already > running, where n is the number of available processor

Re: idiom question: infinite sequence as data source for many threads?

2010-02-01 Thread Daniel Werner
On Jan 30, 7:07 am, free_variation wrote: > (defn init-features [stream] > (let [feature-stream (ref stream)] > (dosync (ref-set feature-stream stream)) The call to ref-set seems redundant here since you already initialize the ref with stream as its value. -- You receive

Re: Domain Modelling

2010-02-01 Thread Barry Dahlberg
I wrote something like this last night: (def user-metadata {:fields ((:name (required) (max-length 50)) (:email (required) (max-length 250)))}) (defn create-user [name, email] (with-meta {:name name :email email} user-data)) I have a validate function which pulls the metadata from

Re: file-seq and recursive directories

2010-02-01 Thread ataggart
On Feb 1, 6:22 am, Jim Van Donsel wrote: > The simple: > >      (file-seq (java.io.File. ".")) > > will loop forever if it hits a directory structure with recursive > links. > > Short of writing ugly code myself to detect such loops, is there > already a Clojure thingamabob that does this safely

Re: file-seq and recursive directories

2010-02-01 Thread Jim Van Donsel
Fair enough. But I guess the moral is that a file-seq should not be used unless you have a well-controlled filesystem. -- 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 posts from

Re: file-seq and recursive directories

2010-02-01 Thread ataggart
On Feb 1, 2:14 pm, Jim Van Donsel wrote: > Fair enough. > > But I guess the moral is that a file-seq should not be used unless you > have a well-controlled filesystem. Or more generally, all sequences may be infinite unless you know the backing data has no cycles, or you have some terminating/f

Re: How to Initiate Clojure Application

2010-02-01 Thread Wardrop
Ok, this seems to work... (ns localhost.test) (clojure.main/main (println "Hello!")) I then assume I'd use the special form "do" to perform multiple unrelated tasks, such as... (clojure.main/main (do (println "Hello!") (println "Cheeso!"))) At least I can now build and run a script. On

Newbie question - Functional programming & special cases

2010-02-01 Thread ka
Hi clojure folk, I'm reading up on clojure from the book 'Programming clojure'. In chapter 2 there is a statement - "The imperative indexOfAny must deal with several special cases: null or empty strings, a null or empty set of search characters, and the absence of a match. These special cases ad

h4dev.com: Searchable database for clojure development topics

2010-02-01 Thread Gene Tani
http://h4dev.com/entries?search=multimethods Using the major search engines for info on clojure language, tools and dev practices is trying at best for beginning and intermediate devs, so I've worked toward building a searchable database that I think will yield more precision at the cost of less r

Re: more lazy "fun"

2010-02-01 Thread rzeze...@gmail.com
On Jan 28, 3:26 pm, Raoul Duke wrote: > [gmail is freaking out, apologies if this is sent twice] > > On Thu, Jan 28, 2010 at 12:23 PM, DanL wrote: > > When exactly would a lazy sequence evaluate to false? > > i thought it was happening with code like: > > (let [final-answer (and (map #(= "foo"

Re: more lazy "fun"

2010-02-01 Thread Raoul Duke
On Mon, Feb 1, 2010 at 3:20 PM, rzeze...@gmail.com wrote: > I think the problem was more of a misunderstanding with the and > function and not lazy sequences. i agree (hence my previous note where i said i didn't know what the hell i was doing) :-) many thanks for taking the time to dismember it

Re: update-in and get-in why no default?

2010-02-01 Thread Timothy Pratley
On 2 February 2010 00:18, Meikel Brandmeyer wrote: > Consider this (admittedly constructed) case: > (get-in {:a {:b 1}} [:x :c] {:c :uhoh}) Excellent point! > Or to use butlast/last instead of peek/pop. I think this is the best approach. butlast/last have linear time so the overhead is small.

Re: Newbie question - Functional programming & special cases

2010-02-01 Thread CuppoJava
Hi ka, You're right. Eliminating special cases is more a factor of the design of the API than of the programming language. Nevertheless, a well- designed API (that has eliminating special cases in mind) in combination with a functional programming language makes your code extremely elegant. Thus ma

Re: Transients question/feedback

2010-02-01 Thread Richard Newman
My question is: why not have each conj! produce a new, lightweight TransientVector instance pointing to the same shared data? ... My guess is that the resulting ephemeral garbage would have only a small effect on performance, retaining most of the advantage of transients, but improving their s

Re: idiom question: infinite sequence as data source for many threads?

2010-02-01 Thread free_variation
Urp yes thanks! Remainder of a previous version of the function. jds On Feb 1, 3:57 pm, Daniel Werner wrote: > On Jan 30, 7:07 am, free_variation wrote: > > > (defn init-features [stream] > >         (let [feature-stream (ref stream)] > >                 (dosync (ref-set feature-stream stream)

Lazy (apply concat ...) ?

2010-02-01 Thread CuppoJava
Hi, I'm wondering whether (apply concat ...) can be re-written to be lazy. ---Expected behavior--- (def temp (for [i (range 20)] (do (println i) [i i i]))) (def temp2 (apply concat temp)) Should print nothing. -Behavior in 1.1.0-RC- Under Clojure-1.1

Re: Lazy (apply concat ...) ?

2010-02-01 Thread Richard Newman
I'm wondering whether (apply concat ...) can be re-written to be lazy. ... -Behavior in 1.1.0-- The operation is eager. It's not: it simply uses chunked sequences, so the first 32 elements are evaluated together. user=> (def temp (for [i (range 50)] (do (println i)

Re: Lazy (apply concat ...) ?

2010-02-01 Thread CuppoJava
Oh I see. Thanks for the explanation. I always assumed that chunked sequences can be viewed as purely an optimization and transparent from the user. Is there a way (short of writing a lazy version of apply concat) that I can achieve my desired result? -Patrick -- You received this message becau

Re: Lazy (apply concat ...) ?

2010-02-01 Thread Richard Newman
Oh I see. Thanks for the explanation. I always assumed that chunked sequences can be viewed as purely an optimization and transparent from the user. Is there a way (short of writing a lazy version of apply concat) that I can achieve my desired result? I've heard talk about trying to provide some

idiomatic question about reader macro

2010-02-01 Thread A.Rost
Hi, I'm a clojure newbie, with a background in Common Lisp (and functional languages such as haskell and erlang). For me Lisp is a very powerful tool that gives me flexibility that I need. Sometimes coding with CL I define reader macros and they perfect suit for those situations. After I take a lo

clojure.contrib.[duck-streams io]

2010-02-01 Thread OGINO Masanori
Hello. I built master branch of clojure and clojure-contrib and then I found that there is no duck-streams. io exists. Can I write a code on both 1.1 and master using duck-streams/io? FYI, I want something like this Python code in Clojure: try: from clojure.contrib.io import reader

Re: Newbie question - Functional programming & special cases

2010-02-01 Thread Jerome Baum
'when pred' just checks that you're not passing in garbage for the predicate -- it's probably not really necessary and it might be better to let Clojure throw an exception. Totally agree on your point with the branching. That's not really FP- related, it's only that most FP languages allow pattern

How to get Clojure.Contrib in my Classpath?

2010-02-01 Thread Wardrop
I can't for the life of me get Clojure.Contrib to work. No matter what I do, I seem to have it available within clojure. Here's just an example of what I've been trying when calling the repl from the command line... java -classpath "C:\Program Files\Clojure\clojure.jar";"C:\Program Files\Clojure\c

Re: How to get Clojure.Contrib in my Classpath?

2010-02-01 Thread tsuraan
> java -classpath "C:\Program Files\Clojure\clojure.jar";"C:\Program > Files\Clojure\clojure-contrib-1.1.0.jar" clojure.main > > This starts the repl without a problem, but still, any attempt to use > a class or function from the contrib library fails, for example, > running this at the repl... I'

Re: h4dev.com: Searchable database for clojure development topics

2010-02-01 Thread Alex Osborne
Gene Tani wrote: http://h4dev.com/entries?search=multimethods So i'd like people to try it out, give me feedback (yah, the stylesheet and UI need work). For now i'm focused on the language and implementation, less focused on IDE's/editors, web app frameworks, ORM's, leiningen, incanter, stuff l

Re: Lazy (apply concat ...) ?

2010-02-01 Thread CuppoJava
Thanks for the help Richard. After playing around with 1.1.0 some more (I just upgraded). I'm finding that the chunked sequences is destroying all my code that relied on lazy sequences. Isn't the following a pretty standard thing to do? (for [i (range 20)] (do (println i)

Re: How to get Clojure.Contrib in my Classpath?

2010-02-01 Thread Wardrop
I had already tried using a colon as the separator, but it gave an error. I've also noticed that if neither path resolves to a file, it also errors, so it's finding clojure-contrib-1.1.0.jar. On Feb 2, 2:07 pm, tsuraan wrote: > > java -classpath "C:\Program Files\Clojure\clojure.jar";"C:\Program

Re: Lazy (apply concat ...) ?

2010-02-01 Thread Richard Newman
Am I understanding this correctly? It seems laziness is only an option in batches of 32 now. Indeed. *Processing* *chunked* lazy sequences can only be done in batches of 32. Custom lazy sequences (using (lazy-seq ...)) don't suffer from this. You might be interested in this blog post: http

Deadline Extended to Feb. 15: IEEE Software Multi-Paradigm Programming Special Issue - Sep/Oct 2010

2010-02-01 Thread Dean Wampler
Hi, Sorry for the repeat emails. We have extended the deadline for submissions for this special issue. It is now February 15th. If you thought about submitting a paper, but didn't think you could make the original deadline, we hope you will reconsider. http://www.computer.org/portal/web/computing

Re: How to get Clojure.Contrib in my Classpath?

2010-02-01 Thread tsuraan
> I had already tried using a colon as the separator, but it gave an > error. I've also noticed that if neither path resolves to a file, it > also errors, so it's finding clojure-contrib-1.1.0.jar. Can you use it with (use 'clojure.contrib.duck-streams) ? Both ways work for me, but it's the only

Re: How to get Clojure.Contrib in my Classpath?

2010-02-01 Thread Wardrop
Ok, I found the problem. If quotes need to be used, the all paths including semi-colons need to be within a single pair of double quotes. For example... java -cp "C:\Program Files\Clojure\clojure.jar;C:\Program Files\Clojure \clojure-contrib-1.1.0.jar" clojure.main How subtitle is that. If only t

Re: How to get Clojure.Contrib in my Classpath?

2010-02-01 Thread Wardrop
I better provide credit to this page: http://forums.pragprog.com/forums/91/topics/1738 On Feb 2, 2:25 pm, Wardrop wrote: > I had already tried using a colon as the separator, but it gave an > error. I've also noticed that if neither path resolves to a file, it > also errors, so it's finding cloj

Re: Lazy (apply concat ...) ?

2010-02-01 Thread CuppoJava
Thanks for helping me through this Richard. I think I got the gist of the argument now from the blog post you linked to. Now that I think about it, *most* code doesn't break with chunked sequences, so that seems to be alright. Though generally I prefer following the principle of least-surprise...

Re: update-in and get-in why no default?

2010-02-01 Thread Meikel Brandmeyer
Hi Timothy, On Feb 2, 1:19 am, Timothy Pratley wrote: > There are still some sharp edges I'm not sure about: > (A) user=> (get-in {:a 1} []) > {:a 1} > ;; this is existing behavior, but I feel the result should be nil +1 for nil > (B) user=> (get-in {:a 1} nil) > {:a 1} > ;; this is existing b

Re: update-in and get-in why no default?

2010-02-01 Thread Richard Newman
There are still some sharp edges I'm not sure about: (A) user=> (get-in {:a 1} []) {:a 1} ;; this is existing behavior, but I feel the result should be nil +1 for nil I think I disagree. If you view 'get-in' as an unwrapping operation, unwrapping by zero steps should return the existing col

Re: update-in and get-in why no default?

2010-02-01 Thread Meikel Brandmeyer
Hi, On Feb 2, 7:55 am, Richard Newman wrote: > I think I disagree. Can you explain why you think the result should be nil? Woops. I got confused. I didn't mean nil for empty key sequences. I meant throwing an exception as does get. Sincerely Meikel -- You received this message because you ar

Re: How to Initiate Clojure Application

2010-02-01 Thread ataggart
On Feb 1, 2:54 pm, Wardrop wrote: > Ok, this seems to work... > > (ns localhost.test) > > (clojure.main/main (println "Hello!")) > > I then assume I'd use the special form "do" to perform multiple > unrelated tasks, such as... > > (clojure.main/main >   (do >     (println "Hello!") (println "Che

Re: idiomatic question about reader macro

2010-02-01 Thread ataggart
De gustibus non est disputandum. That said, I'd be interested in seeing a clojure example which benefits from a currently-non-existant reader macro. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: clojure.contrib.[duck-streams io]

2010-02-01 Thread ataggart
On Feb 1, 6:23 pm, OGINO Masanori wrote: > Hello. > > I built master branch of clojure and clojure-contrib and then I found > that there is no duck-streams. io exists. > > Can I write a code on both 1.1 and master using duck-streams/io? > > FYI, I want something like this Python code in Clojure

Re: clojure.contrib.[duck-streams io]

2010-02-01 Thread ataggart
On a related note, it is my sincere hope that we get a version of require and use which no longer require (ha!) the use of quoted parens. Thankfully the ns macro will work with solely nested vectors. -- You received this message because you are subscribed to the Google Groups "Clojure" group. T

Re: let-binding overrides binding-binding

2010-02-01 Thread Alex Osborne
Tom Hicks writes: > I can't seem to do this with the 'inc' function: > > user=> (binding [inc (fn [y] (+ 2 y))] (inc 44)) > 45 > > Why doesn't this work? See this thread: http://groups.google.com/group/clojure/browse_thread/thread/d772e114e50aace6 -- You received this message because you are