Re: Hints on recursion




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

.



Relevant Pages

  • Re: Hints on recursion
    ... > Geoffrey Summerhayes ha scritto: ... >> So if we substitute a list, for example ', for rest into ... So, I tend to write the data literally, as the REPL would print them ... Other people prefer to write always evaluable expressions, ...
    (comp.lang.lisp)
  • Re: mapping a drive
    ... Steve Winograd ha scritto: ... You can substitute other drive letters, share names, and computer ... Could this work with a dynamic dns instead than computer name? ...
    (microsoft.public.windowsxp.network_web)
  • Re: Mickeys big admission
    ... > ever heard of ABX for audio. ... DBT's of other subjects are no substitute for ... Prev by Date: ...
    (rec.audio.opinion)
  • Re: Need Huntron HTR1005B-1S manual or App notes
    ... MasonDG44 at comcast dot net (Just substitute the appropriate characters in ... Never take a laxative and a sleeping pill at the same time!! ... Prev by Date: ...
    (sci.electronics.repair)
  • Re: WTF is wrong with OE?
    ... > who will no doubt be grateful for the opportunity to jump in and ... > substitute for you. ... links to Xnews resources: ... Prev by Date: ...
    (news.software.readers)