From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Sat, 14 Aug 2010 12:17:33 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <87aap6wcdx.fsf@ludovic-brenta.org> <87vd7jliyi.fsf@ludovic-brenta.org> <699464f5-7f04-4ced-bc09-6ffc42c5322a@w30g2000yqw.googlegroups.com> <87k4nylb8c.fsf@ludovic-brenta.org> <4c617774$0$6765$9b4e6d93@newsspool3.arcor-online.net> <2610d347-27cf-4c88-ac18-84f73c7da858@h32g2000yqm.googlegroups.com> <878w4blhzj.fsf@ludovic-brenta.org> <85fc256b-bb92-43f5-9de7-5148f5b23622@k10g2000yqa.googlegroups.com> <87vd7fk1ar.fsf@ludovic-brenta.org> <518d22c5-2a6e-49b3-8022-b82f4402f216@m1g2000yqo.googlegroups.com> <8f73cb40-3988-4039-9ffa-822d703f4a1d@v8g2000yqe.googlegroups.com> <8739uhjvoi.fsf@ludovic-brenta.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Sat, 14 Aug 2010 12:17:33 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="Mda950WjNwNLAFOE7yJXQw"; logging-data="28612"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sKY2U0LrNMfZeOKwho/0d" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:Z7LMrKPG/B71dmQO0zrIjYLL+uU= Xref: g2news1.google.com comp.lang.ada:13280 Date: 2010-08-14T12:17:33+00:00 List-Id: On 2010-08-14, Ludovic Brenta wrote: > OK, but these two are equivalent if you remember the axiom that (y > . nil) is really just y. Ok, that's the part I have trouble with. When thinking in list terms, that cons feels like it's the operation of prepending an item to an existing list, right? Here is my understanding, please correct me where I'm wrong. Oh, I'm going to have to type that. Let's assume we have a Node type, which can be either a List or an Atom (little Ada question as an aside, Node would then be a parametrized type, and the two cases would be called Node(List) and Node(Atom), right? or have I misunderstood something?). The cons operation would then take a Node as its first parameter (before the dot) and a List as its second, and return a List which is semantically the input list prepended by the first parameter taken as a list item. Right? So nil is of type List and represents the empty list. Then (y . nil) is a List containing a single node, which is the Atom y. So I feel that y is of type Atom while (y . nil) is of type List. (Then (x . (y .nil)) is the previous list with x prepended, therefore the two-item list containing x then y. And then (z . (x . (y . nil))) would be a three-item list. But then what of ((x . (y. nil)) . (z . nil))? It looks to me like a two-item list whose first item is a list, followed by the atom z. But then how would reverse list be written? Maybe (z . ((x . (y . nil)) . nil))? But that doesn't fit with your derivation pattern on tcp-connect, so I'm lost.) Now I can understand that in an untyped environment, an Atom can be automagically cast into a single-item list. In such a case, (x . y) is first translated into (x . LY) where LY is the List containing the Atom y a its only item (i.e. (y . nil)). And now that cons is correctly typed like (Node . List), it ends up with the two-item List containing the Atom x followed by the Atom y. But then how would you make a list ending with LY? My guess would be (x . (LY . nil)), but then it is not equivalent to (x . LY), so I'm lost again. Or are single-item lists prohibited in lisp? Thanks for your patience, Natacha