Re: [Factor-talk] regexp words on string slices

2012-11-30 Thread Naveen Garg
Oops, I had a typo, i was checking for regexp? instead of slice? : check-string ( string -- string ) ! Make this configurable !dup string? [ String required throw ] unless ; dup dup string? swap slice? or [ String required throw ] unless ; 0 4 foo bar slice R/ foo/

Re: [Factor-talk] regexp words on string slices

2012-11-30 Thread John Benediktsson
Probably the restrictions to strings were a performance optimization...? It should be pretty easy to get the behavior you want: IN: scratchpad 0 4 foo slice R/ foo/ first-match . T{ slice { from 0 } { to 3 } { seq foo } } Using this diff makes it work, but causes the regexp benchmark

Re: [Factor-talk] regexp words on string slices

2012-11-30 Thread Naveen Garg
Awesome. Thanks John. For my specific project, the current weaker link is memory usage compared to speed. On Fri, Nov 30, 2012 at 8:03 PM, John Benediktsson mrj...@gmail.com wrote: Probably the restrictions to strings were a performance optimization...? It should be pretty easy to get the