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?


Ian Bicking <ianb@colorstudy.com> writes:

> > >   function my_map(func, l) {
> > >     var new_l=make_list(10), i;
> > >     for (i=0; i<length(l); i++) {
> > >       new_l[i]=func(l[i]);
> > >     }
> > >     return new_l;
> > >   }
> > > 
> > > car and cdr are not very C-style.
> > 
> > But should we encourage this style?  I don't think so.
> 
> 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.

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