comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Re: "<" operator
Date: 1997/10/09
Date: 1997-10-09T00:00:00+00:00	[thread overview]
Message-ID: <343CE494.928C2F84@elca-matrix.ch> (raw)
In-Reply-To: mheaney-ya023680000710971821260001@news.ni.net


Assuming the guy wants lexicographic order (and wants the function to work
with lists of different lengths), I think this should be corrected as follows:

> function "<"
>   (L, R : Character_List) return Boolean is
> begin
>    if L = null then
>       if R = null then
>          return True;

should be  return False;   -- because you probably want ("" < "") = False

>       else
>          raise <lists are not same length error>;

should be  return True;    -- because "" < anything

>       end if;
> 
>    elsif R = null then
>       raise <lists are not same length error>;

should be return False;   -- because anything > ""

>    else
>       return L.Item < R.Item and L.Next < R.Next;
> 
>    end if;
> end;\x01




  reply	other threads:[~1997-10-09  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-07  0:00 "<" operator dperez
1997-10-07  0:00 ` Matthew Heaney
1997-10-09  0:00   ` Mats Weber [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-12-09  0:00 + Operator FREBOURG Fabrice
1996-12-10  0:00 ` Paul Chardon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox