Runtime error in sml function
- by Rpant
I am writing this function in sml
fun removeNodeswithNoIncoming((x:int,y)::xs,element:int) =
if x=element then
removeNodeswithNoIncoming (xs , element)
else
(x,y) :: removeNodeswithNoIncoming (xs , element)
| removeNodeswithNoIncoming(nil,element) = nil;
the function takes list of tuples [(0,0),(0,1)(1,2)] and another element 0
if first element of the tuples is same as second parameter , it removes it from the list
The o/p for the above list should be [(1,2)]
Unfortunately , the code is not working for the above input. Though there are other inputs for which it works
- removeNodeswithNoIncomingEdge([(0,1),(0,2),(1,2)],0);
stdIn:30.1-30.30 Error: unbound variable or constructor: removeNodeswithNoIncomi
ngEdge
- removeNodeswithNoIncomingEdge([(0,1),(0,2),(1,2),(1,4)],0);
stdIn:1.2-1.31 Error: unbound variable or constructor: removeNodeswithNoIncoming
Edge