Standard ML Recursive Function
I am having trouble with recursion in sml. Basically, I have a function called xyz which takes in an int and a deck (a datatype which I defi开发者_开发技巧ned) and returns a hand(a datatype which I defined) and a deck (a datatype which I defined). The issue which I am having is that the function takes as input a int and a deck so how am I suppose to return two different data types (a hand and a deck).
I don't see how this has anything to do with recursion. Recursion is a function calling itself — you just talk about a function taking a pair of values and returning a pair of values of a different type. To return a hand and a deck, you'd just return a tuple (yourHand, yourDeck)
.
精彩评论