Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-11 Thread Gary Poster
On Nov 11, 2010, at 10:36 AM, Gary Poster wrote: > > To dupe, this is my really-fast definition of seq-reverse, ..."really fast" is supposed to mean "really quickly written" not "highly performance optimized"... -- You received this message because you are subscribed to the Google Groups "Cl

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-11 Thread Gary Poster
On Nov 10, 2010, at 9:05 PM, Sean Corfield wrote: > On Wed, Nov 10, 2010 at 11:37 AM, Gary Poster wrote: >> In my opinion, its promise is that it reverses anything that supports the >> minimal seq interface. Its implementation can be pluggable via protocols > > Hmm, don't protocols have some

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-11 Thread pepijn (aka fliebel)
I like this! It would be very helpful to have a type-hinted arglist(So I know it takes a seq and a number), and :similar to group things like map, pmap, amap, and :for for functions which are made for a specific thing, like swap! or deref. On Nov 11, 1:04 am, Michael Gardner wrote: > On Nov 10, 2

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Sean Corfield
On Wed, Nov 10, 2010 at 11:37 AM, Gary Poster wrote: > In my opinion, its promise is that it reverses anything that supports the > minimal seq interface.  Its implementation can be pluggable via protocols Hmm, don't protocols have some overhead? Switching an implementation from a direct, possibl

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Michael Gardner
On Nov 10, 2010, at 5:48 PM, Alan wrote: > I guess you stay backwards-compatible by putting it in the docstring, > but isn't it more general, clean, and programmatic to put these useful > bits of information into new entries in (meta f)? That's pretty much what I was trying to get at with "struct

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Alan
I guess you stay backwards-compatible by putting it in the docstring, but isn't it more general, clean, and programmatic to put these useful bits of information into new entries in (meta f)? On Nov 10, 3:14 pm, Carson wrote: > > But perhaps it should be more clear. What if there were some additio

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Carson
> But perhaps it should be more clear. What if there were some additional > structured fields for each doc entry, like "performance guarantees" and "see > also"? That's a good idea. I've found "See Also" sections useful in man pages, for example. And if performance guarantees are part of the s

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Gary Poster
On Nov 10, 2010, at 1:38 PM, Meikel Brandmeyer wrote: > Hi, > > Am 10.11.2010 um 17:37 schrieb Gary Poster: > >> But that's exactly my point. Why should developers have to remember to use >> rseq on a vector, as the first example? Why can't reverse simply be part of >> a protocol, so that i

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Michael Gardner
On Nov 10, 2010, at 12:40 PM, Michael Gardner wrote: > The docstring for reverse does say "not lazy", which implies at least O(n). In the general case, that is. As Meikel mentioned, reverse works on any seq, so this is the best guarantee it can provide in general. -- You received this message

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Michael Gardner
On Nov 10, 2010, at 11:36 AM, Carson wrote: >> rseq O(1), reverse O(n). >> peek O(1), last O(n). >> pop O(1), butlast O(n). >> get O(1), nth O(n). > > I don't see that in the documentation... If these functions aren't > "collapsed", then it's better if at least (doc reverse) says something > abo

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Meikel Brandmeyer
Hi, Am 10.11.2010 um 17:37 schrieb Gary Poster: > But that's exactly my point. Why should developers have to remember to use > rseq on a vector, as the first example? Why can't reverse simply be part of > a protocol, so that it gives O(1) when it can? Is there *any* practical > value to hav

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Carson
> rseq O(1), reverse O(n). > peek O(1), last O(n). > pop O(1), butlast O(n). > get O(1), nth O(n). I don't see that in the documentation... If these functions aren't "collapsed", then it's better if at least (doc reverse) says something about O(n) and "see rseq". Carson On Nov 10, 8:16 am, Meik

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Ryan Waters
Not to veer a hijack, but a 'popular' or common functions group could be useful for people learning clojure. It could be assembled by taking the number of occurrences in a set of code or by being hand-picked by people-who-should-know. Everyone who uses clojure should have an idea of everything tha

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Gary Poster
On Nov 10, 2010, at 11:16 AM, Meikel Brandmeyer wrote: > Hi, > > On 10 Nov., 17:09, Gary Poster wrote: > >> I believe that the cost of having developers remember both rseq and reverse >> (why can't reverse just DTRT if it is given a vector?), last and peek >> (same), butlast and pop (same),

Re: Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Meikel Brandmeyer
Hi, On 10 Nov., 17:09, Gary Poster wrote: > I believe that the cost of having developers remember both rseq and reverse > (why can't reverse just DTRT if it is given a vector?), last and peek (same), > butlast and pop (same), and nth and get (same) is unnecessarily high. Ehm. No. rseq O(1),

Collapse some functions? (was Re: clojure.core function decision tree)

2010-11-10 Thread Gary Poster
On Nov 10, 2010, at 6:59 AM, Pepijn de Vos wrote: > Hi all, > > It occurred to me that Clojure has a huge core namespace. While OO languages > like Python and Java stuff functions into modules and objects and have a core > of a few dozen functions, Clojure's core contains everything you might