[racket] Lazy take is the identity?

From: Jukka Tuominen (jukka.tuominen at finndesign.fi)
Date: Sun Jan 30 16:26:55 EST 2011

Hi,

a funny coincidence. I was just experimenting with ". args" a few days ago -
the number and order of arguments, that is. I tried it on "filter" since I
always seem to forget the order of arguments.

(define (my-filter . args);; ignores the order of arguments
 (filter (car (filter procedure? args)) (car (filter list? args))))

(my-filter number? '( 1 a 2 b))   >> (1 2)
(my-filter '( 1 a 2 b)  number?)  >> (1 2)

I'm not seriously suggesting to use this hack, just a funny coincidence...

br, jukka


> -----Original Message-----
> From: users-bounces at racket-lang.org
> [mailto:users-bounces at racket-lang.org]On Behalf Of Eli Barzilay
> Sent: 30 January 2011 22:15
> To: Mark Engelberg
> Cc: users at lists.racket-lang.org; John Clements
> Subject: Re: [racket] Lazy take is the identity?
>
>
> On Wednesday, Mark Engelberg wrote:
> > P.S. I was surprised to see that list-ref in #lang lazy takes
> the args in
> > opposite order than in #lang racket (which takes the list first).
>
> You were probably referring to `take' here -- that's a known issue.
> The lazy version follows Haskell, and was there before `take' was
> added to the main language.  I don't have any idea for fixing this
> nicely now.
>
> --
>           ((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/users



Posted on the users mailing list.