This is the mail archive of the guile@sources.redhat.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: C-like identity?


On Tue, Aug 01, 2000 at 08:10:53PM +0200, Marius Vollmer wrote:
> > The point of a C syntax is not as a stealth tactic to create more
> > functional programmers.  So I don't think we should encourage or
> > discourage style unless there is a particularly compelling reason
> > -- like security.  In this case, sure, it's not great code.  But
> > it will work, and it will make sense to a C programmer.
> 
> But they should be using vectors, not lists, when writing such code.
> People will expect C like semantics, which includes run-time
> complexity. This code is O(n^2) when a C programmer expects it to be
> O(n).  We should make it easy to use vectors, because C programmers
> are used to them, but we should not try to make it easy to use lists
> as a substitute implementation for vectors, because lists are bad at
> pretending to be vectors.

For whatever reason, vectors are almost never used in Scheme.  Most
procedures call for lists.  So it's not a good option at all for C
programmers to be put in unfamiliar waters when they have to deal with
lists.

So it's O(n^2).  What does it matter?  car and cdr are still going to
be available, and if they care about performance they can use those.
If they don't care about performance -- and I think they won't most of
the time -- they can use the familiar list-ref/list-set! equivalents.
Since most of the time lists are small, big-O is completely
meaningless to performance anyway.

I would expect CTAX to be used by people who are extending some
program, not for making lots of high-use procedures that are likely to
cause slowdowns.  And if they are making those things and they care
about speed, they can do the small investigation to see that accessing
lists is most speedily done with car and cdr.

  -- Ian

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