Re: Fully lazy sequences are coming - feedback wanted!

2009-02-18 Thread Rich Hickey
On Feb 17, 10:52 pm, Mark Engelberg mark.engelb...@gmail.com wrote: Since there is no canonical empty sequence, this makes me wonder whether one particular empty sequence might have some kind of performance benefit over another. For example, if I were going to give a name to one empty

Re: bug affecting clojure.core/bean?

2009-02-18 Thread Rich Hickey
On Feb 18, 11:04 am, Chouser chou...@gmail.com wrote: On Wed, Feb 18, 2009 at 12:35 AM, Rob rob.nikan...@gmail.com wrote: I'm wondering if I found a bug. I have the latest source from svn (r1291). user= (bean 1) java.lang.IllegalArgumentException: Wrong number of args passed to:

Re: Libraries? model and generic-functions

2009-02-18 Thread Rich Hickey
On Feb 18, 10:17 am, wlr geeked...@gmail.com wrote: On Feb 17, 10:20 am, Raffael Cavallaro raffaelcavall...@gmail.com wrote: I am very interested in both of these subsystems and would love to see you package them as clojure.contrib libraries. Hopefully others feel the same and we'll

Re: Fully lazy sequences are here!

2009-02-18 Thread Rich Hickey
On Feb 18, 2:09 pm, Stefan Rusek sru...@gmail.com wrote: On Wed, Feb 18, 2009 at 8:02 PM, Rich Hickey richhic...@gmail.com wrote: On Feb 18, 12:20 pm, Frantisek Sodomka fsodo...@gmail.com wrote: How should I say it... It just didn't look symmetrical to me. So, basically

Re: Datalog update

2009-02-18 Thread Rich Hickey
On Feb 9, 8:46 am, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: No, but I'm really learning as I go here. I'll look into it. On Mon, Feb 9, 2009 at 7:58 AM, Rich Hickey richhic...@gmail.com wrote: Looks like you're moving apace! Have you considered query/subquery optimization

Re: Datalog update

2009-02-18 Thread Rich Hickey
that has a Z in janet, and also remove any tuple where XY fails. The resulting X,Y would be projected as relation fred. On Wed, Feb 18, 2009 at 3:23 PM, Rich Hickey richhic...@gmail.com wrote: On Feb 9, 8:46 am, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: No, but I'm really

Re: Datalog update

2009-02-18 Thread Rich Hickey
this was the logical db, 'inserting' any tuple would also add it to internal indexes, including of course a default index on relname. You'd declare which other keys to index, and how (sorted/hashed) when creating the db. Rich On Wed, Feb 18, 2009 at 4:13 PM, Rich Hickey richhic...@gmail.com wrote: On Feb 18

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-17 Thread Rich Hickey
On Feb 17, 2009, at 4:40 AM, Konrad Hinsen wrote: On Feb 16, 2009, at 20:23, Rich Hickey wrote: It seems the Sequence/ISeq dichotomy was a sticking point for many. After some tweaking, I've been able to get rid of Sequence entirely, SVN 1284+ in lazy branch. This is source compatible

Fully lazy sequences are here!

2009-02-17 Thread Rich Hickey
I've merged the lazy branch into trunk, SVN rev 1287 Please do not rush to this version unless you are a library/tool developer. Let them do their ports and chime in on their progress. Move only when the libs/tools you depend upon have been ported. Thanks to all for your feedback and input!

Re: map literals, computed keys and side-effects

2009-02-17 Thread Rich Hickey
On Feb 17, 3:30 pm, Christian Vest Hansen karmazi...@gmail.com wrote: On Tue, Feb 17, 2009 at 9:08 PM, Christophe Grand christo...@cgrand.net wrote: Fixing array-map would make the two tests consistent but I'm not sure that (let [a (atom 0)] {(swap! a inc) 1 (swap! a inc) 2 }) should

Re: clojure.contrib.repl-ln vs. new lazy

