Re: update in place for unique references

2009-01-08 Thread Mark Engelberg
Clean doesn't allow mutation, so it has to do tricks like this or else you'd never be able to write a useful program. Clojure gives you a set of data structures that do very fast non-destructive update. Clojure also gives you tools like atoms, refs, and full access to Java's mutable behavior to

Re: writing bytes to a file

2009-01-08 Thread James Reeves
On Jan 7, 7:14 pm, "Brian Doyle" wrote: >    (defn write-bytes >      "Writes the bytes from the in-stream to the given filename." >      [#^java.io.InputStream in-stream #^String filename] >      (with-open [out-stream (new FileOutputStream filename)] >        (let [buffer (make-array (Byte/TYPE

Re: Slime buffer ns is always user

2009-01-08 Thread Zak Wilson
Thanks for your help with this problem, Bill. The function you provided causes slime-repl-set-package to suggest the correct namespace, which is convenient. It doesn't appear to have any effect on my problem though. --~--~-~--~~~---~--~~ You received this message b

Clojure blog post about laziness

2009-01-08 Thread Mark Engelberg
A few days ago, Stuart Halloway and I had an offline discussion about some of the "gotchas" related to Clojure's laziness. He encouraged me to blog about my thoughts on the matter. On a related note, about a month ago, I posted comments about Clojure's laziness. Rich's response was: "The argum

Probability distributions in Clojure

2009-01-08 Thread Konrad Hinsen
I have just added a new module for handling (finite) probability distributions to clojure-contrib. Some examples are included as well, but for those who want to see the examples without downloading the clojure-contrib source code, I also uploaded them to the files section of this group:

Re: Probability distributions in Clojure

2009-01-08 Thread aria42
Hey Conrad, this is great. The only suggestion I'd make is that often times you want a probability distribution which is updatable over time. This happens in online learning as well as Gibbs sampling where you always only implicitly store the posterior b/c it's changing constantly. So in my resea

Re: update in place for unique references

2009-01-08 Thread Mark P
> Clojure gives you a set of data structures that do very fast > non-destructive update.  Clojure also gives you tools like atoms, > refs, and full access to Java's mutable behavior to specify update in > place if that's what you want. Yes, I can see that one could implement this oneself via Java

Re: yet another Clojure snake

2009-01-08 Thread Tom Ayerst
Hi Mark, I don't think this approach works in Clojure / Swing, but I may be mistaken, I often am. The issue is the event thread. In Abhishek's original and it's derivatives the Swing event thread is used and the timer pushes events into it so key press events and the game timer run in the same

Re: Some code review for clj-record?

2009-01-08 Thread Emeka
user=> (load-file "clj_record/core.clj") I got clj_record/util not in system path. Why is it so? Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Clojure blog post about laziness

2009-01-08 Thread Konrad Hinsen
On 08.01.2009, at 11:22, Mark Engelberg wrote: > So my blog post has a dual purpose. First, I explain the "gotcha" > that Stuart and I discussed. Second, I report back to the community > about the actual experience I had in the past month, exploring > laziness in Clojure. I decided to blog it

Re: Probability distributions in Clojure

2009-01-08 Thread Konrad Hinsen
On 08.01.2009, at 11:38, aria42 wrote: > Hey Conrad, this is great. The only suggestion I'd make is that often > times you want a probability distribution which is updatable over > time. This happens in online learning as well as Gibbs sampling where Definitely. The current module for transformi

Re: Clojure blog post about laziness

2009-01-08 Thread Rich Hickey
On Jan 8, 7:26 am, Konrad Hinsen wrote: > On 08.01.2009, at 11:22, Mark Engelberg wrote: > > > So my blog post has a dual purpose. First, I explain the "gotcha" > > that Stuart and I discussed. Second, I report back to the community > > about the actual experience I had in the past month, exp

Re: writing bytes to a file

2009-01-08 Thread Randall R Schulz
On Thursday 08 January 2009 01:28, James Reeves wrote: > On Jan 7, 7:14 pm, "Brian Doyle" wrote: > >    (defn write-bytes > >      "Writes the bytes from the in-stream to the given filename." > >      [#^java.io.InputStream in-stream #^String filename] > >      (with-open [out-stream (new FileOut

Reader metadata syntax vs. (with-meta ...)

2009-01-08 Thread Tomasz
Hi. I'm just wondering wether it's a feature or a bug: (if (= (meta (with-meta [] {:test-key true})) (meta #^{:test-key true} [])) "same" "not same") => "not same" This behaviour is repeatable for empty lists, vectors and maps. Is this intentional? Nonempty collections work as expe

Re: Clojure blog post about laziness

2009-01-08 Thread Konrad Hinsen
On 08.01.2009, at 14:55, Rich Hickey wrote: > difference to the consumers of your sequence" is simply untrue. The > promise of the abstraction is not merely that the nth item/rest will > be equal - it is that it will be identical. I.e. a seq is persistent > and immutable. There's nothing wrong wi

Re: Clojure DSL & JVM method length limits

2009-01-08 Thread rossjudson
Isn't there a (roughly) 64k limit on the bytecode for any given method? There's definitely some kind of JVM limit. RJ On Jan 7, 12:12 am, Michiel de Mare wrote: > I'm converting a Ruby DSL into Clojure, and I'm running into some > problems. I keep getting errors like this one: > > java.lang.Cla

Re: Clojure blog post about laziness

2009-01-08 Thread Matt Revelle
On Jan 8, 2009, at 8:55 AM, Rich Hickey wrote: > > > > On Jan 8, 7:26 am, Konrad Hinsen wrote: >> On 08.01.2009, at 11:22, Mark Engelberg wrote: >> >>> So my blog post has a dual purpose. First, I explain the "gotcha" >>> that Stuart and I discussed. Second, I report back to the community >

Re: update in place for unique references

2009-01-08 Thread Mark Fredrickson
Time for another person named Mark to chime in. I expect to hear from all the other Marks before this thread is over. I have three responses to your suggestion: 1. Data: Is this really a problem that is slowing down Clojure programs in practice? Can you provide some data to that effect? I

Re: File organization & bootstrapping

2009-01-08 Thread Stuart Sierra
On Jan 7, 12:19 am, "Phil Hagelberg" wrote: > The problem with this is that now you have to repeat your classpath in > two places: your SLIME config and the shell script that you use to > launch your app. This is a DRY[1] violation. I guess I just take that for granted with Java. The classpath

Re: test-is: is called? [PATCH]

2009-01-08 Thread Stuart Sierra
Nice work, Allen. I want to add stubs/mocks to test-is. One question -- would it work without Var.pushThreadBindings, maybe using a combination of "with-local-vars" and "binding"? I was also thinking of modifying "report" to throw AssertionError, like your "throwing-report", so that I can get a

Re: yet another Clojure snake

2009-01-08 Thread Mark Volkmann
On Thu, Jan 8, 2009 at 5:08 AM, Tom Ayerst wrote: > Hi Mark, > > I don't think this approach works in Clojure / Swing, but I may be > mistaken, I often am. > > The issue is the event thread. In Abhishek's original and it's derivatives > the Swing event thread is used and the timer pushes events

Re: writing bytes to a file

2009-01-08 Thread Brian Doyle
I incorporated most of James ideas but I don't like the name pipe-stream. (defn write-stream "Writes the data from the istream to the ostream." ([#^java.io.InputStream istream #^java.io.OutputStream ostream #^Integer buffer-size] (let [buffer (make-array (Byte/TYPE) buffer-size)]

Re: yet another Clojure snake

2009-01-08 Thread Tom Ayerst
The point, for me, is that Mark Engelberg's construct allowed the system to work with no mutation and I don't think you can do it with Swing implemented the way it is (your latest version puts the mutation in an atom). Given that, and the problems with to threads accessing the Swing layer, I think

Re: Slime buffer ns is always user

2009-01-08 Thread Bill Clementson
On Thu, Jan 8, 2009 at 2:01 AM, Zak Wilson wrote: > > Thanks for your help with this problem, Bill. > > The function you provided causes slime-repl-set-package to suggest the > correct namespace, which is convenient. It doesn't appear to have any > effect on my problem though. The slime-find-buf

Re: Clojure blog post about laziness

2009-01-08 Thread MikeM
> > Do people want it now? > I would vote for 1.0 ahead of streams if adding streams now will delay 1.0. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@

Re: yet another Clojure snake

2009-01-08 Thread Mark Volkmann
On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst wrote: > The point, for me, is that Mark Engelberg's construct allowed the system to > work with no mutation I don't yet see how that is possible. The detection of key presses has to happen in the Swing thread (by getting a call to keyPressed). That th

Re: test-is: is called? [PATCH]

2009-01-08 Thread Allen Rohner
On Jan 8, 10:27 am, Stuart Sierra wrote: > Nice work, Allen.  I want to add stubs/mocks to test-is.  One question > -- would it work without Var.pushThreadBindings, maybe using a > combination of "with-local-vars" and "binding"? > It should be possible to make that work with binding. I did it

Re: Clojure blog post about laziness

2009-01-08 Thread chris
Mark, I thought your blog post was really, really good. I have forwarded it to a lot of people; I hope you don't mind! As far as caching goes: I think, regardless of the theoretical considerations of = that caching a lot of objects is ridiculous from a performance perspective. Access to ram ta

Re: Clojure blog post about laziness

2009-01-08 Thread Mark Engelberg
On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey wrote: > The > promise of the abstraction is not merely that the nth item/rest will > be equal - it is that it will be identical. I.e. a seq is persistent > and immutable. I get that Clojure is making a promise of identity here, which is not possible i

Re: yet another Clojure snake

2009-01-08 Thread Chouser
On Thu, Jan 8, 2009 at 12:05 PM, Tom Ayerst wrote: > The point, for me, is that Mark Engelberg's construct allowed the system to > work with no mutation and I don't think you can do it with Swing implemented > the way it is (your latest version puts the mutation in an atom). Isn't a GUI by defin

Re: Clojure blog post about laziness

2009-01-08 Thread Rich Hickey
On Jan 8, 2009, at 1:06 PM, Mark Engelberg wrote: > > On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey > wrote: >> The >> promise of the abstraction is not merely that the nth item/rest will >> be equal - it is that it will be identical. I.e. a seq is persistent >> and immutable. > > I get that Cl

Re: writing bytes to a file

2009-01-08 Thread James Reeves
On Jan 8, 5:05 pm, "Brian Doyle" wrote: > I incorporated most of James ideas but I don't like the name pipe-stream. Then wouldn't copy-stream be better? write-stream isn't specific enough, IMO. Also, I don't think there's a huge amount of gain to be had from an Integer type hint in this case, s

Re: Clojure blog post about laziness

2009-01-08 Thread Mark Engelberg
On Thu, Jan 8, 2009 at 10:20 AM, Rich Hickey wrote: > On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey > I think the real test of non-cached seqs is to swap them in for > regular seqs, rebuild Clojure and some user libs and see what breaks > and why. Then you'll see the dependencies on caching that e

Re: Gen-interface signature

2009-01-08 Thread Greg Harman
A little time with the Clojure source and a debugger has been illuminating. In genclass.clj:gen-interface, the line: (let [options-map (apply hash-map options) results in this value for options-map: {:methods [[(quote foo) [] []]], :name mypkg.ICompileTest} It looks like "(quote foo)" is bei

Re: sort behavior question

2009-01-08 Thread Dmitri
There are two issues here that I'm seeing, first is that the list and vector have different behavior, my understanding is that they are both sequences and one should be able to perform the same operations on them. Second issue is that the behavior is inconsistent, if it is not possible to sort tu

Bug? overflow check in Numbers.minus

2009-01-08 Thread Achim Passen
Hi all! I encountered some corner cases where overflow checking for "-" doesn't work as I would expect: user=> (- Integer/MAX_VALUE Integer/MIN_VALUE) -1 user=> (- Long/MAX_VALUE Long/MIN_VALUE) -1 The problem seems to be that negating MIN_VALUE yields MIN_VALUE again, so it slips through t

Re: sort behavior question

2009-01-08 Thread Stephen C. Gilardi
On Jan 8, 2009, at 1:55 PM, Dmitri wrote: There are two issues here that I'm seeing, first is that the list and vector have different behavior, my understanding is that they are both sequences and one should be able to perform the same operations on them. I don't know more about the underlyin

Re: Gen-interface signature

2009-01-08 Thread Meikel Brandmeyer
Hi, Am 08.01.2009 um 19:38 schrieb Greg Harman: It looks like "(quote foo)" is being taken as the literal string name, rather than evaluating to "foo". And it happens that the hex ascii in the generated method name translates to: [](quote foo). Seems suspiciously like a macro-time vs fn-time th

Re: Gen-interface signature

2009-01-08 Thread Meikel Brandmeyer
Hi again, Am 08.01.2009 um 19:38 schrieb Greg Harman: A little time with the Clojure source and a debugger has been illuminating. (gen-interface :name clojure.example.IBar :methods [[bar [] String]]) You find this example and further information on clojure.org. http://clojure.org/compil

Re: writing bytes to a file

2009-01-08 Thread Brian Doyle
On Thu, Jan 8, 2009 at 11:34 AM, James Reeves wrote: > > On Jan 8, 5:05 pm, "Brian Doyle" wrote: > > I incorporated most of James ideas but I don't like the name pipe-stream. > > Then wouldn't copy-stream be better? write-stream isn't specific > enough, IMO. > Sure, write-stream works for me.

Re: writing bytes to a file

2009-01-08 Thread Brian Doyle
On Thu, Jan 8, 2009 at 12:36 PM, Brian Doyle wrote: > > > On Thu, Jan 8, 2009 at 11:34 AM, James Reeves > wrote: > >> >> On Jan 8, 5:05 pm, "Brian Doyle" wrote: >> > I incorporated most of James ideas but I don't like the name >> pipe-stream. >> >> Then wouldn't copy-stream be better? write-str

Re: Slime buffer ns is always user

2009-01-08 Thread Zak Wilson
Everything is fully up to date. The test works. Setting the ns with (ns test) works, but if I use a more complex ns form like (ns test (:use clojure.xml)), it fails to set the ns. As a workaround, (in-ns test) after the ns definition seems to work. Unless there's some reason not to, I'll just do

Re: sort behavior question

2009-01-08 Thread Dmitri
I tried this again with the latest build from svn, and it seems that lists may be running into a race condition due to their lazy nature: Exception in thread "main" java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.LazyCons cannot be cast to java.lang.Comparable On Jan 8, 2:

Re: yet another Clojure snake

2009-01-08 Thread Tom Ayerst
2009/1/8 Mark Volkmann > > On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst wrote: > > The point, for me, is that Mark Engelberg's construct allowed the system > to > > work with no mutation > > I don't yet see how that is possible. We agree then. > ... > > Can you explain in more detail the issu

Re: yet another Clojure snake

2009-01-08 Thread Tom Ayerst
2009/1/8 Tom Ayerst > 2009/1/8 Mark Volkmann > >> >> > while cleanly painting the board; the two thread >> > approach flickers terribly when the snake is short. >> >> I could be wrong, but I don't think that flicker is related to my >> choice of doing the painting off the EDT. I think it's just

Re: sort behavior question

2009-01-08 Thread Mark Engelberg
Lists are not comparable (i.e., you can't do something like (< '(1 2 3) '(4 5 6))). So you can't sort a collection of lists, but you can sort a collection of vectors (provided the vectors contain comparable things). This is always the case; there is no inconsistency. The reason you are sometime

Re: Clojure blog post about laziness

2009-01-08 Thread kkw
I'd vote for increased priority to reaching 1.0 also because of workplace constraints. Kev On Jan 9, 4:23 am, MikeM wrote: > > Do people want it now? > > I would vote for 1.0 ahead of streams if adding streams now will delay > 1.0. --~--~-~--~~~---~--~~ You recei

SLIME: trouble with java.lang.OutOfMemoryError

2009-01-08 Thread Paul Mooser
I was playing around earlier while following Mark Engelberg's blog post, and I found that to my surprise, when I exhaust the heap (java.lang.OutOfMemoryError), it basically fails to pop up the window that gives me the exception (where you can normally abort or throw the cause), and the REPL itself

Re: Clojure blog post about laziness

2009-01-08 Thread Stuart Halloway
If streams are not a breaking change, my vote is to ship 1.0 and then add them. Stuart > I've been holding off on integrating this as it is a fairly > substantial change (under the hood, no change at all for consumers), > introduces a new abstraction (though no impact until you use it), and >

Re: finding all vars starting with *

2009-01-08 Thread Chouser
On Tue, Jan 6, 2009 at 2:53 PM, rzeze...@gmail.com wrote: > > On Jan 4, 6:05 pm, "Brian Doyle" wrote: >> Is there some place where all of these vars are defined? Is there some way >> programatically I can find >> them all? Thanks. > > I'm bored, and as an excuse to write some code I thought I

Re: Slime buffer ns is always user

2009-01-08 Thread Bill Clementson
On Thu, Jan 8, 2009 at 11:57 AM, Zak Wilson wrote: > > Everything is fully up to date. > > The test works. Setting the ns with (ns test) works, but if I use a > more complex ns form like (ns test (:use clojure.xml)), it fails to > set the ns. > > As a workaround, (in-ns test) after the ns definit

Re: sort behavior question

2009-01-08 Thread Dmitri
I think the main issue is that sort should behave consistently. Possibly sort could check if the elements implement Comparable before attempting to sort them? I also don't see a reason as to why the lists shouldn't implement Comparable. On Jan 8, 4:17 pm, "Mark Engelberg" wrote: > Lists are not

Re: Gen-interface signature

2009-01-08 Thread Greg Harman
Thanks, Meikel. I feel a bit silly, but I do have it working now. * Not quoting foo is more than superfluous; it was the primary cause of my problem. I did study that clojure.org example, just missed the lack of quote... * There wasn't an example of a void return type and I assumed that, like an

Re: yet another Clojure snake

2009-01-08 Thread Korny Sietsma
On Fri, Jan 9, 2009 at 7:55 AM, Tom Ayerst wrote: > 2009/1/8 Mark Volkmann >> >> On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst wrote: >> > The point, for me, is that Mark Engelberg's construct allowed the system >> > to >> > work with no mutation >> >> I don't yet see how that is possible. > > We

clj-backtrace uses: screenshots and example code

2009-01-08 Thread Mark McGranaghan
Hi all, A little while ago I released clj-backtrace, a library that produces more readable backtraces for Clojure programs. I originally conceived of the library as just a better (.printStackTrace *e) for use at the REPL, but I've since found some other neat uses. I'd just like to share some scre

Re: clj-backtrace uses: screenshots and example code

2009-01-08 Thread Phil Hagelberg
Mark McGranaghan writes: > I'd also be happy to answer any questions you have about using the > library and to hear any general comments. This looks great! I love the way they're aligned. Have you looked at the way Rubinius (a smalltalk-style Ruby VM) prints backtraces? It's pretty similar, al

loading namespace from AOT compiled files vs source files

2009-01-08 Thread lpetit
Hello, There is a difference in using (require) on a namespace if it was compiled via (compile) or if it uses plain clj source files. The difference appears if in the source file, you have for example top level (println) commands. If you (require) the namespace from compiled classes, you will n

(compile) also loads the lib ?

2009-01-08 Thread lpetit
Hello, It seems that (compile) generates .class files as expected, and also loads the lib in the environment as well. Is it a (apparently undocument) feature ? Or a bug ? And also, it seems that (compile) does not load the lib from the compiled classes, but from the source files. I guess that,

How can I find all files ending with .clj, for example

2009-01-08 Thread wubbie
Hi all, I can use file-seq (file-seq (File. ".")) But how can I filter out all files ending with .clj? Do we use re-find, re-seq etc? thanks sun --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To p

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread Brian Doyle
Here's one of many ways to do this: (filter #(.endsWith (.getName %1) ".clj" ) (file-seq (java.io.File. "."))) On Thu, Jan 8, 2009 at 5:48 PM, wubbie wrote: > > Hi all, > > I can use file-seq > (file-seq (File. ".")) > But how can I filter out all files ending with .clj? > Do we use re-find, r

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread James Reeves
On Jan 9, 12:48 am, wubbie wrote: > I can use file-seq > (file-seq (File. ".")) > But how can I filter out all files ending with .clj? > Do we use re-find, re-seq etc? You can just use filter: (filter #(.endsWith (str %) ".clj") (file-seq (File. "."))) - James --~--~-~--~~-

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread wubbie
thanks, Is there anyway to specify regular expression, instead of startsWith/ endsWith? -sun On Jan 8, 8:00 pm, James Reeves wrote: > On Jan 9, 12:48 am, wubbie wrote: > > > I can use file-seq > > (file-seq (File. ".")) > > But how can I filter out all files ending with .clj? > > Do we use re-

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread Achim Passen
Hi! (filter #(re-find #".clj$" %) … ) see http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html (Boundary matchers) Kind regards, achim On 9 Jan., 02:39, wubbie wrote: > thanks, > > Is there anyway to specify regular expression, instead of startsWith/ > endsWith? > -sun > > On

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread Achim Passen
On 9 Jan., 03:03, Achim Passen wrote: > (filter #(re-find #".clj$" %) … ) correction: (filter #(re-find #"\.clj$" %) … ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread wubbie
I tried (filter #(re-find #"\.clj$" %) (seq (file-seq(java.io.File. "." -> java.lang.ClassCastException: java.io.File cannot be cast to java.lang.CharSequence (NO_SOURCE_FILE:0) On Jan 8, 9:06 pm, Achim Passen wrote: > On 9 Jan., 03:03, Achim Passen wrote: > > > (filter #(re-find #".clj$

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread Brian Doyle
This works: (filter #(re-find #"\.clj$" (str %)) (file-seq(java.io.File. "."))) On Thu, Jan 8, 2009 at 7:16 PM, wubbie wrote: > > I tried > > (filter #(re-find #"\.clj$" %) (seq (file-seq(java.io.File. "." > -> java.lang.ClassCastException: java.io.File cannot be cast to > java.lang.CharSe

Re: How can I find all files ending with .clj, for example

2009-01-08 Thread wubbie
thank, it was str as usual. On Jan 8, 9:22 pm, "Brian Doyle" wrote: > This works: > > (filter #(re-find #"\.clj$" (str %)) (file-seq(java.io.File. "."))) > > On Thu, Jan 8, 2009 at 7:16 PM, wubbie wrote: > > > I tried > > >  (filter #(re-find #"\.clj$" %) (seq (file-seq(java.io.File. "." >

Re: clj-backtrace uses: screenshots and example code

2009-01-08 Thread Mark McGranaghan
Phil, Indeed, clj-backtrace was largely inspired by Rubinius' "Awsome Backtrace" feature. I've implemented and pushed to GitHub an experimental implementation of colorized backtraces for the REPL: In addition to the usual (pst) to pretty-print the last exception, you can now (pst+) to colorized-

Re: (compile) also loads the lib ?

2009-01-08 Thread Stuart Sierra
On Jan 8, 7:28 pm, lpetit wrote: > It seems that (compile) generates .class files as expected, and also > loads the lib in the environment as well. > > Is it a (apparently undocument) feature ? Or a bug ? It's a feature. I think it's documented somewhere. :) > And also, it seems that (compile)

Re: update in place for unique references

2009-01-08 Thread Mark P
Hi Mark F, Thanks for your responses. > 1. Data: Is this really a problem that is slowing down Clojure > programs in practice? Can you provide some data to that effect? I > would suggest writing a couple of Java benchmarks - one that updates a > simple structure in place and one that only create

Re: Clojure blog post about laziness

2009-01-08 Thread Mark Engelberg
On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey wrote: > When you > ask for the nth element/rest, you get the identical item every time. I know this is nitpicking, but if this is really the promise that the seq abstraction is supposed to fulfill, then Clojure already violates this: (def a (seq [1 2

Re: contrib/sql with postgresql, problem inserting into column of type date

2009-01-08 Thread ssecorp
I don't understand how to use it, can you post an example? I have tried everything and have gotten it to work under circumstances I'm not sure of. However it doesn't work now. (ns progs.netflix.parsing (:require (progs.netflix [pg :as pg])) (:import (java.sql Date))) (load-file "C:/cloj

Re: Clojure blog post about laziness

2009-01-08 Thread Mark Engelberg
Oh, I mentioned this in my blog post, but perhaps it bears repating. If cycle, repeat, and replicate were implemented behind-the-scenes with LazySeq as opposed to LazyCons, they would still implement the promise of identical elements for separate traversals, but would be more efficient. Also, ran

Re: (compile) also loads the lib ?

2009-01-08 Thread lpetit
On 9 jan, 04:03, Stuart Sierra wrote: > On Jan 8, 7:28 pm, lpetit wrote: > > > It seems that (compile) generates .class files as expected, and also > > loads the lib in the environment as well. > > > Is it a (apparently undocument) feature ? Or a bug ? > > It's a feature.  I think it's documente

Re: (compile) also loads the lib ?

2009-01-08 Thread lpetit
On 9 jan, 07:54, lpetit wrote: > On 9 jan, 04:03, Stuart Sierra wrote: > > > Later on, if I call (load) (from a fresh clojure environment) from the > > > compiled classes, the top level (println)s are not executed, since not > > > compiled. > > > Yes, that's the expected behavior.   "compile" on

Re: sort behavior question

2009-01-08 Thread Christian Vest Hansen
On Thu, Jan 8, 2009 at 11:38 PM, Dmitri wrote: > > I think the main issue is that sort should behave consistently. > Possibly sort could check if the elements implement Comparable before > attempting to sort them? > I also don't see a reason as to why the lists > shouldn't implement Comparable.

Re: sort behavior question

2009-01-08 Thread Mark Engelberg
On Thu, Jan 8, 2009 at 11:20 PM, Christian Vest Hansen wrote: > Comparable implies that an Object can be reduced to a scalar value, if > only for the purpose of comparing. How do you imagine this should work > on list of arbitrary things? Lexicographic ordering. Compare the first elements, if e