Re: let vs. let*

2009-03-07 Thread Meikel Brandmeyer
Hi, Am 07.03.2009 um 07:11 schrieb Stephen C. Gilardi: let* is an an internal implementation detail that supports the special form let. let* does no destructuring. And one might add, that let* is not part of the public API and should not be used directly. Sincerely Meikel smime.p7s Descri

Re: calling overloaded Java methods

2009-03-07 Thread Timothy Pratley
BTW Clojure has a future macro (and future-call function) now. --~--~-~--~~~---~--~~ 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 To unsubscribe from this g

Re: r994 UTF8 addition broke latin-1 characters (ISO-8859-1) - WAS: Re: Unicode, accented characters

2009-03-07 Thread max3000
Ok, so I ended up doing this in my code: String resource = "/exmentis/rules_main.clj"; InputStream is = getClass().getResourceAsStream(resource); String script = ... read in is as a String (like slurp) ... StringReader r = new StringReader(script); clojure.lang.Compi

Re: pmap slower than map when reducing

2009-03-07 Thread Jeffrey Straszheim
Cool! On Fri, Mar 6, 2009 at 5:35 PM, Dimiter malkia Stanev wrote: > > Thanks! Realized that a bit too late (Looked into the pmap source > code, but that's about it). > > I've split my job decision roughly 1000 x 1000 - now I'm getting 8 > times speedup, on 8 core machine: > > (reduce + >

Re: hash-map based on identity

2009-03-07 Thread Jeffrey Straszheim
java.util.IdentityHashMap On Sat, Mar 7, 2009 at 1:49 AM, Mark Engelberg wrote: > > Is there a variation of hash-map which supports comparison of keys > using identical? rather than = ? Ditto with sets. > > > > --~--~-~--~~~---~--~~ You received this message beca

Re: r994 UTF8 addition broke latin-1 characters (ISO-8859-1) - WAS: Re: Unicode, accented characters

2009-03-07 Thread Toralf Wittner
On Sat, 2009-03-07 at 05:43 -0800, max3000 wrote: > Ok, so I ended up doing this in my code: > > String resource = "/exmentis/rules_main.clj"; > InputStream is = getClass().getResourceAsStream(resource); > String script = ... read in is as a String (like slurp) ... > Strin

stopping a computation done in a "future" object

2009-03-07 Thread Laurent PETIT
Hello, Sometimes, one wants to answer to an event by starting a (potentially long) computation in the background. But if the same event is received again, one may want to stop the computation currently running in the background, and relaunch one in the background with newest data. Is this use cas

Re: stopping a computation done in a "future" object

2009-03-07 Thread David Powell
> Hello, > Sometimes, one wants to answer to an event by starting a > (potentially long) computation in the background. > But if the same event is received again, one may want to stop the > computation currently running in the background, and relaunch one in the > background with newest data. >

Re: hash-map based on identity

2009-03-07 Thread David Powell
> Is there a variation of hash-map which supports comparison of keys > using identical? rather than = ? Ditto with sets. There is java.util.IdentityHashMap, but it is mutable. What objects are you trying to store? The ideal in the Clojure world, is that most objects are immutable. Immutable

Re: clojure.contrib.stacktrace

2009-03-07 Thread Stuart Sierra
On Mar 6, 5:14 pm, Mark Volkmann wrote: > What's the recommended way to use this library in code that is run > outside a REPL to simplify stack traces so they focus on Clojure code > instead of Java code? Hi Mark, I wrote that library so I could use it in test-is, so I'm not sure if it will hel

Re: Datalog update

2009-03-07 Thread Jeffrey Straszheim
I've added some Datalog material to the wiki: http://code.google.com/p/clojure-contrib/wiki/DatalogOverview On Wed, Feb 18, 2009 at 4:55 PM, Jeffrey Straszheim < straszheimjeff...@gmail.com> wrote: > Makes sense. That would work. It certainly looks cleaner. > > > On Wed, Feb 18, 2009 at 4:51 P

Re: clojure.contrib.stacktrace

2009-03-07 Thread Mark McGranaghan
Hi Mark, Stuart might be referring to clj-backtrace: http://github.com/mmcgrana/clj-backtrace This library parses the Java exception information and renders it for better readability, especially for elements in the trace corresponding to Clojure code. user=> (try ("foo") (catch Exception e (pst

Re: Workflow poll?

2009-03-07 Thread Stuart Sierra
On Mar 6, 10:35 am, levand wrote: > Anyway, that's my process, and my frustrations. How do you all do it? I use Emacs + SLIME on Linux. I have each project in a git repository, including Clojure and all the other JARs it requires, with a shell script to start the REPL with the appropriate class

Re: What is Clojure NOT good for?

2009-03-07 Thread Stuart Sierra
On Mar 6, 9:47 am, lprefonta...@softaddicts.ca wrote: > For us Clojure = less useless code lines = fast delivery > = less test headaches = major success : I agree 100%, although I have the unusual advantage of working alone. The succinctness of Lisp with Java's library support is a perfect co

Re: clojure.contrib.stacktrace

2009-03-07 Thread Mark Volkmann
On Sat, Mar 7, 2009 at 10:31 AM, Stuart Sierra wrote: > > On Mar 6, 5:14 pm, Mark Volkmann wrote: >> What's the recommended way to use this library in code that is run >> outside a REPL to simplify stack traces so they focus on Clojure code >> instead of Java code? > > Hi Mark, > > I wrote that

LazyMap v2.2 released

2009-03-07 Thread Meikel Brandmeyer
Dear Clojurians, I'd like to announce release of LazyMap v2.2. New in this release are: * compatibility with lazy-seq changes * LazyMapSeq now inherits from ASeq * 100% reflection free The release maybe found at the usual place: http://kotka.de/projects/clojure/lazy-map.html Sincerely Me

Re: r994 UTF8 addition broke latin-1 characters (ISO-8859-1) - WAS: Re: Unicode, accented characters

2009-03-07 Thread max3000
The default character set on WinXP (which I use) is windows-1252 (cp1252). Check out http://www.rgagnon.com/javadetails/java-0505.html. If I were to change my source file encodings to UTF-8 that would probably get me some mileage. Of course, I would have to use an editor that supports it and not

Re: Shouldn't "doto" be named just "with"

2009-03-07 Thread Dan
On Fri, Mar 6, 2009 at 7:51 PM, rzeze...@gmail.com wrote: > > I think good arguments have been made for "doto," but I must say I > prefer "with" slightly more. with can mean different things in different languages. In javascript, it means the same thing as doto in clojure but in Python (and many

Re: Chrono date library

2009-03-07 Thread Allen Rohner
> > Yes, but any library that requires third-party jars can't be used out of > the box in contrib, and I think a language that doesn't support > date-processing out of the box is at a severe disadvantage. > One of the primary reasons Clojure is on the JVM is to re-use Java libraries. Date & Time

Re: hash-map based on identity

2009-03-07 Thread Mark Engelberg
Here's why it would be useful to have the option of hash maps that use identity... Let's say my keys are rather long lists. Equality comparison will be slow. But if I know that the keys are always the exact same long lists (perhaps because I traversed the key sequence to find a key with a certa

Re: Workflow poll?

2009-03-07 Thread Mark Engelberg
Anyone using IntelliJ or Netbeans as their primary development environment, or is that stuff too experimental? I've been using the Clojure-in-a-box setup for Windows, which was absolutely instrumental in getting me to try out Clojure. But if I keep downloading the latest versions of Clojure, it

Re: Shouldn't "doto" be named just "with"

2009-03-07 Thread Dimiter "malkia" Stanev
Yes, that's a very good point. For example "with" in Common Lisp is used also when dealing with external resources (with-open-file, etc.). And also the point about other with- usages. On Mar 7, 10:31 am, Dan wrote: > On Fri, Mar 6, 2009 at 7:51 PM, rzeze...@gmail.com wrote: > > > I think good a

Re: hash-map based on identity

2009-03-07 Thread David Nolen
Depending on what you are doing perhaps you could use (hash x). This might not be very helpful if you need to update keys frequently. However if you're mostly doing lookups, then this would help quite a bit. On Sat, Mar 7, 2009 at 3:44 PM, Mark Engelberg wrote: > > Here's why it would be useful t

Re: hash-map based on identity

2009-03-07 Thread Rich Hickey
On Mar 7, 3:44 pm, Mark Engelberg wrote: > Here's why it would be useful to have the option of hash maps that use > identity... > > Let's say my keys are rather long lists. Equality comparison will be > slow. But if I know that the keys are always the exact same long > lists (perhaps because

defining types and interfaces

2009-03-07 Thread mikel
Most conventional object-oriented languages conflate data layout with protocol, by gluing those two orthogonal concepts together in classes. If you want the behavior provided by a class, you have to take the data layout with it, and vice versa, even though the two things are logically orthogonal,

Re: defining types and interfaces

2009-03-07 Thread James Reeves
The nearest equivalent to Haskell type classes in Clojure are multimethods, but as Clojure is a dynamically typed language, the compiler does not enforce the 'interface' defined by the multimethods. In Clojure, I can't think of any way you could enforce such a contract at compile time. Clojure is

Re: hash-map based on identity

2009-03-07 Thread Mark Engelberg
On Sat, Mar 7, 2009 at 2:57 PM, Rich Hickey wrote: > Identity is tested first in equality, if identical, equal, full stop. > So if you are using identical and unique collections as keys you'll > find them without a value-by-value comparison. If they are not > present, it's unlikely you'll get a m

Re: hash-map based on identity

2009-03-07 Thread Rich Hickey
On Mar 7, 2009, at 8:30 PM, Mark Engelberg wrote: > > On Sat, Mar 7, 2009 at 2:57 PM, Rich Hickey > wrote: >> Identity is tested first in equality, if identical, equal, full stop. >> So if you are using identical and unique collections as keys you'll >> find them without a value-by-value comp

Re: hash-map based on identity

2009-03-07 Thread Stephen C. Gilardi
On Mar 7, 2009, at 8:30 PM, Mark Engelberg wrote: But if the key is a long list, wouldn't it have to traverse the list just to come up with the hash code for that list? Yes, but only once. Since Clojure lists are immutable, their hash code is calculated once and cached and the cache will ne

swank-clojure + slime

2009-03-07 Thread youngblood.carl
Howdy all, I'm brand new to this scene (where scene means lisp, closure, linux, and emacs), so apologies if this has been addressed. My goal is to make sure I'm up to date before moving forward. I set up my emacs/slime development environment like various tutorials suggested, except I received t

filter-split

2009-03-07 Thread David Sletten
I'm reading the Sequences chapter of Programming Clojure, and Stu points out that split-with combines the semantics of take-while and drop-while. But is there a function that does something similar with "filter"? Namely, rather than simply filtering the elements of a collection that satisf

Re: filter-split

2009-03-07 Thread Jeffrey Straszheim
There is separate in seq_utils in contrib. On Sat, Mar 7, 2009 at 11:29 PM, David Sletten wrote: > > I'm reading the Sequences chapter of Programming Clojure, and Stu > points out that split-with combines the semantics of take-while and > drop-while. But is there a function that does something s

Re: filter-split

2009-03-07 Thread e
check the discussion with the subject, "time lies, even with doall". We came up with something like the following, but some name change change tweaks were suggested. This thing takes a pred and a collection and returns a list of two collections -- one that passes the pred, and one that fails. (d

Re: Monad tutorial, part 1

2009-03-07 Thread kkw
Hi folks, Whilst we are talking about monads, allow me to direct all and sundry to: http://www.mefeedia.com/tags/brian_beckman Brian Beckman gives a very beautiful description about monads. I find these tutorials very well done. I commend them. Kev On Mar 7, 12:19 am, Konrad Hinsen w

Re: filter-split

2009-03-07 Thread Adrian Cuthbertson
That's the beauty of this language - there are many ways to skin the cat! Here's a version using reduce... (defn filt-split [pred col] (reduce (fn [[a b] x] (if (pred x) [(conj a x) b] [a (conj b x)])) [[] []] col)) (filt-split even? [1 2 3 4 5 6 7 8]) [[2 4 6 8] [1 3 5 7]] But when you look a

Re: filter-split

2009-03-07 Thread David Sletten
On Mar 7, 2009, at 7:17 PM, Adrian Cuthbertson wrote: > > That's the beauty of this language - there are many ways to skin > the cat! Hmmm...I'm not sure what I'll do with a skinless cat. :) > Here's a version using reduce... > > (defn filt-split [pred col] > (reduce (fn [[a b] x] (if (pred

Re: filter-split

2009-03-07 Thread David Sletten
On Mar 7, 2009, at 6:44 PM, e wrote: > check the discussion with the subject, "time lies, even with > doall". We came up with something like the following, but some > name change change tweaks were suggested. This thing takes a pred > and a collection and returns a list of two collection

Re: filter-split

2009-03-07 Thread Adrian Cuthbertson
> ...repeated creation of the ephemeral vectors isn't too expensive. With Clojure, although it looks like the immutable vectors are being re-created on each iteration, under the covers it's really just pointers being updated and the operations are (about) as efficient as a loop/recur method. > .

Re: defining types and interfaces

2009-03-07 Thread mikel
On Mar 7, 5:43 pm, James Reeves wrote: > The nearest equivalent to Haskell type classes in Clojure are > multimethods, but as Clojure is a dynamically typed language, the > compiler does not enforce the 'interface' defined by the multimethods. > > In Clojure, I can't think of any way you could