This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bracket heresies. What about subscripting?



Very nice!  I must say that vector-ref (and its CL brothers like svref
etc. etc.) is a big turn-off for me.  I'd much rather use [] or the GOOPS
solution outlined below.  OTOH the GOOPS way is less explicit in that it
doesn't make it obvious that a subscript is taking place, but OTOOH you can
have an arbitrary number of subscript indices.

Another nit I've often had with lisp-like languages is the fact that long
algebraic expressions often look really clumsy in prefix form (especially
with non-commutative operators like -, <, >, etc.); this is probably just
because I haven't used scheme enough to get used to it.  It would be cool
to have a read-macro that translated infix to prefix e.g.

    #{ a**2 + b**4 / c[i] }  ;; e.g.

becomes:

	(/ (+ (pow a 2) (pow b 4))
	   (vector-ref c i))

This would probably ease the transition to scheme for a lot of people.

Mike



> Mailing-List: contact guile-help@sourceware.cygnus.com; run by ezmlm
> Precedence: bulk
> Sender: guile-owner@sourceware.cygnus.com
> Cc: guile@cygnus.com
> Content-Type: text/plain; charset=US-ASCII
> From: Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se>
> Date: 01 Jul 1999 16:10:39 +0200
> 
> Chris Bitmead <chris@tech.com.au> writes:
> 
> > > (vector-ref v n) is a very clumsy way of getting element n in a 
> > > vector v; I am still enough of C/Pascal/Basic person at heart 
> > > to have to stop myself from saying v[n].
> > 
> > If you were writing nice functional code I don't think you'd be using
> > vectors as a data structure very much. Better make that two icy cold
> > showers and a full weekend of SICP :-).
> 
> Anders Sandberg and I have written a small example matrix library in
> Goops.
> 
> There we write
> 
>   (m i j) ; reference element i,j in m.
> 
>   (* m m) ; multiply m by itself
> 
>   (set! (m i j) 17)		 ; assign 17 to element i,j in m
>   (set! (a (.. 1 m) (.. 1 n)) b) ; set the m x n block in upper left
>                                  ; corner of a to b
> 
> This is possible since objects of Goops also can be operators.
> 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]