This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Bracket heresies. What about subscripting?
> > This is terrible, disgusting chaos, a horrible perversion of the
> > Scheme way
>
> Well, thank you for your being straight to the point. :)
Actually, I was joking. That's why I went on to indicate another
possible application --- it wasn't sarcasm. I don't think it's so
horrible. Sorry I wasn't clearer.
> But what is the chaos part? (m i j), the setter style, or objects
> being operators in general?
The latter.
> Below I'm going to argue a little for this style, but first I want to
> stress that this syntax was chosen mainly to get a user interface
> which could compete with Matlab in easy of use. I'm not saying that
> this is how subscripting should work in general in Scheme. It's just
> that when you work with numerical algorithms the code becomes so
> obscure if formulas consists of things like
> (* (vector-ref (vector-ref A i) j) (vector-ref (vector-ref B j) k)).
I've noticed this, too. String handling is a mess, too. What can we
do to improve this, without jeopardizing our opportunities for future
optimization?
> You must agree that it is natural to regard a matrix as an operator.
> (This is how matrices are regarded in linear algebra.)
>
> (M V1) --> V2 (where V1 and V2 are vectors)
>
> Right?
Yes.
> > Now, wouldn't it be cool if applying a regexp to a string
> > returned a list of the substrings?
> >
> > ((make-regexp "(.*)/([^/]*)") "/usr/local/bin/gcc")
> > => ("/usr/local/bin" "gcc")
> >
> > (define (x-display-hostname display)
> > (car ((make-regexp "([^:]*):.*") display)))
>
> I guess the problem is that with objects being operators you could
> easily end up with unreadable code. Note that our application
> specific matrix syntax was intended to enhance readability of code
> (* (A i j) (B j k)).
I don't find the stringy syntax unreadable, though. The idea is that
a regexp is a function which breaks its argument into pieces. I
couldn't think of anything more natural for a regexp to do. I guess
you didn't like it. *sigh*