Paste: suggestions plz

Author: randy
Mode: factor
Date: Fri, 5 Dec 2008 07:16:01
Plain Text |
: ordered-perms ( seq -- seq )
    [
      [ length >array [ 1+ ] map ]
      [ ] bi
      '[ _ swap clump ] each
    ] [ length ] bi narray ;

Annotation: next1

Author: randy
Mode: factor
Date: Fri, 5 Dec 2008 07:21:55
Plain Text |
: ordered-perms ( seq -- seq )
    [ length >array [ 1+ ] map ]
    [ ] bi
    '[ _ swap clump ] map ;

Annotation: next2

Author: randy
Mode: factor
Date: Fri, 5 Dec 2008 08:03:34
Plain Text |
USING: ;
IN: phrases

: (number-of-branches) ( seq -- seq )
    length >array [ 1+ ] map ;

: just-alpha ( seq -- seq ) " " split [ [ alpha? ] filter ] map ;
: trim-empty ( seq -- seq ) [ "" = ] trim ;
    
: possible-phrases ( sentence -- words-seq )
    just-alpha trim-empty
    [ (number-of-branches) ] [ ] bi
    '[ _ swap clump [ " " join ] map ] map ;

New Annotation

Summary:
Author:
Mode:
Body: