Three ways to implement the f acto rial function in SPL.
First the recursive version .
*/
+var r = 1;
+var facN = 1;
+var ok = True;
+
+
facR(n) :: Int -> Int {
if (n < 2) {
return 1;
//square the odd numbers in a list and remove the even members
squareOddNumbers(list) :: [Int] -> [Int] {
- while(!isEmpty (list) && list.hd % 2=0){
+ while(!isEmpty (list) && list.hd % 2==0){
list=list.tl;
}
if(!isEmpty(list)){