[squeak-dev] One liner challenge

Travis Griggs travisgriggs at gmail.com
Fri Mar 12 10:01:17 UTC 2010


On Mar 11, 2010, at 10:51 PM, Göran Krampe wrote:

> Hi!
>
> I know this is "cheating" but if we use my SimpleMacro package:
>
> http://map.squeak.org/packagebyname/simplemacro
>
> ...then it is trivially written as:
>
> (MacroProcessor block: [:x |  '(', x asUppercase, ')' ]
>  between: '(' and: ')') deep: false; process:
>    'This is a (string) with some (parenthetical fields)'
>
> :)
>
> Note the "deep: false;", otherwise it will try to expand the  
> expansions and goes into an infinite loop.

I don't think it's cheating at all. The whole point of such a post is  
to see what techniques AND tools others use out of the box to solve  
problems.  And you showed a cool one. One that I wasn't that aware of.  
I'm curious what other ways you use your MacroProcessor for now. I  
looked at the link, but the example didn't stir my imagination that  
much.

It's no more cheating than my use of a diff engine to tokenize the  
string.

<aside>I know I'm not going to see my own email, I've been to my  
subscription page and turned said option on, what gives?</aside>

--
Travis Griggs
Objologist
"I did not have time to write you a short program, so I wrote you a  
long one instead."




More information about the Squeak-dev mailing list