2009-02-17 Thread Rich Hickey
On Feb 17, 8:52 pm, Chouser chou...@gmail.com wrote: On Tue, Feb 17, 2009 at 5:33 PM, Stephen C. Gilardi squee...@mac.com wrote: Turning on nil punning debugging with: cd clojure ant -Dclojure.assert-if-lazy-seq=true and testing with: user= (compile

Re: Fully lazy sequences are here!

2009-02-17 Thread Rich Hickey
On Feb 17, 4:16 pm, Frantisek Sodomka fsodo...@gmail.com wrote: That was fast! ;-) Rich, I am porting test_clojure and old 'cycle' worked as: (cycle []) = nil Currently: (cycle []) = java.lang.StackOverflowError Fixed in svn 1290 - thanks for the report. Rich

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-16 Thread Rich Hickey
On Feb 16, 2009, at 11:25 AM, David Nolen wrote: butlast, doall, dorun, doseq, dosync, dotimes, doto, fnseq, gensym, macroexpand, macroexpand-1, mapcat, nthrest -1 Because they are similar to other Lisps I assume. The same reason for println vs print-line. Changing these are a bad

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-16 Thread Rich Hickey
On Feb 15, 12:18 pm, Rich Hickey richhic...@gmail.com wrote: I'm pretty much finished with the fully-lazy implementation and am happy so far with the results. I think this will be an important addition to Clojure and am planning to add it. Thanks all for the feedback! It seems the Sequence

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-16 Thread Rich Hickey
On Feb 16, 2009, at 3:56 PM, Stephen C. Gilardi wrote: On Feb 16, 2009, at 2:23 PM, Rich Hickey wrote: New docs here: http://clojure.org/lazy In the html doc: rest... returns a possibly empty seq, never nil then later never returns nil - currently

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-16 Thread Rich Hickey
On Feb 16, 2009, at 5:35 PM, Mark Engelberg wrote: Browsing the source code for LazySeq, I noticed that isEmpty is implemented as follows: public boolean isEmpty() { return count() == 0; } Since count realizes the whole list, this seems like a bad way to test for empty on

Re: Clojure on CLR/DLR

2009-02-16 Thread Rich Hickey
On Feb 16, 2009, at 7:17 PM, dmiller wrote: On Feb 16, 5:33 pm, Chouser chou...@gmail.com wrote: On Mon, Feb 16, 2009 at 5:43 PM, dmiller dmiller2...@gmail.com wrote: I don't know if you've looked at ClojureScript at all, but it's a similar if noticeably less ambitious project to

Re: Bugs in set and sorted-set (?)

