Re: Hints on recursion
- From: "matteo d'addio 81" <m_a_t_e_81@xxxxxxxx>
- Date: 29 Nov 2005 13:02:11 -0800
Geoffrey Summerhayes ha scritto:
> Prolog [Head | Tail], [A, B | Tail]
> Lisp (car . cdr), (first second . rest)
>
> A list, e.g. '(1 2 3), is essentially shorthand for the dotted
> equivalent,
> in this case: '(1 . (2 . (3 . nil)))
>
Yes, I knew this, but...
> So if we substitute a list, for example '(g h i), for rest into
> Pascal's
>
> (twice 'e '(e . rest)) = (once 'e . rest)
>
> we get
>
> (twice 'e '(e g h i)) = (once 'e '(g h i))
in my opinion if you substitute '(g h i) to rest you'll get:
(twice 'e '(e quote (g h i))) = (once 'e quote (g h i))
or:
(twice 'e '(e g h i)) = (once 'e g h i)
Am I wrong?
I first thought to a shorthand to apply:
(let ((rest-list '(1 2 3)))
(apply #'+ rest-list)
or simply:
(+ . rest-list))
but in Scheme it doesn't work.
I don't know if in CL it works or not, so I asked what that point
was...
matteo
>
> See http://www.lispworks.com/documentation/HyperSpec/Body/02_da.htm
>
> --
> Geoff
.
- Follow-Ups:
- Re: Hints on recursion
- From: Pascal Bourguignon
- Re: Hints on recursion
- References:
- Hints on recursion
- From: zion_zii
- Re: Hints on recursion
- From: Pascal Bourguignon
- Re: Hints on recursion
- From: matteo d'addio 81
- Re: Hints on recursion
- From: Geoffrey Summerhayes
- Hints on recursion
- Prev by Date: Re: FORMAT ~<...~:@> PUZZLE
- Next by Date: Re: sanity check (coding style)
- Previous by thread: Re: Hints on recursion
- Next by thread: Re: Hints on recursion
- Index(es):
Relevant Pages
|