smlml

remove last element of a list sml by keeping the list in a val


How can I remove the last element in a list in Standard ML? I have a list defined as:

val list = [1, 4, 6, 8, 9]

and I want to remove the last element and have the list in the val list.


Solution

  • Well you have various ways of doing it.