[squeak-dev] One liner challenge

Stephen Pair stephen at pairhome.net
Fri Mar 12 01:47:28 UTC 2010


On Thu, Mar 11, 2010 at 8:36 PM, Travis Griggs <travisgriggs at gmail.com>wrote:

> (Preamble: I have lurked here without really paying attention much for a
> year+ now. I thought I'd try to reinvolve myself. The following discussions
> are some of my favorite/funnest).
>
> I was looking at someone's ruby/regex code. I could do the equivalent of
> what they were doing with the ST Regex library. But I was curious if it
> could be done tersely/elegantly without using regex. Here's the challenge.
>
> Given strings of the form
>
> 'This is a (string) with some (parenthetical fields)'
>
> turn them into
>
> 'This is a (STRING) with some (PARENTHETICAL FIELDS)'
>

In one line:

'This is a (string) with some (parenthetical fields)'
withParentheticalFieldsCapitalized

...and then in the implementation of #withParentheticalFieldsCapitalized,
take all the space you need to make it nicely readable and fast.

;)

- Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100311/a3f2cfac/attachment.htm


More information about the Squeak-dev mailing list