Ed Watkeys on 24 Aug 2007 16:50:13 -0000 |
On Aug 23, 9:31 am, "Kyle R. Burton" <kyle.bur...@gmail.com> wrote: > That's what it the macro expands to. It is a very small thing, but it > gives a name to the pattern, where the let expression doesn't - I like > names :) That's an interesting statement (to paraphrase): "I like to give names to the patterns I use." It gets me wondering about the position some take (including me much of the time) that patterns are a way for covering up for a language's deficiencies. I don't walk into a house a see a sign that says "foyer" in the space with a coat rack and a staircase. Just thinking out loud... More food for thought: for(elem = list; elem != NULL; elem = elem->next) { /* do something */ } Should a clueful C programmer look at that and see an idiomatic C list iterator, or should she see an missing feature in the language? > > > In your example, you're not using the result of the APROG1 expression. > > The for each ... in-map uses it - it iterates over the key/value pairs > from the map. The 'in-map' is treated as a symbol (so is the 'each') > and discarded by the syntax-rules for the for expression. The > syntax-rules patterns use those literals in the pattern matches to > tell what I'm trying to iterate over. D'oh! I think my brain skipped over that, because it couldn't make sense of the non-standard Scheme. > > I really wished that I had anaphoric IF (AIF) where, log APROG1, you > > can do stuff like this, IIRC: > > > (aif (assoc people 'kyle) (cdr it) #f) > > > But then I realized the COND lets me do assentially the same thing: > > > (cond ((assoc people 'kyle) => > > (lambda (it) (cdr it))) > > (else > > #f)) > > I think I get the spirit of what you meant by that cond, but I don't > see it as equivalent to the earlier aif :) I'm not sure what you mean; is there some error in my translation? In the event that there isn't, here's what the first clause of that COND means: If the test evaluates to something that isn't false, call the lambda with that value. > > I do see that aif, awhen, aprog1 and others are very thin wrappers > around if/when/let - they only factor out a tiny little bit - but when > I see forms using those names I find it easier to know what is going > on - I can more immediately know what the code is doing - prog1 is an > expression/initializer and some side effects (but not on the > initialized thing), aprog1 is an initializer plus some side effects > where the side effects are applied to the thing to be returned. I > hold a different concept for let in my head when I see code that uses > it. I don't mean this in a dismissive way, but reading the above paragraph, I feel like we're from different planets. I hear the language of Java and Eclipse and Ruby and Agile and refactoring and unit tests and Martin Fowler, and I instinctively resist it. It's not that the ideas are *wrong*, they just seem unworthy of the religious zeal that often accompanies them. Ed --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Philly Lambda" group. To unsubscribe from this group, send email to philly-lambda-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/philly-lambda?hl=en -~----------~----~----~----~------~----~------~--~---
|
|