This is the mail archive of the guile@sourceware.cygnus.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: why undefined return values?


On Thu, 20 Jan 2000, PILCH Hartmut wrote:

> Having read r4rs and scsh-manual.ps and started to write scheme programs,
> I am desperately looking for something like (setq a 1) that will return
> the value.  (set! a 1) is quite useless in most programming contexts that
> I am used to think in, coming from (Common and Emacs) Lisp.
> 
> I can't see any design advantage in providing unspecified return values
> and I expected to find a heated debate on this in some FAQ, but I didn't.
> Scheme is said to be functional, but it looks rather procedureal, often
> returning undefined or useless values, like C.
> 
> Should I go back to Lisp and not bother with Scheme any longer, or could
> there possibly be some good reasoning behind this? 

Only non-functional functions like set! have undefined return
values.  Thus, if you are using set! you are already programming in a
non-functional style.  I assume that the reason for the decision to have
undefined return values is that you are not encouraged to use these
functions frequently.  It can even be seen as an advantage that the
imperative nature of these commands is not hidden (like it would be if
for example (+ (set! x 2) 1) would be allowed) but made explicit to the
programmer.

If you are really desperate about setq, you can define a macro for it.

Best regards
Dirk Herrmann


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