0

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 defined) 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).

1 Answer 1

3

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).

Sign up to request clarification or add additional context in comments.

1 Comment

I am using a function that calls itself. So basically here's the sml description of the function. xyz: int * deck -> hand * deck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.