reset password
Author Message
ejaan
Posts: 27
Posted 00:57 Nov 20, 2016 |

Hello Professor Abbott

How can we try different inputs for functions that are defined inside other functions?

For example:

qpList which is defined inside optimalPaths 

<interactive>:1:1: Not in scope: ‘qpList’

*Main> qpList [5,30,50]

<interactive>:5:1: Not in scope: ‘qpList’

*Main> qpList [[5,30,50]]

<interactive>:6:1: Not in scope: ‘qpList’

 

Thank you 

^_^

Last edited by ejaan at 00:57 Nov 20, 2016.
rabbott
Posts: 1649
Posted 09:59 Nov 20, 2016 |

In the current version qpList is defined at the top level.

But in general, you're right. Functions defined within where clauses are not visible outside the function for which they are defined. To make such a function visible, move it out to the top level. Be careful that the function doesn't depend on values in the function under which it's defined. If it does, you must pass those values as additional arguments. 

Last edited by rabbott at 10:00 Nov 20, 2016.