Re: Custom vectors/maps and sequence functions

2019-01-16 Thread Herwig Hochleitner
Am Do., 17. Jan. 2019 um 00:52 Uhr schrieb Herwig Hochleitner < hhochleit...@gmail.com>: > 5. I could attach table like descriptions to each Record object (be it in >> its metadata or else), but then enforcing that all Records share the same >> Table data could get penalizing at runtime. >> > >

Re: Custom vectors/maps and sequence functions

2019-01-16 Thread Herwig Hochleitner
Am Di., 15. Jan. 2019 um 14:58 Uhr schrieb : > > Imagine I try on the one side to represent something like a database table > in memory, while on the other to make it pluggable into all meaningful > sequence and vector/map functions in Clojure. In the most naive > implementation a table is a

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread plamen . usenet
P.S. Actually it just a coincidence that in my use case I am not concerned with let say trees, but with "Records" in a "Table", which in contrast map somehow nicely to IPersistentMap (where I can put a lot of additional functionality in a transparent way) and a "Table" (where the sequence

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread greybird
Thanks for explaining Plamen. Yes, it seems very difficult to treat a database abstraction as a regular Clojure map/vector. FWIW, in writing an app I think it works well to use SQL queries to return ordinary maps/vectors which can then be manipulated as usual. But I think you are doing

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread plamen . usenet
Hello Mark the reason was that I want them to act as if they are maps and vectors for an end user developer and let him work with all the usual Clojure functions for these data structures, while internally they would have some different implementation and additional functionality (for

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread greybird
Hi Plamen, I don't have any advice to offer but I'm curious why you want to bind the table and column type info directly onto the result set. If you associate them in some other way, then you can just use plain maps and vectors. Are you trying to have less total objects in your API? -- You

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread plamen . usenet
Hello James Yes. The (into (empty table) (comp (filter process?) (map process)) table) was exactly what I wanted for an end user to avoid to have to write, but just a (filter ... table), otherwise I could provide a wrapper like (defn myfilter [pred table] (into (empty table) (comp (filter

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread plamen . usenet
Hello Alex On Tuesday, January 15, 2019 at 3:19:05 PM UTC+1, Alex Miller wrote: > > Well first, there is a conscious split between collection and sequence > functions. Collection functions take a collection and return the same > collection (and take the collection first) - things like conj,

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread James Reeves
On Tue, 15 Jan 2019 at 13:58, wrote: > So - do I miss something either in my knowledge or in the Clojure's > documentation/implementation and is there a meaningful way to apply > Clojure's and not mine filter/map/take/drop/sort etc. functions on a Table > and to get a Table back, without going

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread Alex Miller
Well first, there is a conscious split between collection and sequence functions. Collection functions take a collection and return the same collection (and take the collection first) - things like conj, assoc, dissoc, disj, etc. Those functions are all trait-based and "update" operations are

Re: Custom vectors/maps and sequence functions

2019-01-15 Thread plamen . usenet
P.S. This is a question about clarification/advice, not a critique to Clojure, as it actually works as advertised :) On Tuesday, January 15, 2019 at 2:58:07 PM UTC+1, plamen...@gmail.com wrote: > > Hello all > > while working on a daily basis where I use Clojure's native vectors/maps I > almost

Custom vectors/maps and sequence functions

2019-01-15 Thread plamen . usenet
Hello all while working on a daily basis where I use Clojure's native vectors/maps I almost never experience the problem and even if - it is easy fixable with something like (into [] ...), I have the following problem with custom data structures and ask here for clarification if my