]> gitweb.factorcode.org Git - factor.git/blob - extra/math/function-tools/function-tools.factor
factor: trim using lists
[factor.git] / extra / math / function-tools / function-tools.factor
1 ! Copyright (c) 2008 Reginald Keith Ford II.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel math arrays ;
4 IN: math.function-tools
5
6 ! Tools for quickly comparing, transforming, and evaluating mathematical functions
7
8 : difference-func ( func func -- func )
9     [ bi - ] 2curry ; inline
10
11 : eval ( x func -- pt )
12     dupd call( x -- y ) 2array ; inline
13
14 : eval-inverse ( y func -- pt )
15     dupd call( y -- x ) swap 2array ; inline
16
17 : eval3d ( x y func -- pt )
18     [ 2dup ] dip call( x y -- z ) 3array ; inline