Guards are sometimes interpreted as function names
The guards here (all except the first) are considered function names:
Diag2 l1 l2 :== diag2_ l1 l2
where
diag2_ [|] ys = [|]
diag2_ xs [|] = [|]
diag2_ xs ys = [(ae,be) \\ (a,b) <- takeall xs [|] ys [|], ae <|- a & be <|- b]
where
takeall xin xout yin yout
| morex && morey = [|(nxout,nyout):takeall nxin nxout nyin nyout]
| morey = [|(xout,Tl nyout):takeall xin xout nyin (Tl nyout)]
| morex = [|(nxout,yout):takeall nxin nxout yin yout]
| otherwise = shift xout yout
where
(morex,nxin,nxout) = takexnext xin xout
(morey,nyin,nyout) = takeynext yin yout
takexnext [|x:xs] accu = (True,xs,[|x:accu])
takexnext [|] accu = (False,[|],accu)
takeynext [|y:ys] accu = (True,ys,accu ++| [|y])
takeynext [|] accu = (False,[|],accu)
shift xout [|_:ys] = [|(xout,ys):shift xout ys]
shift _ [|] = [|]
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information