[racket-dev] `take' argument order

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jun 8 10:13:32 EDT 2011

I like the current order of `take' because it's consistent with
Racket's dominant convention. To the list of advantages, I would add
"consistent with `take' in SRFI-1".

It seems strange to make `take' less compatible with SRFI-1's `take'
toward the end of making `take' be more compatible with SRFI-1's
`take-while'. Global consistency (not to mention backward
compatibility) seems better served by being incompatible with SRFI-1's
`take-while'.

At Wed, 8 Jun 2011 09:36:50 -0400, Eli Barzilay wrote:
> So ... no objections to this?
> 
> 
> Yesterday, Eli Barzilay wrote:
> > While trying to finally get `take-while' etc, I realized that the
> > problem with the `take' (and `drop' and related) argument order is
> > even more thorny.  The existing problem is that `take' in lazy takes
> > the number first and then the list -- not a big problem by itself,
> > but:
> > 
> > * Contradicts Haskell's argument order
> > 
> > * Contradicts Clojure's argument order
> > 
> > * *And* contradicts srfi-1's argument order for `take-while', which
> >   takes the predicate first
> > 
> > So how about making it take its inputs in any order?  (Possibly
> > deprecating the number-last in the docs and eventually removing it.)
> > 
> > No need to start a flamewar -- I know why it would be bad.  But the
> > above mess and potential confusion seems big enough to outweigh it.
> > Specifically, it seems to me very odd now to go with the srfi-1
> > ordering for `take-while' and friends.  (I'm also fine with swapping
> > the arguments completely, but it seems that the breakage makes it a
> > bad change.)
> > 
> > To make things balanced --
> > 
> > * I see two arguments for keeping the order as it is now: (a) it makes
> >   it more like `list-ref' etc, where the number comes last (potential
> >   solution if the above is acceptable: make it do the same too, or
> >   just admit that indexing is different from these things); and
> >   (b) it accomodates better a potential future (list-slice l from too)
> >   which would look odd with the from-too arguments before the list.
> > 
> > * OTOH, the advantages of the number-first order are being compatible
> >   with the rest of the world, and an order that is uniformly used in
> >   `take-while' etc.
> > 
> > Opinions?
> 
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                     http://barzilay.org/                   Maze is Life!
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/dev


Posted on the dev mailing list.