Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
February 18, 2002 Rectangular Arrays, setting | ||||
---|---|---|---|---|
| ||||
With one-dimensional arrays, you use a trailing [] to indicate that you want to assign by value (i.e. copy from the original array), while you leave it off to copy by reference (i.e. point the new array into the old one). How do you do this by with rectangular arrays? With a 2-dimensional array, I could see 3 possible things that the programmer might desire: * point the new array directly into the old * Don't copy the data elements, but make new array elements in the new array that point into the old data * Copy the data. Which is the correct syntax for each? (And let's put this into the Specification, unless it's already there and I've just missed it.) -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
February 18, 2002 Re: Rectangular Arrays, setting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3C711C80.C96995E7@deming-os.org... > With one-dimensional arrays, you use a trailing [] to indicate that you want to assign by value (i.e. copy from the original array), while you leave it off to copy by reference (i.e. point the new array into the old one). How do you do this by with rectangular arrays? With a 2-dimensional array, I could see 3 possible things that the programmer might desire: > > * point the new array directly into the old This is as simple as a = b; > * Don't copy the data elements, but make new array elements in the new array that point into the old data > > * Copy the data. Don't forget that there's no such thing as rectangular dynamic array. Either you have a dynamic array of arrays - in which case the []= op would copy the subarrays (that is, pointers), or you have a static rectangular array, and []= should copy its contents: int[2][3] foo, bar; foo[] = bar[]; // copy the entire rectangular array int[][] foo, bar; foo[] = bar[]; // copy all int[] elements from foo to bat |
February 18, 2002 Re: Rectangular Arrays, setting | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Pavel Minayev wrote: > > * Copy the data. > > Don't forget that there's no such thing as rectangular dynamic array. Either you have a dynamic array of arrays - in which case the []= op would copy the subarrays (that is, pointers), or you have a static rectangular array, and []= should copy its contents: > > int[2][3] foo, bar; > foo[] = bar[]; // copy the entire rectangular array > > int[][] foo, bar; > foo[] = bar[]; // copy all int[] elements from foo to bat It will take me a bit to get my mind around this...dynamic arrays are really cool...but still a new paradigm for me. I'll write back if I have any more ponders. -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
February 19, 2002 [OT] Develop English Version? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | <SNIP> > > -- > The Villagers are Online! villagersonline.com > > .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] > .[ (a version.of(English).(precise.more)) is(possible) ] > ?[ you want.to(help(develop(it))) ] > > Sorry for going totally offtopic here, but what does the above text mean? :) I have been wondering about your signature since I first saw it Russ, I also visited villagersonline.com but I didn't see anything to explain it...This is killing me! :) Also, the picture of the man with the glasses on the Hosea page, http://villagersonline.com/hoseaProject/ is that you? Regards, -- Stijn OddesE_XYZ@hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail |
February 19, 2002 Re: [OT] Develop English Version? | ||||
---|---|---|---|---|
| ||||
Posted in reply to OddesE | OddesE wrote: > > .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] > > .[ (a version.of(English).(precise.more)) is(possible) ] > > ?[ you want.to(help(develop(it))) ] > > Sorry for going totally offtopic here, but what does the above text mean? :) I've had this sig (or things like it) for probably something like 2 years and this is the first time anybody's asked me about those 3 lines. www.villagersonline.com is the website for my church - I'm the webslave there. The other three lines are totally unrelated (to the church). It's my attempt at a C-style way of writing English. Essentially, each expression (marked of with square brackets) is comprised of at least a subject and verb section. Modifiers to clauses, phrases, or words follow it with .'s to mark them off, like properties or member functions. Thus, the three lines are the translation of: The quick brown fox jumped over the lazy dog. A more precise version of English is possible. Do you want to help develop it? > I have been wondering about your signature since I > first saw it Russ, I also visited villagersonline.com but > I didn't see anything to explain it...This is killing me! :) > Also, the picture of the man with the glasses on the > Hosea page, http://villagersonline.com/hoseaProject/ > is that you? LOL! No, that's Rod (about 30 years my senior). I'm the guy on the bottom left at http://villagersonline.com/sermons (webmaster@villagersonline.com) -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
Copyright © 1999-2021 by the D Language Foundation