Skip to content

Instantly share code, notes, and snippets.

@cataska
Created May 9, 2012 09:35
Show Gist options
  • Save cataska/2643333 to your computer and use it in GitHub Desktop.
Save cataska/2643333 to your computer and use it in GitHub Desktop.
Trivial function composition example in factor
USING: kernel io sequences math math.ranges namespaces arrays
prettyprint ;
IN: aboveAndDiv2
: above60 ( seq -- seq )
[ 60 >= ] filter ;
: div2 ( seq -- seq )
[ 2 / ] map ;
: above60AndDiv2 ( seq -- seq )
[ above60 ] [ div2 ] compose call ;
: testIt ( -- x )
65 [1,b] above60AndDiv2 ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment