Write in SML

Suppose that we will represent integers by a list of the reverse of the digits of these integers. (Example 2854 → [4,5,8,2])

Write two versions of the function sum that takes two integers (in list representation) and returns their sum (in list representation also).
The first version: "sum1" converts the two list representations to integers, adds them and
finally converts the result back to list representation.
The second version: "sum2" adds the two list representations directly

Q&A Education