Three ways to implement the f acto rial function in SPL.
First the recursive version .
*/
+
facR(n) :: Int -> Int {
if (n < 2) {
return 1;
}
}
+
//The iterative version of the factorial function
facl ( n ) :: Int -> Int {
var r = 1;
}
//Generates a list of integers from the first to the last argument
-fromTo (from, to) :: Int Int -> [Int] {
+fromTo (from, to) :: Int -> Int -> [Int] {
if(from <= to){
return from:fromTo(from+1, to);
} else {
}
//list append
-append(l1, l2) :: [t] [t] -> [t] {
+append(l1, l2) :: [t] -> [t] -> [t] {
if(isEmpty(l1)){
return l2;
} else {