Re: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
John, I was looking at the validates method and I had a thought I'd bounce off you. Instead of just returning a hash of errors what about returning the record with the errors hash in the metadata? That way you just have the data and the errors in one "object" similar to an ActiveRecord model.

Re: literate snake

2009-01-04 Thread Christian Vest Hansen
On Sun, Jan 4, 2009 at 11:48 AM, Timothy Pratley wrote: > > From a cursory examination of "literate programming" central tenants > appear to be: > (1) order by human logic > (2) use descriptive macros > (3) program is a web > > (1) Is not possible in Clojure because it resolves symbols as it read

Re: Functional Shuffle

2009-01-04 Thread Chouser
On Sun, Jan 4, 2009 at 10:17 PM, aria42 wrote: > > Hey all, I wanted to write a functional shuffle sequence (not lazy) > rather than call out to Java. See also: http://groups.google.com/group/clojure/browse_thread/thread/180842eb58c58370 --Chouser --~--~-~--~~~---~

Re: Using a directory full of symlinks to manage the Classpath for Clojure REPLs

2009-01-04 Thread Stephen C. Gilardi
On Jan 4, 2009, at 10:07 PM, Drew Raines wrote: java.ext.dirs has a default value that -Djava.ext.dirs overwrites, so make sure you replace whatever your platform's Java expects (like $JAVA_HOME/lib/ext). I've been bitten before trying to speak HTTPS while not having sunpkcs11.jar available.

Functional Shuffle

2009-01-04 Thread aria42
Hey all, I wanted to write a functional shuffle sequence (not lazy) rather than call out to Java. If anyone is interested here it is. If anyone thinks there is a better way to implement the rifle shuffle, let me know. Not asserting it's the most efficient or anything. http://clojure.googlegroups.

Re: Using java.ext.dirs to manage the Classpath for Clojure REPLs

2009-01-04 Thread Drew Raines
Stephen C. Gilardi wrote: > The "java.ext.dirs" System property provides a very convenient way to > set up and maintain a Classpath for Clojure REPLs. [...] > In my case, I set the value of java.ext.dirs to a list of just one > directory. That directory contains (relative) symbolic links to all

Re: Namespace Level Docstrings

2009-01-04 Thread Rich Hickey
On Jan 4, 6:27 pm, Meikel Brandmeyer wrote: > Hi, > > Am 04.01.2009 um 22:01 schrieb Mark McGranaghan: > > > (ns clojure.zip > > (:refer-clojure :exclude (replace remove)) > > (:doc "Functional hierarchical zipper, with navigation, editing and > >enumeration. See Huet.")) > > > Is any

Re: Questions & workaround regarding Clojure, true laziness, and nil-terminated sequences

2009-01-04 Thread Chouser
On Sun, Jan 4, 2009 at 5:51 PM, Jason Wolfe wrote: > > That does satisfy my requirements as a lazy stack data structure. > However, it does so by adding an inner level of cons objects; this is > more or less equivalent to just calling (delay) on each level of the > seq and then having to explicit

Re: Using java.ext.dirs to manage the Classpath for Clojure REPLs

2009-01-04 Thread rzeze...@gmail.com
On Jan 4, 6:06 pm, lpetit wrote: > Note that since JDK 1.6, it is possible to use the * wildcard in > classpath items to embed all the jars in a directory at once. > > So with proper use of links in a "root" directory containing a bunch > of jars, it's possible to shorten the classpath to DIR/*

Re: Using java.ext.dirs to manage the Classpath for Clojure REPLs

2009-01-04 Thread rzeze...@gmail.com
I think this should be fine for 99% of situations, but I think it's also fair to say this is an unorthodox use of java.ext.dirs. I've never really had a firm grip on the idiomatic use of Java's extension mechanism, but I do know that they claim it is for well-established extension/optional packag

Re: finding all vars starting with *

2009-01-04 Thread Meikel Brandmeyer
Hi, Am 05.01.2009 um 00:05 schrieb Brian Doyle: Today I found out about the var *file*. I looked it up *file* on clojure.com/api and couldn't find anything. Is there some place where all of these vars are defined? Is there some way programatically I can find them all? Thanks. Be caref

Re: recur with many parameters

2009-01-04 Thread Meikel Brandmeyer
Hi, Am 04.01.2009 um 18:23 schrieb Emeka: I have not been able to get my head around destructuring binding. Please explain it to me with examples http://clojure.org/special_forms#toc4 with examples... Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: Namespace Level Docstrings

2009-01-04 Thread Meikel Brandmeyer
Hi, Am 04.01.2009 um 22:01 schrieb Mark McGranaghan: (ns clojure.zip (:refer-clojure :exclude (replace remove)) (:doc "Functional hierarchical zipper, with navigation, editing and enumeration. See Huet.")) Is anyone else interested in namespace-level docstrings? Any thoughts on what t

Re: Using java.ext.dirs to manage the Classpath for Clojure REPLs

2009-01-04 Thread lpetit
Note that since JDK 1.6, it is possible to use the * wildcard in classpath items to embed all the jars in a directory at once. So with proper use of links in a "root" directory containing a bunch of jars, it's possible to shorten the classpath to DIR/*:classes:src BTW, java.ext.dirs' semantics i

finding all vars starting with *

2009-01-04 Thread Brian Doyle
Today I found out about the var *file*. I looked it up *file* on clojure.com/api and couldn't find anything. Is there some place where all of these vars are defined? Is there some way programatically I can find them all? Thanks. --~--~-~--~~~---~--~~ You receive

Re: Questions & workaround regarding Clojure, true laziness, and nil-terminated sequences

2009-01-04 Thread Jason Wolfe
Thanks a lot for your very detailed response Chouser! report-seq is a very useful way to look at this stuff. > ... > Unless I've completely misunderstood your scenario, I think this > demonstrates that the seq abstraction as it currently exists is > sufficient for providing the kind of laziness

Re: literate snake

2009-01-04 Thread Mark Volkmann
On Sun, Jan 4, 2009 at 3:51 PM, Tom Ayerst wrote: > I tidied up a couple of things: > Changed function name 'verify-direction' to 'new-direction' (it is more than > a simple verification) Sounds good. I made that change to mine. > Passed 'direction' and 'snake-head' to 'new-direction' to avoid

Re: literate snake

2009-01-04 Thread Tom Ayerst
I tidied up a couple of things: Changed function name 'verify-direction' to 'new-direction' (it is more than a simple verification) Passed 'direction' and 'snake-head' to 'new-direction' to avoid accessing global state from inside the function Used destructuring to simplify let statement in new-hea

Re: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
Looks good. I didn't know about the *file* var. On Sun, Jan 4, 2009 at 11:22 AM, John D. Hume wrote: > > Brian, > I incorporated your changes and then made changes to load and run all > clj_record/test/*-test.clj files. Thanks again. > -hume. > > > > --~--~-~--~~~---

Namespace Level Docstrings

2009-01-04 Thread Mark McGranaghan
Clojure revision 1193 introduces metadata handling for namespaces and other Reference types. I was thinking this could be used to add support for ns-level docstrings such as we currently have for vars. Such support would allow programatic access to namespace documentation. I was thinking of somet

Re: Slow nested subvecs (+ fix)

2009-01-04 Thread Jason Wolfe
> > Have you considered using clojure.lang.PersistentQueue instead of > vector and subvec? Indeed, I am using that, thanks. (I happened to stumble across an earlier newsgroup post on this subject). Maybe all of the useful conj/ subvec usage patterns for vectors can be served by PersistentQue

Re: Could not find the main class clojure.lang.Repel. Program will exit.

2009-01-04 Thread chris
SWEET! That did it. I knew that I had to be doing something stupid. That won't be the first time I am sure. Thank you for the help. On Jan 4, 12:13 pm, "Stephen C. Gilardi" wrote: > On Jan 3, 2009, at 7:57 PM, chris wrote: > > > I was wondering if anyone else had a problem with this. I am trying

Re: Slow nested subvecs (+ fix)

2009-01-04 Thread Chouser
On Sun, Jan 4, 2009 at 2:55 PM, Jason Wolfe wrote: > > Now that I think about it some more, though, this change doesn't > really address the whole problem. > > ; Time to queue up and dequeue a bunch of elements > user> (doseq [n '(10 100 1000 1 10)] >(do (prn n) >(time

Re: Slow nested subvecs (+ fix)

2009-01-04 Thread Jason Wolfe
Nope, I have not sent in a CA yet. I'll do it sometime this week. Now that I think about it some more, though, this change doesn't really address the whole problem. ; Time to queue up and dequeue a bunch of elements user> (doseq [n '(10 100 1000 1 10)] (do (prn n) (t

Re: broken link http://clojure.org/api#condp

2009-01-04 Thread Chouser
On Sun, Jan 4, 2009 at 2:18 PM, Eric Lavigne wrote: > > At http://clojure.org/macros, condp is listed as one of the branching > macros, but its link is broken. The API page doesn't have condp yet. When it does, the link will work. In the meantime you'll have to get by with (doc condp) --Chous

broken link http://clojure.org/api#condp

2009-01-04 Thread Eric Lavigne
At http://clojure.org/macros, condp is listed as one of the branching macros, but its link is broken. -- Education is what survives when what has been learned has been forgotten. - B. F. Skinner --~--~-~--~~~---~--~~ You received this message

Re: clojure.contrib.sql (connection) public?

2009-01-04 Thread Stephen C. Gilardi
On Dec 15, 2008, at 6:48 AM, black...@ipowerhouse.com wrote: This may be a problem with the way I'm doing things but I think it would be useful for the (connection) function of internal to not be internal. For example, lets say i do a query on a db to see if a user exists, if they don't I want

Re: Some code review for clj-record?

2009-01-04 Thread John D. Hume
Brian, I incorporated your changes and then made changes to load and run all clj_record/test/*-test.clj files. Thanks again. -hume. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gro

Re: Could not find the main class clojure.lang.Repel. Program will exit.

2009-01-04 Thread Stephen C. Gilardi
On Jan 3, 2009, at 7:57 PM, chris wrote: I was wondering if anyone else had a problem with this. I am trying to run clojure on Vista. I think that the problem might be with my environmental variables but I am not sure which ones to changes or where to point them too. Thank you for your help.

Re: Could not find the main class clojure.lang.Repel. Program will exit.

2009-01-04 Thread Emeka
Chris, I run my Clojure on Vista and I have not experienced what you mentioned. I would like to know what you have done. Your installation details. And did you download your Clojure.jar or did you use ant to build yours? Emeka On Sun, Jan 4, 2009 at 12:57 AM, chris wrote: > > I was wondering i

mset

2009-01-04 Thread Timothy Pratley
A while ago I wrote a short MUD which had to keep track of a changing group of players, and other data. Retrospectively I've developed a helper which can update in place any mutable map, handles nested access, and behaves like assoc on immutables. It allows usage like so: ; set up a mutable map o

Using java.ext.dirs to manage the Classpath for Clojure REPLs

2009-01-04 Thread Stephen C. Gilardi
The "java.ext.dirs" System property provides a very convenient way to set up and maintain a Classpath for Clojure REPLs. The property can be set from the command line used to launch Clojure (typically within a launcher script). Its value is a list of directories whose *contents* will be the

Could not find the main class clojure.lang.Repel. Program will exit.

2009-01-04 Thread chris
I was wondering if anyone else had a problem with this. I am trying to run clojure on Vista. I think that the problem might be with my environmental variables but I am not sure which ones to changes or where to point them too. Thank you for your help. --~--~-~--~~~---

Re: Math functions

2009-01-04 Thread vogelrn
sqrt(a/b) should always be equal to sqrt(a)/sqrt(b) since (a/b)^m = a^m/b^m for b != 0. However, I'm unsure of whether it's the best option for ratios because unless both the numerator and the denominator are perfect squares, you're going to end up with a float anyway. This is trading an extra s

Re: meaning and pronunciation of Clojure

2009-01-04 Thread Ed
I have been wanting to know the same thing...I was guessing Clojure was an acronym for: Common_Lisp_Object_Java_?something?_?something?_? something?, or possibly Concurrency_Language_OnThe_JVM_?something?_? something?_?something?...I am dying to know. Or, like others have cited, Closure en Franca

Re: recur with many parameters

2009-01-04 Thread Emeka
Christian I have not been able to get my head around destructuring binding. Please explain it to me with examples Venlig hilsen Emeka On Sat, Jan 3, 2009 at 11:04 PM, Christian Vest Hansen wrote: > > Instead of throwing a1..aN around every time, you could use the result > vector and use des

Re: Adding user-defined state to classes created with (proxy ...)

2009-01-04 Thread Chouser
On Sun, Jan 4, 2009 at 1:28 AM, Tom Faulhaber wrote: > > 1) This use case may be obscure enough that I should just buckle down > and give (ns (:gen-class ...)) some love. It may be, but let me again mention the option of gen-interface plus proxy. Sometimes you need to produce a physical .class

Re: calling Clojure from Java

2009-01-04 Thread Stuart Sierra
On Jan 3, 8:13 pm, "Mark Volkmann" wrote: > I'd like to learn how to invoke Clojure code from a Java application. > I see at least two options. > > 1) From a Java application, read a text file containing Clojure code > and invoke specific functions it defines from Java code. Here's how I do it:

Re: clj-backtrace: more readable backtraces for Clojure

2009-01-04 Thread Paul Barry
This is very nice, any chance we could see this added to clojure contrib? On Thu, Jan 1, 2009 at 9:30 PM, Mark McGranaghan wrote: > > Hi all, > > I'm happy to announce an alpha release of clj-backtrace, a library for > processing backtraces generated by Clojure programs. The library works > by s

Re: Release of VimClojure 1.3.0

2009-01-04 Thread Timothy Pratley
Hi Meikel, Firstly thanks for making VimClojure, it is really great! I especially like the rainbow parenthesis, that's extremely useful. Also just reporting a small syntax highlighting consideration user=> (def f #(println @%1)) #'user/f user=> (f (atom 5)) 5 @%1 tricks it and %1 is not shown a

Re: detecting running as script

2009-01-04 Thread Mark Volkmann
On Sun, Jan 4, 2009 at 3:57 AM, Timothy Pratley wrote: > >> I suspect that *command-line-arguments* would have "myapp.clj" as the >> 0th element in the >> clj myapp.clj >> Can't test right now though sorry. > > I tested this and it does work for me. If it does not work for you is > most likely in

Re: Compiling Clojure code with Maven

2009-01-04 Thread ivant
On Dec 31 2008, 4:49 pm, "Mike DeLaurentis" wrote: > I'm working on a project that has both Java and Clojure sources. We > use Maven as our build system, and I'd like to use it to compile the > Clojure sources. Has anyone done that before? I can think of a few > ways to do it, such as using maven

Re: automatic concurrency

2009-01-04 Thread Konrad Hinsen
On 03.01.2009, at 21:20, Mark Volkmann wrote: > One of the stated benefits of functional programming I've seen is that > the compiler of a functional language can analyze code and determine > statements within a function > that can safely be run concurrently. As > far as I know Clojure doesn't ye

Re: clj-backtrace: more readable backtraces for Clojure

2009-01-04 Thread Konrad Hinsen
On 03.01.2009, at 18:58, Mark McGranaghan wrote: > It prints the cleaned backtrace. Could you provide REPL sessions like > these that indicate the unexpected behavior? Sorry for the false alarm: I had used different shell scripts for launching Clojure with and without your library, and I just

Re: literate snake

2009-01-04 Thread Timothy Pratley
>From a cursory examination of "literate programming" central tenants appear to be: (1) order by human logic (2) use descriptive macros (3) program is a web (1) Is not possible in Clojure because it resolves symbols as it reads them. However that is easy to work around with a trivial patch (see h

Re: detecting running as script

2009-01-04 Thread Meikel Brandmeyer
Hi, Am 04.01.2009 um 11:15 schrieb Timothy Pratley: I can't seem to get this approach working: http://clojure.org/compilation seems to imply that this approach can only be taken using :gen-class and pre-compiling before calling in this way (which makes sense as my.app is not a class yet). Ye

Re: detecting running as script

2009-01-04 Thread Timothy Pratley
Hi Meikel, On Jan 3, 9:03 pm, Meikel Brandmeyer wrote: > java -cp my.app I can't seem to get this approach working: I created a directory "my" and a file "app.clj" containing: (ns my.app) (defn somefunc []) (println "somefunc!" args)) (defn main [& args] (somefunc)) C:\java>java -cp .;"c:

Re: detecting running as script

2009-01-04 Thread Timothy Pratley
> I suspect that *command-line-arguments* would have "myapp.clj" as the > 0th element in the > clj myapp.clj > Can't test right now though sorry. I tested this and it does work for me. If it does not work for you is most likely in your clj script or bat file. I noticed on the wiki the incorrect a