[plt-scheme] Something like $_ in Perl

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sat Mar 1 08:45:57 EST 2003

Eduardo Cavazos wrote:

> In these situations, I admire and miss the $_ variable in Perl. It
> would be nice if the value of <test> in a cond were bound to some
> variable in the <expression> portion, such as $_ for example.

Have you noticed =>  ?

As in

  (cond ((assv 'b '((a 1) (b 2))) => cadr)
        (else #f))

which evaluates to 2.

Se section 4.2.1 in R5RS:


Jens Axel Søgaard

Posted on the users mailing list.