This is the mail archive of the guile@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] |
> Getting back to the implicit binding question, how about this example: > > C: scheme > ----------------------------- ------------------------ > a = a == NULL ? original_a; (let ((a (or a original-a))) > code_using_a; code-using-a) Your C code is not legal, ? must have a matching : (someone had to say it). > What makes the scheme bindings 'implicit', especially in comparison > with the C example? As others have already mentioned, a good editor > will automatically indent the let form so you can tell the extent of > 'a's binding. Well, a lot of C coders (and BASIC coders) would see you as using let to assign `a' back to itself so they would expect the new value to be in `a' forever after. They will be confused when the old value of `a' pops back up somewhere later. That is because the natural human assumption is that `a' only exists in the one place. I try to avoid overlaying variables with other variables of the same name as much as possible (though inevitably it happens). This is a classic case of the seasoned scheme programmer generating code that is obvious only to a seasoned scheme programmer. Naturally, seasoned programmers of all sorts forget about the time when they were beginners, no language should try to prevent this, it is a property of people. > > Assuming that isn't really an option given the goal of easy > > importing of existing scheme code, the only alternative is really > > good examples that don't leave out any details, as if you were > > explaining the very idea of a variable to someone who had never > > written a single line of code before. > > Yes, I whole heartedly agree that guile needs to provide a series of > examples for those new to scheme, that has lots of nice examples. I'm in favour of learning from example, it's fast, universal and good for cutting and pasting. I notice that http://www.cs.indiana.edu/scheme-repository/code.html Has no section for beginner's example code. Nor does, ftp://ftp.red-bean.com/pub/guile/contrib (Note to Jim, the main Guile homepage should probably link to the above contrib directory, it might make visitors feel that guile development work was broad based) Probably most beginners don't show off their code and most experienced coders don't pause to write tutorials. If people want to email me stuff, I don't mind starting a collection (I have a bit of space kicking around), I might even index it :-) Maybe there aren't enough beginner examples lying around to worry about ... - Tel