gengyangcai
10/8/2015 6:40:00 AM
This is the answer I got from Quora :
It defines a function, called enigma, which takes one parameter. It returns the result of an 'and' operation. The first argument to the 'and' is (not (null x)), meaning, if x is null, then the result of the 'and' (and the result of 'enigma') is false.
If x is not null, the second argument to 'and' is evaluated, and returned. This is an 'or' expression. The first argument to the 'or' is (null (car x)). If this is true (and the first argument to 'and' is true), the function returns true. Otherwise, the function returns the second argument to the 'or', that is, (enigma (cdr x)).
So: If x is null, the result is false; if x is not null, and (car x) is null, the result is true. If x is not null, and (car x) is not null, the result is (enigma (cdr x)).
On Thursday, October 8, 2015 at 3:51:36 AM UTC+8, WJ wrote:
> Helmut Eller wrote:
>
> > On Wed, Oct 07 2015, CAI GENGYANG wrote:
> >
> > > What's this ?
> > >
> > >
> > > (defun enigma (x)
> > > (and (not (null x))
> > > (or (null (car x))
> > > (enigma (cdr x)))))
> >
> > Bad taste? It returns T if the list X contains nil as an element. It
> > would be clearer to write (some #'null x).
>
> Gauche Scheme:
>
> gosh> (member '() '(a b c d))
> #f
> gosh> (member '() '(a b () c d))
> (() c d)
> gosh> (member #f '(a b c d))
> #f
> gosh> (member #f '(a b #f c d))
> (#f c d)
>
> --
> [Jesse Jackson] would spit into the food of white patrons he hated and then
> smilingly serve it to them. He did this, he said, "because it gave me
> psychological gratification." -- Life Magazine, 1969-11-29