<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I like this idea a lot. If you start from racket/base, you can then 'graduate' to a saner Racket gradually. -- Matthias</div><div><br></div><div><br></div><div><br></div><br><div><div>On Mar 10, 2013, at 7:07 AM, Laurent wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div><div><div><div>Just a side question:<br></div>Would it be a bad idea to make a separate library that uses the normal names without f, so that people can write<br></div>#lang racket<br></div>(require racket/flist)<br>
<br>?<br></div>or even use `prefix-in' if they prefer?<br><br></div>Laurent<br><div><div><br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 9, 2013 at 4:28 PM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org" target="_blank">eli@barzilay.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Two days ago, Asumu Takikawa wrote:<br>
> We were considering the following set of names:<br>
><br>
> takef, dropf, takef-right, dropf-right, splitf, splitf-right<br>
<br>
I did most of this, and there are three important comments:<br>
<br>
1. Name: `splitf' is not right, since it's missing the "-at". I<br>
eventually went with `splitf-at' (since adding the `f' at the end<br>
makes it unreadable).<br>
<br>
2. Argument order: I think that it is important to be able to switch<br>
from (for example) `take' to `takef' and the index by a predicate.<br>
For this analogy to work, the order of arguments needs to be the<br>
same for both. Given that `take' etc already exist, it's the new<br>
functions that need to change. This is unfortunate:<br>
0. It goes against `take' in Haskell and in lazy (not new).<br>
1. Clojure joins that other party.<br>
2. It also goes against `member' and `find' where the list is the<br>
second argument, so the "f" similarity between `findf' and<br>
`takef' can be confusing.<br>
Personally, I think that this has been a PITA for such a long time<br>
and I'd prefer seeing `take' etc change to join the winning party.<br>
I think that srfi-1 made a mistake, not just that it chose the path<br>
that ended up being unpopular, because it made an inconsistent<br>
choice with other functionality that it provides.<br>
<br>
Regardless of this, if it's uniform interface vs good order, I<br>
prefer going with the uniform interface and the existing bad<br>
order. So I think that I should switch the order, protest myself<br>
silently, and continue.<br>
<br>
3. `takef-right' etc. I started implementing these, but maybe they<br>
shouldn't. The following explanation is probably only for people<br>
who are interested in what gets added (ie, Asumu), or maybe if you<br>
like a dead-end puzzle. For the others, it's probably enough to<br>
note that there are no such things in drfi-1/clojure/etc that I<br>
see.<br>
<br>
Here's why I think it might be useless:<br>
<br>
For just `takef-right', it's possible to do something smart that<br>
scans the list in order, keeping a pointer to the beginning of the<br>
"current good block". This avoids a double scan *but* the payment<br>
is in applying the predicate on all emlements. There might be a<br>
point in that in some cases, but probably in most cases it's best<br>
to apply it in reverse order, get the index, then do the usual<br>
thing.<br>
<br>
That's mildly useful in a completely unexciting way, but when it<br>
gets to the other *f-right functions, it gets worse in that the<br>
first approach won't work.<br>
<br>
So for all of these, the best that I see is: reverse the list[*],<br>
look for the place where the predicate flips to #f, then use one of<br>
the non-f from-right functions to do the work. So they're all just<br>
a little bit better than a reverese + non-f + reverse combination.<br>
<br>
([*] Not a strict reverse, to make these functions work with<br>
improper lists -- which is in-line with other questionable srfi-1<br>
inheritance.)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
<a href="http://barzilay.org/" target="_blank">http://barzilay.org/</a> Maze is Life!<br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
</font></span></blockquote></div><br></div>
_________________________<br> Racket Developers list:<br> <a href="http://lists.racket-lang.org/dev">http://lists.racket-lang.org/dev</a><br></blockquote></div><br>
</body></html>