Re: Michael newbee challange nr 1

2009-11-09 Thread DTH
On Nov 8, 12:33 pm, Michael Jaaka michael.ja...@googlemail.com wrote: now I would like get such effect that callbackListener will be called twice for the example collection. once with tom and iterator (or a lazy seq) to lazy evaluated collection of (32 and 2333) and second with anne and

Re: Gensym collisions can be engineered.

2009-11-09 Thread Kevin Tucker
This is something that I have been wondering about too. In CL the symbols gensym produces can not be read by the reader so there can be no collision cause the only way to get a handle on the symbol is to create it with gensym and hold on to it. In other words you couldn't construct a symbol

Re: equivalent to Haskell's group function

2009-11-09 Thread Meikel Brandmeyer
Hi, Am 09.11.2009 um 07:33 schrieb Wilson MacGyver: I did search in the API docs for both core and contrib, but didn't find anything like it. Does Clojure have a function like Haskell's group? In Haskell, Input: group [1,2,2,1,1,1,2,2,2,1] Output: [[1],[2,2],[1,1,1],[2,2,2],[1]] I'm

Re: newbie question

2009-11-09 Thread Edmund Jackson
Here's something based on a similar question I asked in #clojure the other day, based on the code Chousuke answered with (all ugliness is my fault). (defn cond [f pred] (fn [coll acc outp] (if (empty? coll) (conj outp acc) (if

Re: Michael newbee challange nr 1

2009-11-09 Thread Michael Jaaka
Keys are always sorted. So once a key stops appearing it won't appear again. The first solution seems to be the right one, because all values are processed in a sequence manner in a lazy way. 2009/11/8 DTH dth...@gmail.com On Nov 8, 12:33 pm, Michael Jaaka michael.ja...@googlemail.com wrote:

Re: Michael newbee challange nr 1

