Return-Path: <kfoury@cs.bu.edu> Received: from cs.bu.edu (cs [128.197.12.2]) by cs3.bu.edu (8.12.11/8.12.11) with ESMTP id i8NIde54010139; Thu, 23 Sep 2004 14:39:40 -0400 Received: from cs.bu.edu (kfoury@fiddle [128.197.10.114]) (authenticated bits=0) by cs.bu.edu (8.12.2/8.12.2) with ESMTP id i8NIdePM006857; Thu, 23 Sep 2004 14:39:40 -0400 (EDT) Sender: kfoury@cs.bu.edu Message-ID: <41531869.C0979017@cs.bu.edu> Date: Thu, 23 Sep 2004 14:39:37 -0400 From: "Assaf J. Kfoury" <kfoury@cs.bu.edu> Organization: Boston University X-Mailer: Mozilla 4.78 [en] (X11; U; SunOS 5.8 sun4u) X-Accept-Language: en To: ashwin thangali <tvashwin@cs.bu.edu>, cs520@cs.bu.edu Subject: Re: question regarding head and tail of empty list References: <Pine.SOL.4.20.0409231409390.13319-100000@csa.bu.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-HitLevel: X-Spam-DCC: sonic.net: cs3.bu.edu 1156; Body=10 Fuz1=10 Fuz2=10 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on cs3.bu.edu X-Spam-Level: X-Spam-Status: No, hits=0.0 required=10.0 tests=none autolearn=ham version=2.64 X-Spam-Pyzor: Reported 0 times. Status: X-Mozilla-Status: 8011 X-Mozilla-Status2: 00000000 X-UIDL: 411f69ec00000b79
ashwin thangali wrote:
> my question was with respect to exercise 5.2.8 which asks for an
> implementation of head and tail in lamda calculus. so it ok if we dont
> handle empty lists?
I am not sure what you mean by "it is ok if we
don't handle empty lists". Applying "head" or
"tail" to an empty list can occur during an evaluation,
just as applying "succ" to "true" can occur. In both
cases the evaluation should lead to a "stuck" term,
i.e., a run-time error.
Assaf
>
>
> Ashwin V. Thangali
> 111 Cummington Street,MCS 263,
> Computer Science Dept,
> Boston University,
> Boston, MA 02215
> Office: 617 358 1139
> Home: 617 734 6209
> Homepage: http://cs-people.bu.edu/tvashwin
>
> On Thu, 23 Sep 2004, Assaf J. Kfoury wrote:
>
> > Here is a list of 6 integers in the style of programming
> > language Scheme:
> >
> > (4 5 1 2 30 40)
> >
> > Call it L. Then head(L) = 4 which is an integer, and
> > tail(L) = (5 1 2 30 40) which is a list of integers.
> >
> > A special case is the empty list ( ). Call it nil. It is a
> > design decision what to do with head(nil) and tail(nil).
> > The most common is to make head(nil) and tail(nil)
> > cause a run-time error.
> >
> > I hope this helps.
> >
> > Assaf
> >
> > ashwin thangali wrote:
> >
> > > asaf,
> > >
> > > is the result of head (or tail) of a list an element or a list? if its
> > > an element, what does head or tail return for an empty list?
> > >
> > > ashwin
> > >
> > > Ashwin V. Thangali
> > > 111 Cummington Street,MCS 263,
> > > Computer Science Dept,
> > > Boston University,
> > > Boston, MA 02215
> > > Office: 617 358 1139
> > > Home: 617 734 6209
> > > Homepage: http://cs-people.bu.edu/tvashwin
> >
This archive was generated by hypermail 2b29 : Fri Nov 19 2004 - 17:00:43 EST