I am trying to create a list of lists meaning my result should be like
thatgraph = [[0,[1,2]],[1,[1,3],[1,4],[1,5]],[2,[3,4],[4,4],[5,5],[5,10]]
The code i use is :
fun pin2graph (pin,thatgraph,i,j,rows,cols,havepizza) =
if (i<rows) andalso (j<cols-1) then
(
pin2graph (pin,thatgraph::((i*cols+j),(getAdjacent (pin,i,j,rows,cols,havepizza))),i,j+1,rows,cols,havepizza)
)
else if (i<rows) then
(
pin2graph (pin,thatgraph::((i*cols+j),(getAdjacent (pin,i,j,rows,cols,havepizza))),i+1,0,rows,cols,havepizza)
)
else thatgraph
The getadjacent function is of type :
val getAdjacent = fn
: char Array2.array * int * int * int * int * 'a -> (int * 'a) list
the 'a is actually a real number so the real type is (int * real) list .
Whatever i have tried i always get an operand and operator mismatch with most common being :
operator domain: _ * _ list
operand: _ * (int * (int * 'Z) list)
Any hint would be greatly appreciated , running out of ideas