Exercise: Use tail recursion and PASS to build a process that raises its first argument to the power of the second, assuming that the first is a real number and the second is a positive integer.

EXP<x,a,v> = NEQ<a,0> ; PASS<v*x> ; EXP<x,a-1,res> .

The third argument needs to be set to 1 initially. So EXP<10,3,1> calculates 10^3

-- (c) Fordham University Robotics and Computer Vision


This topic: Main > WebHome > FordhamRoboticsAndComputerVisionLaboratory > FRCVProjects > DTRA > PARS-tutorial > PARS-tutorial-ex6
Topic revision: r1 - 2014-09-12 - DamianLyons
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback