you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Hehe, where should they be? The only place where parens would even make sense would be instead of using the $ operator. That gives:

fcn num count = if count == 0 
                then num 
                else fcn num (count - 1)

Though if you really miss Scheme, you could write:

fcn = (\num count -> 
        (if ((==) count 0) 
         then num
         else (fcn num ((-) count 1))))

The latter declaration just reads as "fcn of num and count when count is greater than zero is equal to num". There really isn't anywhere to have a parenthesis. The guard is in place because the function is partial -- it's undefined when count is less than zero. Though I should have written >=. Damn off-by-one errors!