patch

Brian T. Rice water at tunes.org
Mon Jul 19 15:01:15 PDT 2004


Okay, I've applied the patches now, including the #>> change; they all looked
reasonable enough. I'm also including the mailing list (I forgot to on my
reply... working through webmail at the moment).

"Brian T. Rice" <water at bespin.org> said:

> Lendvai Attila <Attila.Lendvai at netvisor.hu> said:
> 
> > hi!
> >  
> > i've got a patch with some changes, apply what is useful.
> >  
> > i had to make some of these to make stream >> bag writer work, but i'm not
> sure this is the right way.
> 
> Thanks! Please include the mailing list when you send patches in the future.
> 
> I should mention that Attila has been testing out some utilities like
> src/tokenizer.slate, particularly figuring out how to take easy word-counts of
> file contents. Here's an illustration:
> 
> File withOpenNamed: 'license.txt' do: [| :f results |
>     results: Bag newEmpty writer. "Holds elements and counts."
>     (f reader splitWith: {$\s. $\t. $\n}) >> results.
>     results contents].
> 
> I realize from this that #>> should be returning the target stream, so that
> you can just immediately grab the results without needing another local slot
> to refer to it.
> 
> #splitWith: is an invocation of the tokenizer to get a stream-like analogue of
> Sequence splitWith:. Like other Stream/Collection methods (collect:, select:,
> reject:), it follows a rule that calls to collections return collections, and
> streams for streams.
> 
> Also, the #split method is an easier form of #splitWith: using default
> whitespace for separators.
> 
> So, once the #>> change is in, the script should be in its shortest form as:
> 
> File withOpenNamed: 'license.txt' do: [| :f |
>     (f reader split >> Bag newEmpty writer) contents].
> 
> 



-- 






More information about the Slate mailing list