guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new proc for string-fun.scm: `mapconcat'


From: Dirk Herrmann
Subject: Re: new proc for string-fun.scm: `mapconcat'
Date: Mon, 12 Feb 2001 02:14:52 +0100 (MET)

On Sat, 10 Feb 2001, thi wrote:

> here, i've renamed it to `string-append/separator' and chosen to use a
> single arg instead of a "rest" arg w/ the rationale that if i'm willing
> to pass individual strings to `string-append/separator', it would be
> just as easy to enumerate the separator.  also, having to use `apply' in
> the more common case is wrong, IMHO.  here is the new `mapconcat'...

Your definition of string-append/separator is definitely a better
solution.

> this still provides all-in-one generality for programmers who like to
> just throw args at procs and get the right result... (and who prefer
> abstraction to performance).

While I agree in general, I'd like to mention that it is not only a matter
of performance, but also a matter of type safety.  A function that
'naturally' would accept only string arguments, but is implemented to also
accept anything else and just coerce it into a string will not be a great
help when it comes to finding bugs in the code.  Thus, personally, I
prefer functions that only accept a minimum set of types for the different
parameters.  The 'type-casting' then has to be done at the caller's side.  
However, I don't know if this approach can be proven to be advantageous in
practice - it may just be a matter of taste.

Best regards,
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]