functional abstraction

hello hello playing_456 at yahoo.co.uk
Fri Aug 27 13:14:23 CEST 2004


Hi, 
 
Can someone please tell me how to do a functional abstraction?  The following is a function calculating the number of combination.
 
declare
fun {Fact N}
  
     if N==0 then 1
   else
      N*{Fact N-1}
   end
end
 
declare
fun {Comb N K}
   {Fact N} div ({Fact K}*{Fact N-k})
end
{Browse {Comb 10 3}}
 
Its generate this error:
 
ill-typed builtin application
%**
%** Builtin:         Number.'-'
%** At argument:     2
%** Expected types:  number x number x number
%** Argument names:  {Number.'-' N _ _}
%** Argument values: {Number.'-' N<optimized> k _<optimized>}
%** in file "Oz", line 13, column 33
%** ------------------ rejected (1 error)
 
WHY IS THIS SO?  THEREFORE, HOW TO MAKE A FUNCTION CALL ANOTHER FUNCTION.
THANK YOU


		
---------------------------------
 ALL-NEW Yahoo! Messenger - all new features - even more fun!  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/attachments/20040827/8a3791c4/attachment.html


More information about the mozart-users mailing list