[racket] Little Schemer, lat?

From: Matthew Butterick (mb at mbtype.com)
Date: Sat Jan 3 15:26:41 EST 2015

> The empty list is also a list of cheeses.

Further down that road, I was a tiny bit surprised recently to discover
that `andmap` returns true for any predicate when the input list is empty
[1], but then I saw how it's a natural consequence of this principle. Empty
is a member of every list, thus empty can never test false.


[1]
http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._andmap%29%29




On Sat, Jan 3, 2015 at 11:34 AM, Jens Axel Søgaard <jensaxel at soegaard.net>
wrote:

> 2015-01-02 23:58 GMT+01:00 Frank Weytjens <fweytjens.android at gmail.com>:
> > Happy new year Racketeers,
>
> > An empty list is a list, but is it a lat ?
>
> > If you give an empty list as argument to the lat?-function, the answer is
> > yes. But an atom must be a string of characters or numbers, or even one
> > character, or a combination of special characters as long as it is not
> an (
> > or an ). The empty list contains no characters at all, so it can not be a
> > list of atoms.
>
> > Then an empty list can be anything.
>
> To some degree it is a matter of convention. This illustrates the
> usual convention:
>
> Is this is a list of (person) names?
>      Alice, Bob, Charlie
> Yes, all items on the list are names.
>
> Is this a list of names?
>      Alice, Bob, Cat
> No, since Cat is not a name.
>
> Is this (the empty list) a list of names?
>      <nothing>
> Yes, there are no non-names on the list.
> In other words all items on the list are names, which makes it a list of
> names.
>
> The empty list is also a list of cheeses.
>
>
> --
> Jens Axel Søgaard
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150103/522ff993/attachment-0001.html>

Posted on the users mailing list.