2009-11-09 Thread Michael Jaaka
By the first I mean this done by Meikel Brandmeyer. However I will check later also this one: (use '[clojure.contrib.seq-utils :only (partition-by)]) (map (comp callback-fn (fn [part] [(ffirst part) (map second part)])) (partition-by first *s*)) and the other question is if I have (def c [

getting emacs etags for Clojure source?

2009-11-09 Thread Stuart Halloway
I have a poor man's version: find . -name '*.clj' | xargs etags --regex=@/Users/stuart/bin/ clojure.tags clojure.tags = /[ \t\(]*def[a-z]* \([a-z-!]+\)/\1/ /[ \t\(]*ns \([a-z.]+\)/\1/ Anyone have a better approach? Thanks, Stu

Re: Michael newbee challange nr 1

2009-11-09 Thread Meikel Brandmeyer
Hi, On Nov 9, 3:14 pm, Michael Jaaka michael.ja...@googlemail.com wrote: and the other question is if I have (def c [ [ 1 2 ] [ 3 4 ] ]) and want to get lazily [ 2 4 ] (values of tuplets of a sequence) will be this a correct (map #(- % fnext)  c ) way? (map second c) is what you want. This

Re: Gensym collisions can be engineered.

2009-11-09 Thread John Harrop
On Sun, Nov 8, 2009 at 5:56 PM, Kevin Tucker tuckerke...@gmail.com wrote: This is something that I have been wondering about too. In CL the symbols gensym produces can not be read by the reader so there can be no collision cause the only way to get a handle on the symbol is to create it with

Iterative collections.

2009-11-09 Thread David Brown
Given the recent talk about iter and how most of the expressions can be done easily with sequences and map. I however, have found that map often makes these difficult to read because the names are up front in the function and the arguments follow this. So, I threw together the following macro

Re: equivalent to Haskell's group function

2009-11-09 Thread Emeka
Meikel, Is like you over engineered your version? (defn group [s] (lazy-seq (when-let [s (seq s)] (let [f(first s) [fs r] (split-with #(= % f) s)] (cons fs (group r)) Should be .. (defn group [s] (lazy-seq (when-let [s (seq s)] (let [f

Re: equivalent to Haskell's group function

2009-11-09 Thread Emeka
Meikel, What is the gain of using lazy-seq here? Why can't we go without laziness? (defn group [s] (when-let [s (seq s)] (let [f(first s) [fs r] (split-with #(= % f) s)] (cons fs (group r) Regards, Emeka On Mon, Nov 9, 2009 at 4:44 PM, Emeka

Re: equivalent to Haskell's group function

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 04:49:16PM +, Emeka wrote: What is the gain of using lazy-seq here? Why can't we go without laziness? - The lazy version doesn't consume stack per length of the sequence. - The lazy version works with unbounded sequences. For short sequences it probably

Re: Iterative collections.

2009-11-09 Thread pmf
On Nov 9, 5:39 pm, David Brown cloj...@davidb.org wrote:    (let-map [x [31 41 59 26]              y (iterate inc 1)]      (+ x y)) Probably not that interesting in the simple case. How is this different from using for? It's also lazy and supports destructuring. (for [x [31 41 59 26]

Re: Iterative collections.

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 09:07:31AM -0800, pmf wrote: On Nov 9, 5:39 pm, David Brown cloj...@davidb.org wrote:    (let-map [x [31 41 59 26]              y (iterate inc 1)]      (+ x y)) Probably not that interesting in the simple case. How is this different from using for? It's also lazy

Re: Iterative collections.

2009-11-09 Thread pmf
On Nov 9, 6:42 pm, David Brown cloj...@davidb.org wrote: And gives very different results.  'for' iterates over it's sequences in a nested fasion.  For your particular example, it will return the sequence from (+ 31 1) (+ 31 2) and so on, and never get to the second element of the first

ANN: Autodoc for clojure core, first rev

2009-11-09 Thread Tom Faulhaber
Hi all, I've been adapting my documentation robot to work for things other than contrib and the first result is now available: documentation for HEAD in clojure core. You can find it here: http://tomfaulhaber.github.com/clojure/ There are still a few bugs in the links and some of the clojure

Re: ANN: Autodoc for clojure core, first rev

2009-11-09 Thread Sean Devlin
Tom, Great work getting this to work for core. This will really, really, really help those of us running edge Clojure. BUGS: * In Firefox 3.5, the api-index page overflows the right edge of the background. It looks right in IE 6 7. I'll check Safari tonight. * Your Letter

Re: equivalent to Haskell's group function

2009-11-09 Thread Wilson MacGyver
Thanks guys for the various solutions. I set out trying to try a recur solution So I came up with this. the idea is to go through the collection being passed, and grab one element, then do drop-while until a different element is encountered. repeat until there is no more left in the collection.

Communication in a distributed system

2009-11-09 Thread Michael Jaaka
Hi! Is there any support from Clojure for communication between procesess by sockets? I'm interested in communication via RMI. How about agents? I don't know much about agents exept fact that they are seen in terms of threads in the same process? Should the socket communication/RMI be

Re: equivalent to Haskell's group function

2009-11-09 Thread Emeka
(defn group [x] (loop [newlist [] currlist x] (if (not (empty? x)) (recur (newlist (cons (first x) newlist)) (newlist (cons (first x) newlist)) You are making a function call here using an empty vector and your argument is a list. This is not possible, that's why you have that error ([] (cons

Re: equivalent to Haskell's group function

2009-11-09 Thread Wilson MacGyver
On Mon, Nov 9, 2009 at 2:31 PM, Emeka emekami...@gmail.com wrote: (defn group [x] (loop [newlist [] currlist x]  (if (not (empty? x))    (recur (newlist (cons (first x) newlist)) (newlist (cons (first x) newlist))  You are making a function call here using an empty vector and your argument

Re: Iterative collections.

2009-11-09 Thread Andrew Boekhoff
Hi. And gives very different results. 'for' iterates over it's sequences in a nested fasion. For your particular example, it will return the sequence from (+ 31 1) (+ 31 2) and so on, and never get to the second element of the first vector. I like it. I was recently wondering about a

Re: equivalent to Haskell's group function

2009-11-09 Thread Meikel Brandmeyer
Hi, Am 09.11.2009 um 20:08 schrieb Wilson MacGyver: (defn group [x] (loop [newlist [] currlist x] (if (not (empty? x)) (recur (newlist (cons (first x) newlist)) (currlist (drop-while #(= (first currlist) %) currlist)) It seems logical to me, but when I tried

Re: equivalent to Haskell's group function

2009-11-09 Thread Wilson MacGyver
Ah that was what I was missing. You are right, I misunderstood the recur form. For some reason I thought in recur you have to specify the name of the variable that it's bound to. so when I wrote (recur (newlist (cons (first x) newlist)) I thought I was saying in recur, rebind (cons (first x)

Re: Consistency of the API

2009-11-09 Thread Kevin Downey
I don't understand, the error message you get is the error that occurred. the docstring from even? says it throws an exception if the argument is not and integer. I would hope that anyone that has read the docstring for contains? would not use (contains? 'foo 'bar), because, uh, that just makes

Re: Consistency of the API

2009-11-09 Thread Tiago Antão
On Mon, Nov 9, 2009 at 8:08 PM, Kevin Downey redc...@gmail.com wrote: I don't understand, the error message you get is the error that occurred. Both of them honor their documentation - no doubt. My point is not that, my point is that the behavior is different between the 2 functions for the

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
The general philosophy in Clojure seems to be that if you use a function in a way that is not intended, there's no guarantee about what might happen. You might get an error, or you might just get a strange result. --~--~-~--~~~---~--~~ You received this message

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
2009/11/9 Tiago Antão tiagoan...@gmail.com: What is the rationale for even? and contains? having different behaviors for the exact same error (ie, one throws the other works fine and just returns false on a type error)? From a design perspective this seems to increase the cognitive load to

Re: Consistency of the API

2009-11-09 Thread Kevin Downey
the behavior of functions outside of their domain is undefined. I guess I still don't get it. why would you use a function on something outside of its domain? do people just pick functions at random to compose their programs? 2009/11/9 Tiago Antão tiagoan...@gmail.com: On Mon, Nov 9, 2009 at

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
On Mon, Nov 9, 2009 at 12:32 PM, Kevin Downey redc...@gmail.com wrote: the behavior of functions outside of their domain is undefined. I guess I still don't get it. why would you use a function on something outside of its domain? do people just pick functions at random to compose their

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
Here's another way to think about it. Why is functional programming better than imperative programming? One common answer to this question is that functional programs are easier to debug. Why? Because in an imperative program, if one part has an error, the error doesn't necessarily manifest

Re: Iterative collections.

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 12:52 PM, Andrew Boekhoff boekho...@gmail.comwrote: Hi. And gives very different results. 'for' iterates over it's sequences in a nested fasion. For your particular example, it will return the sequence from (+ 31 1) (+ 31 2) and so on, and never get to the second

Re: Consistency of the API

2009-11-09 Thread Kevin Downey
what makes functional programming better is the reduction of state. so for example, if I decide that the function call out to contains? is too much overhead in a tight loop, I can just copy and paste the relevant code without being concerned that I might miss some crucial piece of state it

Re: Consistency of the API

2009-11-09 Thread Tiago Antão
On Mon, Nov 9, 2009 at 8:31 PM, Mark Engelberg mark.engelb...@gmail.com wrote: I imagine the rationale is efficiency.  Every core function could conceivably do a number of runtime checks to make sure that each input is the right kind of type, and then Clojure might feel more sluggish. So

Re: ANN: Autodoc for clojure core, first rev

2009-11-09 Thread Howard Lewis Ship
It looks very nice ... still I'd love to see something like what clj-doc does (http://github.com/mmcgrana/clj-doc) ... it adds a text field that you can type into and it matches the available names against what you type, hiding the rest. So if you know part of the name, you can take a very large

Re: Running out of memory when using loop/recur and destructuring

2009-11-09 Thread Rock
I've been following this thread, and I must say I'm puzzled that Rich hasn't said anything at all about this issue yet. It seems important enough to hear his own opinion. On 6 Nov, 18:56, Paul Mooser taron...@gmail.com wrote: So, I've been hoping that Rich (or someone?) would weigh in on this,

Re: ANN: Autodoc for clojure core, first rev

2009-11-09 Thread Konrad Hinsen
other than those mentioned already:. But please add clojure.test and clojure.parallel as well! Konrad. __ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 4589 (20091109) __ Le message a été vérifié par ESET NOD32 Antivirus. http

Re: Consistency of the API

2009-11-09 Thread Konrad Hinsen
d'ESET NOD32 Antivirus, version de la base des signatures de virus 4589 (20091109) __ Le message a été vérifié par ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Running out of memory when using loop/recur and destructuring

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 4:31 PM, Rock rocco.ro...@gmail.com wrote: I've been following this thread, and I must say I'm puzzled that Rich hasn't said anything at all about this issue yet. It seems important enough to hear his own opinion. My observation over the past few months is that Rich

Re: ANN: Autodoc for clojure core, first rev

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 4:28 PM, Howard Lewis Ship hls...@gmail.com wrote: It looks very nice ... still I'd love to see something like what clj-doc does (http://github.com/mmcgrana/clj-doc) ... it adds a text field that you can type into and it matches the available names against what you

Re: Consistency of the API

2009-11-09 Thread John Harrop
Even more interesting is the behavior of contains? when passed strings: user= (contains? foo \o) false user= (contains? foo 2) true user= (contains? foo 3) false user= (contains? 'foo 2) false It seems to treat strings as it does vectors, seeing if an index is in bounds or not. It doesn't treat

Re: ANN: Autodoc for clojure core, first rev

2009-11-09 Thread Michael Jaaka
Why when I click on left in the index menu, the description of a function shows on top? It should be right next to clicked position, so I won't scroll whole page on top in order to read doc. Wiadomość napisana przez John Harrop w dniu 2009-11-09, o godz. 23:08: On Mon, Nov 9, 2009 at 4:28

How to convert java Complex type to Clojure type?

2009-11-09 Thread Michael Jaaka
Hi! How to convert HashMapString, String to Clojure map, sorted-map, tree-map How far I'm able only to do it with (let [a (HashMap. { abc def}) ] (zipmap (keys a) (vals a))) Note that HashMap. { ... } is here only as example, cause in fact it is a result from Java method call. What

Re: Consistency of the API

2009-11-09 Thread Alex Osborne
Mark Engelberg wrote: 2009/11/9 Tiago Antão tiagoan...@gmail.com: What is the rationale for even? and contains? having different behaviors for the exact same error (ie, one throws the other works fine and just returns false on a type error)? I imagine the rationale is efficiency. Here's

Re: How to convert java Complex type to Clojure type?

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 11:42:32PM +0100, Michael Jaaka wrote: How to convert HashMapString, String to Clojure map, sorted-map, tree-map (into {} hm) or (into (sorted-map) hm) where hm is the hash map. You can also just use the hash map like you would a Clojure map, but it might change

Re: How to convert java Complex type to Clojure type?

2009-11-09 Thread Alex Osborne
Michael Jaaka wrote: How to convert HashMapString, String to Clojure map, sorted-map, tree-map How far I'm able only to do it with (let [a (HashMap. { abc def}) ] (zipmap (keys a) (vals a))) Note that HashMap. { ... } is here only as example, cause in fact it is a result from

Re: How to convert java Complex type to Clojure type?

2009-11-09 Thread Michael Jaaka
Ok, that is nice. But when you look at core.clj you will find (defn hash-map keyval = key val Returns a new hash map with supplied mappings. ([] {}) ([ keyvals] (. clojure.lang.PersistentHashMap (create keyvals And when you look at clojure.lang.PersistentHashMap you will

Re: How to convert java Complex type to Clojure type?

2009-11-09 Thread Michael Jaaka
Well there is a bug. One declaration is missing... Try add your routine: (defn hash-map2 ([ keyvals] (. clojure.lang.PersistentHashMap (create keyvals Then call (hash-map2 (HashMap. { tom boom } ) ) Wiadomość napisana przez Alex Osborne w dniu 2009-11-09, o godz. 23:55:

Re: Consistency of the API

2009-11-09 Thread Tiago Antão
On Mon, Nov 9, 2009 at 10:20 PM, John Harrop jharrop...@gmail.com wrote: It seems to treat strings as it does vectors, seeing if an index is in bounds or not. It doesn't treat symbols as anything though. The clojure.contrib.seq-utils/includes? function gives true for foo and I did not want

Re: Boggle solver

2009-11-09 Thread william douglas
Very nice, I had actually been implementing a boggle solver for my optimal boggle grid generator (5x5 with no limits on number of letters on dice). I hadn't discovered the wonders of assoc-in though which makes things look much nicer when creating nested maps. I really like the layout of your

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
2009/11/9 Tiago Antão tiagoan...@gmail.com: But the end result with strings and vectors is a tad unintuitive... Right, strings and vectors can be thought of as either collections, or as associative mappings from integers to characters/objects. contains? treats them as associative mappings.

Re: Consistency of the API

2009-11-09 Thread Richard Newman
Right, strings and vectors can be thought of as either collections, or as associative mappings from integers to characters/objects. contains? treats them as associative mappings. Yes, it's unintuitive, but it has a certain degree of internal consistency. This certainly encourages you to use

Re: Consistency of the API

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 5:50 PM, Alex Osborne a...@meshy.org wrote: Mark Engelberg wrote: 2009/11/9 Tiago Antão tiagoan...@gmail.com: What is the rationale for even? and contains? having different behaviors for the exact same error (ie, one throws the other works fine and just returns

Re: Consistency of the API

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 8:28 PM, John Harrop jharrop...@gmail.com wrote: Why not: static public Object contains(Object coll, Object key){ if(coll == null) return F; else if(coll instanceof Map) return ((Map) coll).containsKey(key) ? T : F;

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
On Mon, Nov 9, 2009 at 5:41 PM, John Harrop jharrop...@gmail.com wrote: In the meantime, the main thing still missing from Clojure is a convenient queue. What's wrong with clojure.lang.PersistentQueue? --~--~-~--~~~---~--~~ You received this message because you

Re: Consistency of the API

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 08:41:25PM -0500, John Harrop wrote: In the meantime, the main thing still missing from Clojure is a convenient queue. Lists and vectors both add and remove efficiently only at one end, and at the same end for add and remove in both cases. Doubly-linked lists can't be

Re: Consistency of the API

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 05:53:28PM -0800, Mark Engelberg wrote: On Mon, Nov 9, 2009 at 5:41 PM, John Harrop jharrop...@gmail.com wrote: In the meantime, the main thing still missing from Clojure is a convenient queue. What's wrong with clojure.lang.PersistentQueue? The only clojure

Re: Consistency of the API

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 05:54:36PM -0800, David Brown wrote: Depending on use behavior, you can also make a decent lazy queue just out a two lists, where you reverse and append whenever the source side fills up. Ok, this is what PersistentQueue is, except without the reverse and append, so it

Re: Running out of memory when using loop/recur and destructuring

2009-11-09 Thread Paul Mooser
I imagine he's just busy. At this point, I plan to create a ticket on assembla, if that's possible - I think I just need to create a login and then file it. On Nov 9, 2:07 pm, John Harrop jharrop...@gmail.com wrote: On Mon, Nov 9, 2009 at 4:31 PM, Rock rocco.ro...@gmail.com wrote: I've been

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
On Mon, Nov 9, 2009 at 5:54 PM, David Brown cloj...@davidb.org wrote: Perhaps the GHC Data.Sequence library could be ported.  It's based on 2-3 finger trees, and allows efficient adding and removal from either end of the sequence. I've tried porting finger trees to Scheme before, and although

Re: Consistency of the API

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 8:41 PM, John Harrop jharrop...@gmail.com wrote: In the meantime, the main thing still missing from Clojure is a convenient queue. Lists and vectors both add and remove efficiently only at one end, and at the same end for add and remove in both cases. Doubly-linked lists

Re: Consistency of the API

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 8:53 PM, Mark Engelberg mark.engelb...@gmail.comwrote: On Mon, Nov 9, 2009 at 5:41 PM, John Harrop jharrop...@gmail.com wrote: In the meantime, the main thing still missing from Clojure is a convenient queue. What's wrong with clojure.lang.PersistentQueue? There

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
Yes, it's in Clojure 1.0, it just doesn't have a convenient name. So give it a convenient name like this: (def empty-queue clojure.lang.PersistentQueue/EMPTY) and then you're ready to go. conj, peek, pop, into and all the other sequence-based functions work the way you'd expect. The

Re: Consistency of the API

2009-11-09 Thread John Harrop
On Mon, Nov 9, 2009 at 10:37 PM, Mark Engelberg mark.engelb...@gmail.comwrote: Yes, it's in Clojure 1.0, it just doesn't have a convenient name. So give it a convenient name like this: (def empty-queue clojure.lang.PersistentQueue/EMPTY) and then you're ready to go. conj, peek, pop, into

Re: Consistency of the API

2009-11-09 Thread Mark Engelberg
How does it efficiently deal with when the list-part has been completely consumed? Well, the latest code is here: http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/PersistentQueue.java I don't know whether it has changed since 1.0. Just look in the src/jvm/clojure/lang

Aquamacs Preferences.el

2009-11-09 Thread Sean Devlin
Hello all, I'm trying to add a directory to my classpath in Aquamacs. How do I do this recusively? Here's what I've got right now (setq swank-clojure-extra-classpaths (list ...lots-of-jars... ~/Applications/clojure-apps/swing-test/)) Can somebody give me a hand? Thanks!

Re: getting emacs etags for Clojure source?

2009-11-09 Thread Phil Hagelberg
On Nov 9, 6:36 am, Stuart Halloway stuart.hallo...@gmail.com wrote: I have a poor man's version:    find . -name '*.clj' | xargs etags --regex=@/Users/stuart/bin/ clojure.tags    clojure.tags =    /[ \t\(]*def[a-z]* \([a-z-!]+\)/\1/    /[ \t\(]*ns \([a-z.]+\)/\1/ Anyone have a better

Using agents and blocking I/O.

2009-11-09 Thread David Brown
I'm trying to get a better grasp of how Agents are intended to be used, so let me give an example scenario. Let's say I have some thing that keeps track of the state of some I/O entity, let's say some kind of file-based storage. There is state associated with the entity. It's important that

Re: Using agents and blocking I/O.

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 08:28:43PM -0800, David Brown wrote: In both cases, the reads run completely synchronously, waiting for their answer, and really the whole thing isn't really any better than just using locks. I guess a deeper concern is that there seems to only be a single call in the

Re: Using agents and blocking I/O.

2009-11-09 Thread Sean Devlin
David, Agents are designed to be call only once. That's why they're useful for I/O (stuff w/ side effects). refs, however, will retry inside a transactions. As always, Rich explains it better than me: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey Sean On Nov 9, 11:41 

Re: Using agents and blocking I/O.

2009-11-09 Thread Timothy Pratley
(locking resource (read/write)) sounds appropriate for such a resource to me. Maybe you should do locking writes through an agent, and just rely on locking for blocking reads. I don't really know how lock requests are queued, is that why you are looking for more complicated answers? ;; ugh this

Re: Using agents and blocking I/O.

2009-11-09 Thread Mark Engelberg
On Mon, Nov 9, 2009 at 8:28 PM, David Brown cloj...@davidb.org wrote: Let's say I have some thing that keeps track of the state of some I/O entity, let's say some kind of file-based storage.  There is state associated with the entity.  It's important that only one thread be able to read or

Re: Gensym collisions can be engineered.

2009-11-09 Thread Kevin Tucker
I in CL they can be read but aren't interned in any package so every time you read it you get a different symbol. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Vector manipulation problem, possible function for a solution.

2009-11-09 Thread Don
I am having a problem with vectors. It seems there should be a function for this however I am not sure. I have a vector a [ [2 3] [4 5] [6 7] ] And I want to be able to get [2 3 4 5 6 7] Any suggestions greatly appreciated. Thank you. --~--~-~--~~~---~--~~

Re: Vector manipulation problem, possible function for a solution.

2009-11-09 Thread David Nolen
(use 'clojure.contrib.seq-utils) (flatten [ [2 3] [4 5] [6 7] ]) On Mon, Nov 9, 2009 at 8:19 PM, Don josereyno...@gmail.com wrote: I am having a problem with vectors. It seems there should be a function for this however I am not sure. I have a vector a [ [2 3] [4 5] [6 7] ] And I want to

Re: Vector manipulation problem, possible function for a solution.

2009-11-09 Thread Richard Newman
I have a vector a [ [2 3] [4 5] [6 7] ] And I want to be able to get [2 3 4 5 6 7] user= (reduce into [ [2 3] [4 5] [6 7] ]) [2 3 4 5 6 7] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: Vector manipulation problem, possible function for a solution.

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 05:19:41PM -0800, Don wrote: I am having a problem with vectors. It seems there should be a function for this however I am not sure. I have a vector a [ [2 3] [4 5] [6 7] ] And I want to be able to get [2 3 4 5 6 7] There's a flatten in clojure.contrib.seq-utils that

Re: Using agents and blocking I/O.

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 09:42:28PM -0800, Mark Engelberg wrote: But let's say the agent is responsible some enormous database, and it's impractical for the in-memory state to hold all the information that readers might find useful. In this case, I think you're right that the basic agent

Re: Using agents and blocking I/O.

2009-11-09 Thread David Brown
On Mon, Nov 09, 2009 at 10:07:41PM -0800, David Brown wrote: On Mon, Nov 09, 2009 at 09:42:28PM -0800, Mark Engelberg wrote: But let's say the agent is responsible some enormous database, and it's impractical for the in-memory state to hold all the information that readers might find useful. In