Thread View: net.lang.mod2
3 messages
3 total messages
Started by David Cook
Mon, 13 Oct 1986 04:30
Open Array Parameters and matrices
Author: David Cook
Date: Mon, 13 Oct 1986 04:30
Date: Mon, 13 Oct 1986 04:30
9 lines
1041 bytes
1041 bytes
Has anyone figured out a way to get around the fact that open parameters will only work for 1-D arrays and not for matrices. I am beginining to realize that mod2 is not a good language for linear algebraic applications despite its wealth of structures and simplicity, but hoping someone can change my mind. Maybe my problem is that things have to be elegant; I can't stand being forced to use FORTRAN type solutions in mod2! ............................................Thanx, Dave Cook.
Re: Open Array Parameters and matrices
Author: Comfy chair
Date: Mon, 13 Oct 1986 18:16
Date: Mon, 13 Oct 1986 18:16
17 lines
1182 bytes
1182 bytes
I believe DEC's Modula-2 compiler has an extension to allow open matrices and higher order arrays. You could bypass the type checking by passing the address of the array. You'd still have to do your own indexing. This means passing the dimensions as well. Messy. Perhaps a neater way is to pass a descriptor (a record containing the address of the array, and the dimensions). I still don't see a way around either the inefficiency of an indexing function, or the verbosity of writing your own index computations. Note that C (until C++) has the same problems. Anybody have better ideas? Ken
Re: Open Array Parameters and matrices
Author: Joel McCormack
Date: Wed, 29 Oct 1986 01:57
Date: Wed, 29 Oct 1986 01:57
16 lines
1354 bytes
1354 bytes
The current Modula-2 compiler at DEC allows you to declare things like ARRAY
OF ARRAY OF REAL, and the HIGH function takes an optional parameter for the
dimension number. (Other extensions use HIGH(array) for the first dimension,
HIGH(array[0]) for the 2nd, etc.)
I would rather have something along the lines of Pascal's conformant arrays,
but ARRAY OF set a nasty precedent. (Several years ago I asked Niklaus Wirth
what he planned to do about making Modula-2 suitable for implementing math
libraries; he said he really didn't care about that kind of programming.)
Standard Modula-2 supports only one-dimensional open arrays, and I don't know
what the ISO group is contemplating.
- Joel McCormack {ihnp4 decvax ucbvax allegra}!decwrl!joel
joel@decwrl.dec.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads