I am trying to perform a sumList function in prolog that takes the input: sumList([1,[2,3],[4],5],X). and returns X=15.
I understand how to sum a simple list and a list of lists(ie [1,2,3,4,5] & [[1,2,3],[4,5]]) but i am getting errors because i am not properly handing the multiple inner lists(because i do not yet know how to, i havent encountered this before), i was told i have to use atom or atomic by a college somehow but i haven't seen a clear example on how this is done. any sml code i could translate or prolog code that could help me sum the list [1,[2,3],[4],5] would be greatly appericated. thanks!