[squeak-dev] One liner challenge
josh at schwa.ca
Fri Mar 12 15:31:31 UTC 2010
Thanks Alan, that's good to know. I don't much like the name #upToWith: anyway; it was just the first reasonable thing that came to mind.
On Mar 12, 2010, at 5:17 AM, Alan Knight wrote:
> VisualWorks has that one, as #through:, and the #corresponding throughAll: for a collection argument.
> At 11:56 PM 2010-03-11, Josh Gargus wrote:
>> #upTo: is inconvenient for this because the result doesn't include the matched character. If we had #upToWith: we could write:
>> | in | in := 'This is a (string) with some (parenthetical fields)' readStream.
>> String streamContents: [:out | [in atEnd] whileFalse: [out nextPutAll: (in upToWith: $( ); nextPutAll: (in upToWith: $) ) asUppercase]]
>> On Mar 11, 2010, at 7:34 PM, Randal L. Schwartz wrote:
>> >>>>>> "Travis" == Travis Griggs <travisgriggs at gmail.com> writes:
>> > Travis> Given strings of the form
>> > Travis> 'This is a (string) with some (parenthetical fields)'
>> > Travis> turn them into
>> > Travis> 'This is a (STRING) with some (PARENTHETICAL FIELDS)'
>> > Somehow, I think streams and #upTo: are gonna be the key there.
>> > --
>> > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
>> > <merlyn at stonehenge.com> < URL:http://www.stonehenge.com/merlyn/>
>> > Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
>> > See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
> Alan Knight [|], Engineering Manager, Cincom Smalltalk
> knight at acm.org
> aknight at cincom.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev