Re: Hints on recursion



matteo d'addio 81 wrote:
>Pascal Bourguignon ha scritto:
>>
>> For (twice 'e '(e . rest)) = (once 'e . rest)
>> and (once 'e '(e . rest)) = (none 'e . rest)
>
> Hi, I'm a CL beginner too.
>
>> (once 'e . rest)
> ^
> What this point stand for?

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)))

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))

See http://www.lispworks.com/documentation/HyperSpec/Body/02_da.htm

--
Geoff

.



Relevant Pages

  • Re: Hints on recursion
    ... Pascal Bourguignon ha scritto: ... I'm a CL beginner too. ... > Touch my tail, I shred your hand. ...
    (comp.lang.lisp)
  • Re: Another Lisp logo
    ... >> Pascal Bourguignon ha scritto: ... Here is a recursive tesselation ... >> I don't have any lisp implementations installed on my pc. ...
    (comp.lang.lisp)
  • Re: help needed: remote application
    ... Pascal Bourguignon ha scritto: ... > Do you really want to see the copyright warning? ... well, no, it doesn't matter really... ...
    (comp.unix.programmer)
  • Re: Another Lisp logo
    ... matteo d'addio 81 ha scritto: ... > David Steuber ha scritto: ... >> Can lambdas be made to do that? ...
    (comp.lang.lisp)
  • Re: help needed: remote application
    ... > Pascal Bourguignon ha scritto: ... >> Do you really want to see the copyright warning? ... > well, no, it doesn't matter really... ...
    (comp.unix.programmer)