So I've been asked to implement a linked list in java using the following maude specification:
Below is a Maude specification of ‘Sorted Lists’: lists of integers in increasing order.
mod SORTED-LIST is protecting INT . sort SortedList . op empty : -> SortedList . op add : Int SortedList -> SortedList . op insert : Int SortedList -> SortedList . vars I J : Int . var L : SortedList . eq insert(I, empty) = add(I, empty) . cq insert(I, add(J, L)) = add(I, add(J,L)) if I <= J . cq insert(I, add(J, L)) = add(J, insert(I, L)) if I > J . endm
What I would like to know, is what is the difference is between add and insert!?
Apparently they need to be implemented as two separate methods, but apart from this maude specification and the description above it, there is no other information available.
thanks!