Hi Ed,

Eduardo Cavazos wrote:
> Hi Phil,
> 
> There's an 'indices' in 'sequences.lib':
> 
> : indices ( seq obj -- seq )
>   >r dup length swap r>
>   [ = [ ] [ drop f ] if ] curry
>   2map
>   sift ;
> 

Do you mind if I substitute my (now renamed!) implementation into 
sequences.lib? - it's coming in at ~ twice as fast for large arrays in 
my timings.:

: (indices) ( seq obj n -- )
    [ 2dup ] dip rot index-from [ dup , 1+ (indices) ] [ 2drop ] if* ;

: indices ( seq obj -- idxseq )
    [ 0 (indices) ] { } make ;

Cheers,

Phil


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to