This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: C-like identity?
- To: Ian Bicking <ianb at colorstudy dot com>
- Subject: Re: C-like identity?
- From: Marius Vollmer <mvo at zagadka dot ping dot de>
- Date: 01 Aug 2000 20:10:53 +0200
- Cc: guile at sourceware dot cygnus dot com
- References: <20000730123732.C401@lothlorien> <871z0b8fkv.fsf@zagadka.ping.de> <20000730211343.A425@localhost> <8766pm3wo4.fsf@zagadka.ping.de> <20000731184705.A327@localhost>
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.