[racket-dev] `take' argument order

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 7 03:49:07 EDT 2011

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!


Posted on the dev mailing list.