Im doing a homework problem in Standard ML which we just started learning, and im stuck trying to computer the sum of the leafs in a tree. How could i access the elements in the node of this tree?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You deconstruct complex data types through pattern matching. Most of the time, you do this in your function arguments. If your function
ftakes a list as an argument, instead of defining it asyou’d say
Now, when you pass it a list, it will automatically assign
xto the first element, andxsto the remainder.In your case, it’s going to look something like this: