Paste: bicurry

Author: tylerg
Mode: factor
Date: Thu, 12 Feb 2009 04:39:00
Plain Text |
! My newest personal utility word I thougth I'd share.
! Has come in handy a couple times already.
! If you got something better/similar lets see it

: bicurry ( obj p q -- p' q' )
  [ [ curry ] curry ] bi@ bi ;

Annotation: 2 combinators I thought of yesterday

Author: randy7
Mode: factor
Date: Thu, 12 Feb 2009 08:25:24
Plain Text |
: 1bi1@ ( obj p q quot  -- objp objq ) 
    [ curry ] curry bi@ bi ;
! maybe this is the same as yours, haven't checked.

! 14:42:36 <randy7>  5 2 4 [ + ] ... => 7 9 
! from yesterday's chat.
! 1 object, 2 (bi) to apply (@) to that object using 1 quot.
! hence: 1bi1@ .. a better name is much appreciated.

: 1bi2* ( obj x y x-quot y-quot -- objx objy ) 
    [ [ curry ] curry ] bi@  bi* bi ;

! 14:57:06 <randy7> 1 2 3 [ + ] [ - ] foo => 3 -2
! takes 1 object 2 objects to apply using a spread (*) and 
! 2 quots to match the applied objects. 1bi2*

Annotation: example

Author: rand
Mode: factor
Date: Thu, 12 Feb 2009 09:38:42
Plain Text |
for good measure, here's one example. you don't even want to know how it looked like before. ;-)

: find-all ( string from-chr to-chr -- seq )
    [ find-all-firsts ] [ find-all-seconds ] 1bi2* close-match get-text ;

Annotation: Seems to have found its way into the kernel!

Author: tylerg
Mode: factor
Date: Thu, 19 Feb 2009 20:54:03
Plain Text |
bi-curry is in the kernel!  Do I get any credit?

New Annotation

Summary:
Author:
Mode:
Body: