From: dale.cts.com!jhb@nosc.mil (John Bollenbacher)
Subject: re: [null arrays]
Date: 19 Nov 92 17:51:32 GMT [thread overview]
Message-ID: <Bxz5M0.AxC@dale.cts.com> (raw)
Thanks to all that responded to my initial mail on this thread. I have a
followup question. Is there a more straightforward way to code the function
(REMOVE) below, given the restriction on sliding in aggregate creation?
package TEST is
subtype T is NATURAL range 0 .. 10;
type ARR is array (T range <>) of BOOLEAN;
type A(N : T := 0) is record
DATA : ARR(1..N);
end record;
function REMOVE(ELEMENT : BOOLEAN;
FROM : A) return A;
end TEST;
package body TEST is
function REMOVE(ELEMENT : BOOLEAN;
FROM : A) return A is
RESULT : ARR(1..FROM.N-1);
begin
for I in FROM.DATA'RANGE loop
if FROM.DATA(I) = ELEMENT then
RESULT := FROM.DATA(1..I-1) & FROM.DATA(I+1..FROM.N);
return (FROM.N - 1, RESULT);
end if;
end loop;
return FROM;
end REMOVE;
end TEST;
--
-----------------------------------------------------------------------------
- John Bollenbacher jhb@dale.cts.com -
- Titan Linkabit Corp. (619) 552-9963 -
- 3033 Sience Park Rd. -
- San Diego, Ca. 92121 -
-----------------------------------------------------------------------------
next reply other threads:[~1992-11-19 17:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-11-19 17:51 John Bollenbacher [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-11-20 20:49 [null arrays] Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox