/* Source code made by iri This code is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You can do what you want with it */ fun add (x, y)= x+y;; fun main1 ()= _fooS "add 1 2;"; _fooId add 1 2; // displays 3 in the console 0;; fun main2 ()= _fooS "exec @add with [1 2];"; _fooId exec @add with [1 2]; // object created by a @ before the function name 0;; fun fooadd (x, y, objFun)= exec objFun with [x y];; fun main3 ()= _fooS "fooadd 1 2 @fooadd;"; _fooId fooadd 1 2 @add; // call fooadd with an function object @add 0;; fun fooadd4 (x)= let mkfun2 @add 1 -> foofun in exec foofun with [x];; fun main4 ()= _fooS "mkfun2"; _fooId fooadd4 2;; fun endWin (objwin, user_parameter, mkfun_parameter)= _fooS mkfun_parameter; user_parameter;; fun crWin ()= let _CRwindow _channel nil 0 0 250 50 WN_NORMAL "function objects" -> window in let "THE END" -> string in _CBwinDestroy window mkfun3 @endWin string 0; 0;; fun main5 ()= crWin;; fun main ()= _showconsole; main1; main2; main3; main4; main5; 0;;