2009-02-15 Thread Rich Hickey
On Feb 14, 11:10 pm, Chouser chou...@gmail.com wrote: On Sat, Feb 14, 2009 at 7:19 PM, Stephen C. Gilardi squee...@mac.com wrote: set is a hash set. It will never contain two items with equal hashes. I don't think that's quite right. I don't think it matters in this case, but hash

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Rich Hickey
On Feb 15, 4:30 pm, Stephen C. Gilardi squee...@mac.com wrote: On Feb 15, 2009, at 12:18 PM, Rich Hickey wrote: I am looking for feedback from people willing to read and understand the linked-to documentation and the fully lazy model, and especially from those trying the lazy branch

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Rich Hickey
On Feb 15, 2009, at 4:44 PM, Chouser wrote: Here's an example of what I think will be the worst kind of breakage resulting from changing the meaning of rest from seq-on-the-next-item-if-any-else-nil to possibly-empty-collection-of-the-remaining-items: (defn my-interpose [x coll] (loop

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Rich Hickey
On Feb 15, 2009, at 5:01 PM, Mark Engelberg wrote: On Sun, Feb 15, 2009 at 1:44 PM, Chouser chou...@gmail.com wrote: (defn my-interpose [x coll] (loop [v [x] coll coll] (if (seq coll) ; Don't assume coll is a seq-or-nil (recur (- v (conj (first coll)) (conj x)) (rest coll))

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Rich Hickey
On Feb 15, 2009, at 5:09 PM, Konrad Hinsen wrote: On 15.02.2009, at 23:00, Konrad Hinsen wrote: For those who want to play with this without keeping two versions of their source code files, I have added a new macro lazy-and-standard- branch to clojure.contrib.macros. Here is an example of

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Rich Hickey
On Feb 15, 6:34 pm, James G. Sack (jim) jgs...@san.rr.com wrote: Rich Hickey wrote: .. The second option is to choose the best possible names, and deal with some short term pain in porting and confusion. I think the best names are: ;item (first x) ;collection of remaining items

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-15 Thread Rich Hickey
On Feb 15, 2009, at 8:22 PM, Mark Engelberg wrote: My thoughts so far: 4. The new model is definitely more complicated to understand than the previous model. There was already a certain degree of mental overlap between collections and the seq interface. Now, there is also the subtle

Re: Trojan horse in our Files section

2009-02-14 Thread Rich Hickey
On Feb 14, 8:56 am, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: Lovely. Thanks for the warning. On Sat, Feb 14, 2009 at 6:49 AM, Frantisek Sodomka fsodo...@gmail.comwrote: My antivirus doesn't like the Gift from the Stranger:

Re: Reflection warnings starting at r1265

2009-02-13 Thread Rich Hickey
On Feb 13, 9:06 am, Vincent Foley vfo...@gmail.com wrote: Should I add this to the list of issues in the Google Code tracker? No. Those hints were suspect to begin with. .get returns a byte already, and .getShort a short, so those hints shouldn't do anything useful. Similarly, coercing to

Re: Issue request: RT.load's don't load if already loaded mechanism breaks :reload-all

2009-02-13 Thread Rich Hickey
On Feb 13, 9:04 am, Stephen C. Gilardi squee...@mac.com wrote: Rich, May I please enter an issue to track the defect that require/use's :reload-all flag is not working properly in Clojure. How does this interact with: http://code.google.com/p/clojure/issues/detail?id=3 Rich

Re: bug + patch: lazy branch take-while is broken

2009-02-13 Thread Rich Hickey
On Feb 12, 10:20 pm, Chouser chou...@gmail.com wrote: There's a misplaced paren in take-while in the lazy branch. Patch attached. --Chouser Fixed in SVN 1280 - thanks for the report. Rich --~--~-~--~~~---~--~~ You received this message because you are

Re: Anonymous classloading in JDK 6u14

2009-02-12 Thread Rich Hickey
On Feb 11, 6:48 pm, pmf phil.fr...@gmx.de wrote: Hi, I have just read about the upcoming JDK 6u14 [1], which mentions that one of the features is support for loading anonymous classes [2]. Is this being considered for Clojure? I couldn't really extract from the article whether this is

Re: r1265 causes VerifyError on dalvik

2009-02-12 Thread Rich Hickey
On Feb 12, 5:30 am, Remco van 't Veer rwvtv...@gmail.com wrote: Should I open in issue for this? W/dalvikvm( 214): VFY: unable to resolve virtual method 6650: Ljava/ lang/StringBuilder;.append (C)Ljava/lang/AbstractStringBuilder; W/dalvikvm( 214): VFY: rejecting opcode 0x6e at 0x0043

Re: is mod correct?

2009-02-11 Thread Rich Hickey
On Feb 10, 11:18 pm, Mark Engelberg mark.engelb...@gmail.com wrote: I was the source of this error, and I agree that the behavior is an error. I missed the case of a negative divisor and a 0 remainder among my test cases for the mod function. Thanks for noticing and fixing the problem.

Re: patch to improve startup time on low end hardware

2009-02-10 Thread Rich Hickey
On Feb 10, 3:47 am, Remco van 't Veer rwvtv...@gmail.com wrote: Hi Rich, I've been working on getting clojure in a more usable state for android [1]. One of the challenges was to speedup startup time. A lot of time is spend in the lisp-reader because all constants are stored as lisp

Re: Request for Discussion: changing lib root directory calculation to improve load/:load

2009-02-10 Thread Rich Hickey
On Feb 10, 9:45 am, Stephen C. Gilardi squee...@mac.com wrote: I came across this when updating the wikibook concepts page, Libraries section, to be correct for current Clojure behavior. In an early implementation of the code that handles libs, the resource (file) for lib a.b.c was at the

Re: Request for Discussion: changing lib root directory calculation to improve load/:load

2009-02-10 Thread Rich Hickey
On Feb 10, 7:15 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, 2009/2/10 Stephen C. Gilardi squee...@mac.com On Feb 10, 2009, at 11:46 AM, Laurent PETIT wrote: If I understand correctly your proposal, can you verify the following is true : (ns foo.bar) (ns

Re: Datalog update

2009-02-09 Thread Rich Hickey
Looks like you're moving apace! Have you considered query/subquery optimization instead of magic sets? Rich On Feb 8, 7:51 pm, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: By the way, if anyone on this list has experience implementing bottom-up optimizations for logic programs,

Re: Minor bug report: (merge-with f) returns nil, not {}

2009-02-09 Thread Rich Hickey
On Sat, Feb 7, 2009 at 9:16 PM, Jason Wolfe jawo...@berkeley.edu wrote: merge-with says it returns a map, but if you give it no arguments it gives you back nil instead of the empty map. In my code, I had something like: ((apply merge-with concat maps) key) and got NPE rather than nil

Re: pmap issues

2009-02-09 Thread Rich Hickey
On Feb 7, 9:36 pm, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: With the help of the IRC folks I solved my own problem. I thought I'd share my findings: You cannot safely call pmap inside of another pmap function. Because pmap is implemented on top of agents, the actual calls to

Re: Fwd: Patch: universal main() with repl/script/compile

2009-02-09 Thread Rich Hickey
On Feb 9, 2:10 pm, Thorsen Eric ethor...@enclojure.org wrote: For some reason I could not reply to the original thread... Begin forwarded message: From: Stephen C. Gilardi squee...@mac.com Date: February 6, 2009 12:49:34 PM EST To: Eric Thorsen ethor...@enclojure.org Subject: Re:

Re: unchecked methods for floats/doubles?

2009-02-07 Thread Rich Hickey
On Feb 7, 2009, at 3:43 AM, Korny Sietsma wrote: Ah - I didn't realise that. I was trying to avoid the overhead, as I understood it, of both converting the parameters to Float/Double objects, and then of checking for overflow. So '*' and '+' don't do overflow checking - do they need to

Re: sorted-set-by?

2009-02-07 Thread Rich Hickey
On Feb 7, 2009, at 3:58 AM, puzzler wrote: Still, I think it's a good point that since Clojure has sorted-map-by, it seems logical to expect that it would also have sorted-set-by. Yes, this is just an API gap. Issue/patch welcome. Rich

Re: PATCH: add warn-on-reflection option to c.l.Compile

2009-02-06 Thread Rich Hickey
On Feb 6, 2009, at 1:33 PM, Chas Emerick wrote: Attached is a patch to add a warn-on-reflection option to clojure.lang.Compile. In short, if the clojure.compile.warn-on- reflection system property is set to true, then *warn-on-reflection* is set to true for the duration of the compile

Re: Questions about a Clojure Datalog

2009-02-05 Thread Rich Hickey
On Feb 4, 5:22 pm, John Fries john.a.fr...@gmail.com wrote: Guaranteed-termination is very desirable. However, you can have guaranteed termination with an open-world assumption just as well. And I think an open-world assumption does a better job of mimicking human reasoning. Do you have a

Re: Map from generator?

2009-02-05 Thread Rich Hickey
On Feb 4, 10:36 pm, Conrad drc...@gmail.com wrote: It is useful to build a map from a list of keys and a value generator function. Of Course, such a function is easy to write: (defn genmap [keys fun] (zipmap keys (map fun keys))) In fact, it seems so useful that it must be in the

Re: London Clojurians

2009-02-05 Thread Rich Hickey
On Feb 4, 8:25 am, H Durer h.due...@gmail.com wrote: 2009/2/3 AndrewC. mr.bl...@gmail.com: [...] The people at Scheme UK have (very) occasional meetings in Shoreditch. We could join up with them and get a few more people, perhaps. http://upcoming.yahoo.com/group/4654/ Perhaps

Re: Questions about a Clojure Datalog

2009-02-05 Thread Rich Hickey
using a Java class-based syntax. But this seems like a perfect use of Clojure, which could provide a much more natural query syntax. On Thu, Feb 5, 2009 at 4:29 AM, Rich Hickey richhic...@gmail.com wrote: On Feb 4, 5:22 pm, John Fries john.a.fr...@gmail.com wrote: Guaranteed-termination

Re: SVN branches

2009-02-04 Thread Rich Hickey
On Feb 4, 7:21 am, MikeM michael.messini...@invista.com wrote: Other than that, there is just the general loss of nil-punning. This was the theoretical problem that kept me from making this tradeoff earlier. I'm very much interesting in hearing from those for whom the lazy branch

Re: SVN branches

2009-02-04 Thread Rich Hickey
On Feb 4, 1:45 am, Mark Engelberg mark.engelb...@gmail.com wrote: One thing I couldn't tell from the lazier doc is whether rest is only being kept around for backward compatibility or whether there still might be reasons to actively prefer rest to more. rest is being kept for compatibility

Re: SVN branches

2009-02-04 Thread Rich Hickey
On Feb 4, 6:55 am, Frantisek Sodomka fsodo...@gmail.com wrote: Streams were also intended for I/O. Is lazier addition also able to cope with I/O successfully? Yes. After full laziness, most of the issues with I/O have to deal with resource management, which I plan to deal with a la carte

Re: Bug or desired behavior: contains? doesn't seem to work on java.util.Sets.

2009-02-04 Thread Rich Hickey
On Feb 3, 10:44 pm, Jason Wolfe jawo...@berkeley.edu wrote: This just bit me a second time, since one of my revised set functions uses contains? and thus doesn't work on java.util.Sets (or even the .keySets of Clojure maps). user (contains? (.keySet {:a :b}) :a) false It seems that all

Re: Bug or desired behavior: contains? doesn't seem to work on java.util.Sets.

2009-02-04 Thread Rich Hickey
On Feb 3, 11:16 pm, Stephen C. Gilardi squee...@mac.com wrote: On Feb 3, 2009, at 10:44 PM, Jason Wolfe wrote: user (contains? (.keySet {:a :b}) :a) false It seems that all that's required to make contains? work on general Sets is to replace IPersistentSet with Set on lines 648 and

Re: SVN branches

2009-02-04 Thread Rich Hickey
On Feb 4, 9:03 am, MikeM michael.messini...@invista.com wrote: (if [] true false) I'd hate to lose the ability to distinguish between an empty collection and nothing. As a trade-off to allow nil-punning, you could stipulate the use of coll? in the above situation: (if (coll? []) true

Re: SVN branches

2009-02-04 Thread Rich Hickey
On Feb 4, 9:19 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 04.02.2009, at 14:03, Rich Hickey wrote: 1) Resource management in lazy contexts 2) Memory consumption in recursive lazy contexts (the filter retains skipped range issue) 3) Full laziness in I/O and other side-effect

Re: SVN branches

2009-02-03 Thread Rich Hickey
On Feb 2, 2:27 pm, Chouser chou...@gmail.com wrote: On Mon, Feb 2, 2009 at 2:05 PM, MikeM michael.messini...@invista.com wrote: There is a lazy branch in SVN. The streams branch has been discussed, but I haven't seen any discussion of the lazy branch - perhaps I missed it. Here's a

Re: Example of functional relational programming in clojure

2009-02-03 Thread Rich Hickey
On Feb 3, 9:19 am, Jack Norimi clojuregr...@ululi.it wrote: I found this documenthttp://www.scribd.com/doc/3566845/FRP-Presentation-Web and this documenthttp://web.mac.com/ben_moseley/frp/paper-v1_01.pdf and this phrase Rich recommended a paper, Out of the Tar Pit, for a discussion of

Re: Possible bug in preduce

2009-02-03 Thread Rich Hickey
On Feb 3, 4:43 pm, Anand Patil anand.prabhakar.pa...@gmail.com wrote: Hi all, Messing around with preduce at the REPL I saw this: user= (defn q [sofar new] (do (print new sofar\n) (+ (+ 1 new) sofar))) #'user/q user= (reduce q 0 [1 2 3]) 1 0 2 2 3 5 9 user= (preduce q 0 [1 2 3])

Re: SVN branches

2009-02-03 Thread Rich Hickey
On Feb 3, 9:57 pm, MikeM michael.messini...@invista.com wrote: Code written with the fully-lazy branch certainly looks cleaner than the streams branch equivalent, and having full laziness seems like a plus. The local-clearing mechanism seems like it will be straightforward to use. Seems

Re: Restarting a transaction with commute?

2009-02-01 Thread Rich Hickey
On Feb 1, 2009, at 6:47 AM, Paul Barry wrote: My understanding of commute is that it would not restart the transaction, it would just apply the function. So I wrote this little test program: (defmacro in-thread [ body] `(.start (Thread. (fn [] (println Thread

Re: improvement: make main.clj not die when exception in --init

2009-01-31 Thread Rich Hickey
On Jan 30, 2009, at 6:16 PM, Stephen C. Gilardi wrote: A minor annoyance of mine is that clojure.main exits if there is an exception in an --init file, even if you ask for a repl. i.e. +1 in favor of fixing this. Patch welcome. Rich

Re: pmap not parallel for me...

2009-01-31 Thread Rich Hickey
On Jan 31, 11:41 am, Conrad drc...@gmail.com wrote: Hi everyone- I'm a new Clojurist trying to understand how to make use of Clojure parallelism... I wrote this simple program that calculates the number of prime numbers in a number range. It is purposely inefficient: (defn prime [a]

Re: Got a Clojure library?

2009-01-30 Thread Rich Hickey
The new library page is here: http://clojure.org/libraries Keep 'em coming! Rich On Jan 29, 10:04 am, Rich Hickey richhic...@gmail.com wrote: People regularly post here about Clojure libraries they are working on, and it is great to see the explosion of new libs for Clojure! I'd like

Re: Questions about a Clojure Datalog

2009-01-29 Thread Rich Hickey
On Jan 26, 11:44 pm, smanek sma...@gmail.com wrote: Hello all, I'm a Common Lisp programmer who has just started learning Clojure. I saw it mentioned online that several members of the existing community were looking for someone to build a datalog for Clojure: I was wondering what exactly

Re: Serializable

2009-01-29 Thread Rich Hickey
On Jan 29, 8:54 am, Jeffrey Straszheim straszheimjeff...@gmail.com wrote: This might be documented somewhere, but I didn't notice. Are the built in Clojure types (Lists, vectors, symbols, and so on) Java Serializable? Not yet. Could you create an enhancement issue for that, please? Thanks,

Re: Classloading again

2009-01-29 Thread Rich Hickey
On Jan 28, 2009, at 10:27 AM, Ferdinando Villa wrote: Clojure is saving our life and enabling thing we would never have dreamed of without in our ARIES project (http:// ecoinformatics.uvm.edu/ aries). Still, we need to hack RT in order to be able to use it. I've seen some discussion on

Got a Clojure library?

2009-01-29 Thread Rich Hickey
People regularly post here about Clojure libraries they are working on, and it is great to see the explosion of new libs for Clojure! I'd like to try to get a directory of Clojure libs together and up on the Clojure site. Towards that end, I'd appreciate it, if you are the author of a Clojure

Re: Will Clojure work on AppEngine?

2009-01-29 Thread Rich Hickey
On Jan 27, 2:44 pm, Robin robi...@gmail.com wrote: Under a huge assumption that Google will soon announce a 'Java compatible' runtime forAppEngine. Could Clojure work out of the box? Would Clojure's dynamic generation of ASM/bytecode pose a security problem for a generic sandboxed

Re: Alternatives to contains?

2009-01-29 Thread Rich Hickey
On Jan 29, 10:41 pm, Paul Barry pauljbar...@gmail.com wrote: This is actually the point of this whole debate. You would assume that contains? works like java.util.Collection.contains, but instead it means something completely semantically different. user= (.contains [4 5 6] 4) true user=

Re: Agent watchers on Refs

2009-01-28 Thread Rich Hickey
On Jan 27, 8:49 am, MikeM michael.messini...@invista.com wrote: Were watchers synchronous, they would have to run post-transaction (else a watcher action failure could cause a transaction rollback, leaving already notified watchers confused). Being post-transaction would mean that the

Re: more readable IRefs

2009-01-28 Thread Rich Hickey
On Jan 28, 4:11 pm, Chouser chou...@gmail.com wrote: Currently if you happen upon a Ref in the REPL, you don't get much helpful information: user= (ref #{:a 1}) #Ref clojure.lang@968fda Improving on this is not difficult: (defmethod print-method clojure.lang.IRef [o w] (.write w

Re: repeat and replicate

2009-01-28 Thread Rich Hickey
On Jan 28, 5:38 pm, Chouser chou...@gmail.com wrote: On Wed, Jan 28, 2009 at 4:56 PM, Shawn Hoover shawn.hoo...@gmail.com wrote: On Wed, Jan 28, 2009 at 4:36 PM, Stephen C. Gilardi squee...@mac.com wrote: I like repeat with multiple arities and remove replicate. --Steve Me too.

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-26 Thread Rich Hickey
On Jan 25, 4:10 pm, Laurent PETIT laurent.pe...@gmail.com wrote: #- makes sense (CL didn't always make things the wrong way :-) And indeed, #; *could* break a lot of already existing editors for a while Yes, the issues are: #; is bad for editors #- would be incompatible with CL's #-, and

Re: Stream utilities in clojure.contrib

2009-01-26 Thread Rich Hickey
On Jan 26, 3:20 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 25.01.2009, at 21:33, Rich Hickey wrote: Looks interesting. I made AStream.Iter an IFn, so you can try that. Thanks! It works fine, the changes to stream-utils are checked in. There is just one situation that still

Re: Stream utilities in clojure.contrib

2009-01-26 Thread Rich Hickey
On Jan 26, 3:20 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 25.01.2009, at 21:33, Rich Hickey wrote: Something else that would be nice for implementing generators and thus streams is Scheme-style continuations. That would permit to write generators like in Python, as loopy code

Re: zipper: missing root-loc

2009-01-26 Thread Rich Hickey
On Jan 25, 3:50 pm, Chouser chou...@gmail.com wrote: On Sun, Jan 25, 2009 at 9:46 AM, Jan Rychter j...@rychter.com wrote: From what I understand, currently the only way is to get the root node and then recreate the entire zipper structure. This seems unnecessary. I think what you're

Re: Agent watchers on Refs

2009-01-26 Thread Rich Hickey
On Jan 25, 4:06 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: Hi Rich, all, Ever since the new implementation of watchers I've been itching to try out Cells again. It worked great for agents. I ran into a snag, though, when I tried to make cells out of refs. Here's an example. I

Re: Binding values in a list of symbols and evaluating as code

2009-01-25 Thread Rich Hickey
On Jan 25, 2009, at 5:13 AM, Christophe Grand wrote: Zak Wilson a écrit : Thanks, Christophe. It works now, and it's fast. Unfortunately, now I've run in to Nathan's problem. After a few thousand generations, resulting in the creation of about half a million functions it was using over a

Re: bug? tree-seq assumes the root is a branch

2009-01-24 Thread Rich Hickey
On Jan 23, 2009, at 1:35 PM, Christophe Grand wrote: Christophe Grand a écrit : tree-seq assumes the root is a branch: user= (tree-seq (constantly false) seq [1 2 3]) ([1 2 3] 1 2 3) ; I expected ([1 2 3]) Is this a bug? I know it's documented but I don't understand why. That's an

Re: Proposal: smarter set operations that take size into account for speed

2009-01-24 Thread Rich Hickey
On Jan 23, 5:42 pm, Jason Wolfe jawo...@berkeley.edu wrote: I appreciate your desire to contribute, but Clojure is not just about your needs. You have flooded the group with every idea you have, some are bugs (important), some are good ideas, some not, but there are simply too many to

Re: License of/permission for Clojure's logo

2009-01-24 Thread Rich Hickey
On Jan 23, 2009, at 11:37 AM, Jason Riedy wrote: And Rich Hickey writes: You can use the logo on the wikipedia article on Clojure, but only if you spell my name correctly :) May I use the logo for the identi.ca group? ( http://identi.ca/group/clj ) Sure. Rich

Re: Generating vars

2009-01-24 Thread Rich Hickey
On Jan 24, 6:29 am, Konrad Hinsen konrad.hin...@laposte.net wrote: I am trying to generate a var for use in a generator for a stream. As a simple example, let's try to create a stream of integers. My first attempt at the generator was: (with-local-vars [n 0] (defn integers [_]

Re: A nil puzzle

2009-01-24 Thread Rich Hickey
On Jan 24, 3:43 am, Mark Engelberg mark.engelb...@gmail.com wrote: Now that everyone's had a day to mull this puzzle over, here are my thoughts. One way to think about this, is to think about what the statement of purpose / contract of a generalized powerset function would be. In general,

Re: A nil puzzle

2009-01-24 Thread Rich Hickey
On Jan 24, 5:00 pm, Mark Engelberg mark.engelb...@gmail.com wrote: On Sat, Jan 24, 2009 at 9:06 AM, Rich Hickey richhic...@gmail.com wrote: You gotten tied up, here and elsewhere, conflating sequence with container, and almost all of your problems stem from wanting to say sequence

Re: Streams work

2009-01-23 Thread Rich Hickey
On Jan 23, 3:31 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 22.01.2009, at 19:50, Rich Hickey wrote: Does that mean that calling seq on a stream converts the stream into a seq for all practical purposes? That sounds a bit dangerous considering that so many operations

Re: Streams work

2009-01-23 Thread Rich Hickey
On Jan 23, 4:53 am, Christophe Grand christo...@cgrand.net wrote: Christophe Grand a écrit : I relaxed the constraint saying that a stream ensures that /*every call to seq on a stream will return the same seq to be */a stream ensures that /*every call to seq on a stream will return the

Re: Streams work

2009-01-23 Thread Rich Hickey
On Jan 22, 11:17 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 22.01.2009, at 16:27, Rich Hickey wrote: Now it works - fine. But what happened to the seq that now owns the stream? Nothing refers to it, so it should be gone. No, the stream must refer to it, in order to keep its

Re: function that takes primitives?

2009-01-23 Thread Rich Hickey
On Jan 22, 6:16 pm, Korny Sietsma ko...@sietsma.com wrote: Hi folks, Is there any way to make a function that takes primitive parameters? It seems you can't, but I might be missing something. I have the following code (a start to playing with mandelbrot sets): (defn step [x0, y0, xn, yn]

Re: Proposal: smarter set operations that take size into account for speed

2009-01-23 Thread Rich Hickey
On Jan 23, 4:19 pm, Jason Wolfe jawo...@berkeley.edu wrote: On Fri, Jan 23, 2009 at 12:23 PM, Jason Wolfe jawo...@berkeley.edu wrote: OK, if these are not wanted in core right now, will anyone sign off for adding them to clojure.contrib? Well, *I* want these changes you've proposed

Re: Regarding (.keySet {:a :map})

2009-01-23 Thread Rich Hickey
On Jan 23, 1:47 pm, Christian Vest Hansen karmazi...@gmail.com wrote: I type this expression in the REPL (trunk 1228): user= (let [s (.keySet {:a 1})] [(set? s) (ifn? s)]) [false false] But I expected it to return [true true]. Why? keySet is specified to return a java.util.Set, and that

Re: Streams work

2009-01-22 Thread Rich Hickey
On Jan 22, 12:53 am, Mark H. mark.hoem...@gmail.com wrote: On Jan 21, 5:21 pm, e evier...@gmail.com wrote: I would think it would be useful to have something exactly like a stream but that allowed as many iterators as you like but that a mutex prevented any two from consuming the same

Re: struct question

2009-01-22 Thread Rich Hickey
On Jan 22, 4:46 am, Christophe Grand christo...@cgrand.net wrote: Konrad Hinsen a écrit : there is nothing in the standard library to add a tag to an existing metadata map. All there is is (with-meta ...), which replaces the metadata map completely. It itched me before and since there's

Re: struct question

2009-01-22 Thread Rich Hickey
On Jan 22, 2:48 am, Mark Engelberg mark.engelb...@gmail.com wrote: Thanks for the thread links. This is basically what I suspected -- if you want to use structs in multimethods, you have to roll your own constructor which adds some kind of type tag to either the hashmap or the metadata.

Re: Streams work

2009-01-22 Thread Rich Hickey
On Jan 22, 9:08 am, Konrad Hinsen konrad.hin...@laposte.net wrote: On 21.01.2009, at 20:33, Rich Hickey wrote: I've started documenting the streams work I have been doing, for those interested: http://clojure.org/streams Nice! I have played a bit with the stream implementation

Re: Streams work

2009-01-22 Thread Rich Hickey
On Jan 22, 2009, at 11:17 AM, Konrad Hinsen wrote: On 22.01.2009, at 16:27, Rich Hickey wrote: Now it works - fine. But what happened to the seq that now owns the stream? Nothing refers to it, so it should be gone. No, the stream must refer to it, in order to keep its promise to return

Re: Streams work

2009-01-22 Thread Rich Hickey
On Jan 22, 2009, at 12:36 PM, Stuart Sierra wrote: On Jan 21, 2:33 pm, Rich Hickey richhic...@gmail.com wrote: I've started documenting the streams work I have been doing, for those interested: Cool! 3 questions: 1. Can you feed things into a stream? Yes, you can put a generator

Re: bug: bean returns the wrong kind of false

2009-01-21 Thread Rich Hickey
On Jan 21, 12:14 am, Chouser chou...@gmail.com wrote: The first method of the String class does not take varargs: user= (.isVarArgs (first (.getMethods String))) false The above is the Right Kind of False, as shown here: user= (if (.isVarArgs (first (.getMethods String))) :true :false)

Streams work

2009-01-21 Thread Rich Hickey
I've started documenting the streams work I have been doing, for those interested: http://clojure.org/streams Feedback welcome, Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Mysterious performance anomalies

2009-01-21 Thread Rich Hickey
On Jan 21, 5:02 pm, Jon Harrop j...@ffconsultancy.com wrote: On Tuesday 20 January 2009 21:41:29 Rich Hickey wrote: This issue (TCO) is resolved - it's a limitation of the JVM that Clojure accepts. If that is a significant problem for anyone they should either not use Clojure or work

Re: Streams work

2009-01-21 Thread Rich Hickey
On Jan 21, 7:40 pm, Vincent Foley vfo...@gmail.com wrote: I have a question regarding the examples, specifically map* and filter* (defn map* [f coll] (let [iter (stream-iter coll)] (stream (fn [eos] (let [x (next! iter eos)] (if (= eos x) x (f x)))

Re: Streams work

2009-01-21 Thread Rich Hickey
On Jan 21, 8:05 pm, e evier...@gmail.com wrote: I'm stopping to write this after the seq definition (bullet) to give you my exact feeling moving on. You may find that that is ok and that I will get it by the end of the page: What I assume at this point to be true is that if I first use an

Re: Streams work

2009-01-21 Thread Rich Hickey
On Jan 21, 2009, at 8:58 PM, Vincent Foley wrote: I made some tests, and if I am not mistaken, if an eos is not specifically specified, Object is used, is that right? user= (let [iter (stream-iter (range 5))] (def s (stream (fn [eos] (let [x (next! iter eos)]

Re: per-defmulti hierarchies

2009-01-20 Thread Rich Hickey
On Jan 20, 12:13 am, Mark Fredrickson mark.m.fredrick...@gmail.com wrote: On the subject of per defmulti hierarchies: The recent CLJOS thread got me thinking about this problem again. While allowing per-multimethod hierarchies solves a large number problems, I think it might be lacking for

<    1   2   3   4   5   6   7   8   9   10   >