comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: "too few element" in an unconstrained array, given as litteral ?
Date: Sat, 20 Jan 2018 23:27:21 +0200
Date: 2018-01-20T23:27:21+02:00	[thread overview]
Message-ID: <fchqhpF9j8qU1@mid.individual.net> (raw)
In-Reply-To: <340b9df2-732e-4355-a85f-020e9f754a9b@googlegroups.com>

On 18-01-20 18:52 , Mehdi Saada wrote:
> We discussed it some weeks ago,
> but how do I write:
> Temp := (Poly_B.Degre + Ind - 1, (Poly_B.Degre + Ind - 1 => (1/1)), others => <>);

(There seems to be a typo in the above: the second ')' should be at the 
end.)

> Ind is the index of a for loop, hence there's a dynamic choice, hence ...
> No other choices possible. So the above is illegal.

Yes.

> I want the nicest expression, because the algo part was already hard

Assuming that Poly_B.Degre + Ind - 1 is the highest index ('Last) in the 
aggregate, you could concatenate two aggregates (the index used in the 
second, one-element concatenand is irrelevant, I chose 1 for brevity, 
see RM 4.5.3):

Temp := (
    Poly_B.Degre + Ind - 1,
    (0 .. Poly_B.Degre + Ind - 2 => <>) & (1 => (1/1)));

That assumes also that the first index is zero.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

  reply	other threads:[~2018-01-20 21:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20 10:55 "too few element" in an unconstrained array, given as litteral ? Mehdi Saada
2018-01-20 12:28 ` Niklas Holsti
2018-01-20 13:21   ` Mehdi Saada
2018-01-20 16:15     ` Niklas Holsti
2018-01-20 16:52       ` Mehdi Saada
2018-01-20 21:27         ` Niklas Holsti [this message]
2018-01-20 17:48 ` Why in (array) aggregate, no more component allowed after a dynamic choice ? Mehdi Saada
2018-01-23  0:57   ` Randy Brukardt
replies disabled

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