Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Eiffel > Re: Behaviour o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 840 of 917
Post > Topic >>

Re: Behaviour of ARRAY.subarray

by Georg Bauhaus <bauhaus@[EMAIL PROTECTED] > Dec 27, 2006 at 12:51 PM

On Fri, 2006-12-22 at 19:49 -0800, Colin LeMahieu wrote:
>   I'm trying to take a larger array, a(1,
> 12) and break it up in to smaller pieces b(1, 4) c(5, 8) d(9, 12) and
> send these pieces to other features for them to fill in.

A poor man's solution might involve a fake array using the triple
(reference to the original array, dope lower, dope upper).
The reference part could be passed once for an object or
as an additional routine parameter. This would be simulating
the possibility of having local routines a la

  feature do_something(a: ARRAY[NATURAL_8]) is
	local -- not Eiffel
	  feature compute_part(l: INTEGER; r: INTEGER) is
	    local loop_index
	    do
               from loop_index := l until loop_index > r loop
		 use(a @[EMAIL PROTECTED]
 loop_index)
               end
	    end
        do
           compute_part(a.lower, mid_point)
           compute_part(mid_point + 1, a.upper)
        end

> -Pass a.subarray(1, 4) to a feature, have it return an array, and then
> copy the results back in with a.subcopy
> -Inherit from ARRAY and define my own "jointarray" feature such that
> the array returned points to a subregion of the memory of the original
> array.




 3 Posts in Topic:
Behaviour of ARRAY.subarray
"Colin LeMahieu"  2006-12-22 19:49:06 
Re: Behaviour of ARRAY.subarray
Georg Bauhaus <bauhaus  2006-12-27 12:51:13 
Re: Behaviour of ARRAY.subarray
Georg Bauhaus <bauhaus  2006-12-30 15:53:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 7:02:35 CDT 2008.