[racket] [racket-dev] `string-split'
About a month ago, namekuseijin wrote:
> ---------- Forwarded message ----------
> From: namekuseijin <namekuseijin at gmail.com>
> Date: Thu, Apr 19, 2012 at 1:54 PM
> Subject: Re: [racket-dev] `string-split'
> To: Sam Tobin-Hochstadt <samth at ccs.neu.edu>
>
>
> On Thu, Apr 19, 2012 at 9:28 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> > Note that (string-split str ";") works given that implementation,
>
>
> while we're at it, why do you guys make the order or arguments like
> that?
It's close to the order that you get in many languages where the
string is the main subject, especially in the OO cases where it
becomes str.split(";").
> like, these are easier to read than in the order available in
> racket:
>
> (string-split "," "6,5,1,12,13,8,15,9,3,7,4,2,14,10,11")
> (sort < '(6 5 1 12 13 8 15 9 3 7 4 2 14 10 11))
> (string-join "," '(6 5 1 12 13 8 15 9 3 7 4 2 14 10 11))
That's sometimes true, but changing these things is a huge hassle.
(And it's not clear that one order is better than the other.)
Note that `regexp-split' does take the regexp first -- it's more
fitting there since "regexp" is the obvious part of the name where
here we have "string" instead.
> they also seem more sensible, because the more interesting argument
> for such functions is not what is to be operated upon, but the
> operator itself. Coupled with currying, it'd be heaven... :)
Yeah, currying is certainly cute, but it would make for a very
different language. (As a sidenote, one aspect of currying cuteness
is that decisions on argument order can in many cases (like the above)
have an obvious choice. Not in all cases though, otherwise haskell
wouldn't have a `flip'.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!