AbandonedSince infogami has been abandoned by its creators, I’m out too. Back to web.fisher.cx for me. Everything that was here is there. Robert FisherJust thinking out loud Scheme is inside outIf you register and log in you can add comments to my pages. If viewing the main blog page, click the # underneath an entry to comment on it. One of the things that tends to frustrate me a bit while writing Scheme code is that it tends to be inside out. Suppose I want to write a procedure to convert a string to all upper case. One way to do it would be with these steps:
(Not necessarily the best way, but a way that allows me to illustrate my point.) But look at it in Scheme:
It's backwards! When things are more complex, however, you start to see that it is really inside out. Now, sometimes I write inside out code like this is C too. Likewise, sometimes Scheme code is sequential. But C tends to be more sequential than Scheme, & Scheme tends to be more inside out than C. So, could I make the Scheme sequential?
But that's ugly & not very Scheme-ish.
That's more Scheme-ish, perhaps, but even uglier. (There's also the case where you end up lifting a common subexpression into a let & you have to partially restructure inside out code as sequential. I'd really like things to be more uniform to make these kinds of code transformations easier. Failing that, though, some code to automate lifting common subexpressions could be very cool.) (Could you have an "it"? Something like Perl's $_?)
Hmm. Turning this into...
...with I think changing it to a OK, here's what I've got so far:
This will turn...
...into...
On a related note, here is a (untested) macro by psykotic on reddit to allow introducing local variable bindings without needing additional indention:
last updated 1 year ago # |