[racket-dev] Fancy application/automatic anonymous functions
On Tue, May 17, 2011 at 3:14 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>
wrote:
> Lots of people have written similar things (`cut' in SRFI 26, Jay's
> `super-cut', etc), but I'd like to move towards using it implicitly.
I use (require (rename-in srfi/26 [cut //])) and that's simple enough for
me. I find the implicit version harder to read. You have to read further to
the right before realizing you are inside a function, and it is easy to
miss.
Here are two example from my code of how it looks.
(define common-confusions
(count-instances
(filter-not all-the-same?
(map (// sort <> <)
(map (// take <> 2) summary)))))
(define (non-whitespace-diff? . strings)
(define collapsed (map (// regexp-replace* #px"[[:space:]]{2,}" <> " ")
strings))
(not (andmap (// equal? (first collapsed) <>) (rest collapsed))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110605/af4acb4e/attachment.html>