Re: seq and vector

2008-11-24 Thread [EMAIL PROTECTED]
On Nov 24, 3:03 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:> > Speculating about inefficiency without a concrete counter-proposal is > not productive. While there could no doubt be some higher-performance > vector constructor/reducers, producing vector-returning versions of > the sequence ops is no

Re: seq and vector

2008-11-24 Thread Rich Hickey
On Nov 24, 2:41 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Nov 24, 12:41 am, "Kevin Downey" <[EMAIL PROTECTED]> wrote: > > > I don't think you understand. clojure data structures are IMMUTABLE. > > every call to conj, or anyother function returns a "new" object. To > > optimize ther

Re: seq and vector

2008-11-23 Thread [EMAIL PROTECTED]
On Nov 24, 12:41 am, "Kevin Downey" <[EMAIL PROTECTED]> wrote: > I don't think you understand. clojure data structures are IMMUTABLE. > every call to conj, or anyother function returns a "new" object. To > optimize there is sharing of structure. In the particular case at hand, i.e. calling vec on

Re: seq and vector

2008-11-23 Thread Kevin Downey
I don't think you understand. clojure data structures are IMMUTABLE. every call to conj, or anyother function returns a "new" object. To optimize there is sharing of structure. On Sun, Nov 23, 2008 at 4:38 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Nov 23, 1:23 am, Rich Hickey <[EMAI

Re: seq and vector

2008-11-23 Thread Matthias Hölzl
On Sun, Nov 23, 2008 at 2:34 PM, André Thieme <[EMAIL PROTECTED]>wrote: > > On 23 Nov., 13:38, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > I have agents whose state is a vector (used as a buffer) of messages. > > There are a couple of transformation functions, e.g. tagging messages, > >

Re: seq and vector

2008-11-23 Thread Stuart Sierra
On Nov 23, 1:23 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I still don't understand your expectation here. If the filter does any > filtering, it won't return everything in the vector, so the new result > will have fewer items. Do you want a vector with fewer items? Then > you'll have a new vect

Re: seq and vector

2008-11-23 Thread André Thieme
On 23 Nov., 13:38, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have agents whose state is a vector (used as a buffer) of messages. > There are a couple of transformation functions, e.g. tagging messages, > removing messages from the vector etc. which are implemented with map > and filter.

Re: seq and vector

2008-11-23 Thread [EMAIL PROTECTED]
On Nov 23, 1:23 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I still don't understand your expectation here. If the filter does any > filtering, it won't return everything in the vector, so the new result > will have fewer items. Do you want a vector with fewer items? Then > you'll have a new vect

Re: seq and vector

2008-11-22 Thread André Thieme
On 23 Nov., 01:23, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 22, 4:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > I still don't understand your expectation here. If the filter does any > filtering, it won't return everything in the vector, so the new result > will have fewer item

Re: seq and vector

2008-11-22 Thread Rich Hickey
On Nov 22, 4:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Nov 22, 9:48 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > map and filter don't modify anything. What does it mean to filter a > > vector? > > Yes yes, I know that. Still in English its sometimes easier to be > sloppy and

Re: seq and vector

2008-11-22 Thread pmf
On Nov 22, 10:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > [...] Still in general my > issue seems to be that data strucutres turn into seqs and this can > cause subtle issues as for instance the different behaviour of conj > and a simple rule such as calling vec on the seq seems to b

Re: seq and vector

2008-11-22 Thread [EMAIL PROTECTED]
On Nov 22, 9:48 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > map and filter don't modify anything. What does it mean to filter a > vector? Yes yes, I know that. Still in English its sometimes easier to be sloppy and pretend that I modify something even though I get another vector. > In any case,

Re: seq and vector

2008-11-22 Thread Rich Hickey
On Nov 22, 1:07 pm, [EMAIL PROTECTED] wrote: > In one of my data structures I have a vector as a buffer where things > are appended to. In addition the things in that buffer sometimes get > modified using map or filter. Now as map and filter return sequences I > wonder how to get a vector back e

Re: seq and vector

2008-11-22 Thread [EMAIL PROTECTED]
On Nov 22, 7:31 pm, "Christian Vest Hansen" <[EMAIL PROTECTED]> wrote: > With (vec) I think:http://clojure.org/api#toc508 That's not really efficient as it copies the whole seq. It seems that relative to sequences the other data structures are second class insofar as when you use the sequence lib

Re: seq and vector

2008-11-22 Thread Christian Vest Hansen
With (vec) I think: http://clojure.org/api#toc508 On Sat, Nov 22, 2008 at 7:07 PM, <[EMAIL PROTECTED]> wrote: > > In one of my data structures I have a vector as a buffer where things > are appended to. In addition the things in that buffer sometimes get > modified using map or filter. Now as ma

seq and vector

2008-11-22 Thread ntupel
In one of my data structures I have a vector as a buffer where things are appended to. In addition the things in that buffer sometimes get modified using map or filter. Now as map and filter return sequences I wonder how to get a vector back efficiently. I need a vector in order for conj to append