chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Re: Style Guide


From: Elf
Subject: Re: [Chicken-users] Re: Style Guide
Date: Tue, 6 Nov 2007 20:47:25 -0800 (PST)


i used to use the (define foo (lambda (x) ... ) form only.
mostly because mit-scheme calls that an unnamed-lambda and the other a named lambda.
recently, i switched to the (define (foo x) ...) form because:
a) less characters!
b) immediately obvious that its a functional definition!
c) everyone else does it!
d) why am i ending the sentences with exclamation points!

really, it doesnt matter. theres plenty of code with both, its entirely a personal preference issue.

-elf

On Mon, 5 Nov 2007, Mark Fredrickson wrote:

William Ramsay wrote:
Is there such a thing as a Chicken/Scheme style guide? [...] If there
is such a thing as teaching an old dog new tricks I'd like to try.

Your last sentence makes me think that you're referring to algorithm
design, not mere syntax style.  Things like learning to use closures and
continuations effectively, learning to express iterative processes with
recursive syntax, and so on.

There is certainly a idiomatic style of Scheme, but I think the actual
style as defined by the layout of the source code matters as well.
Those two documents were useful reads to some who frets over such
issues (me).

Here's a related question for more experienced Schemers: In Dybvig, he
states that the define form:

(define square (lambda (x) (* x x)))

is to be preferred to

(define (square x) (* x x))

After reading that, I started using the first form religiously. Now
I'm not so sure. For no small part because the text editor I use
(TextMate) doesn't highlight the first form as a function definition
but does highlight the second form.

Anyone have an opinion? I'm not looking for an opinion, but perhaps a
tip as to why one method might prove more useful as I release code or
maintain code that I've already written.

TIA,
-M


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users





reply via email to

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