The Sifflet visual functional programming language and aid to understanding recursive functions (http://mypage.iu.edu/~gdweber/software/sifflet/home.html)

## #46Errors involving a node with insufficient inputs.

Given this incorrect definition of the power function:

```
Power x n = if (zero? n)
0
(* x (Power (sub1 n)))
```

-- note that in the recursive step, the call to Power has only one argument -- and giving inputs x = 3, n = 6, trying to expand the Power node (the recursive call) causes the program to crash.

O: 2012 Nov 12 R: A Starks P: high

- added tag
**p:high**

- added tag
Saving the function definition and evaluating the function call are okay (Sifflet displays stack overflow errors on the diagram, which is right because the

*second*argument to Power never changes). On trying to expand the recursive Power node, sifflet crashes with this error message:sifflet-devel: buildFooterText: mismatched lists

2013 July 4.

Sifflet infers the type of this function as (Num -> (Num -> Num)), which seems wrong because of the missing argument to the recursive Power node.

Indeed, ghci reports an "occurs check" error for the following definition:

`power x n = if n == 0 then 0 else x * power (n - 1)`

`Occurs check: cannot construct the infinite type: a0 = a0 -> a0 In the return type of a call of `power' Probable cause: `power' is applied to too few arguments In the second argument of `(*)', namely `power (n - 1)' In the expression: x * power (n - 1)`

- added tag
**p:medium** - removed tag
**p:high**

Partly fixed. Sifflet no longer crashes in this case, but displays the arguments without corresponding inputs as, e.g., "x = ?".

This is no longer high priority, but there are a couple of concerns:

The type checker should reject function definitions of this kind.

Even if it does not, the evaluator should produce a different kind of error than stack overflow, since the value of partially applied Power is not a number, but a function of type (Num -> Num), and therefore unsuitable as input to the '*' function.

- added tag
- summary changed to
**"Errors involving a node with insufficient inputs."**

- summary changed to