Helen Miller

Greenhorn

Posts: 1

posted 4 years ago

Recursive Procedure Mgu (x,y)

Begin x=y ==> Return() ,

Variable (x) ==> Return (Mguvar(x,y)) ,

Variable (y) ==> Return (Mguvar(y,x)) ,

Constant (x) or Constant (y) ==> Return (False),

Not(Length(x)=Length(y)) ==> Return(False) ,

Begin i <- 0 ,

g<- [] ,

Tag i =length(x) ==> Return(g) ,

s <- Mgu(Part(x,i), Part(y,i))

s=False ==> Return (False) ,

g <- Compose (g,s) ,

x<- Substitute (x,g) ,

i<- i+1 ,

Goto tag

End

End

Procedure mguvar(x,y)

Begin includes(x,y)==> Return (False) ,

Return ([x/y])

end

Begin x=y ==> Return() ,

Variable (x) ==> Return (Mguvar(x,y)) ,

Variable (y) ==> Return (Mguvar(y,x)) ,

Constant (x) or Constant (y) ==> Return (False),

Not(Length(x)=Length(y)) ==> Return(False) ,

Begin i <- 0 ,

g<- [] ,

Tag i =length(x) ==> Return(g) ,

s <- Mgu(Part(x,i), Part(y,i))

s=False ==> Return (False) ,

g <- Compose (g,s) ,

x<- Substitute (x,g) ,

i<- i+1 ,

Goto tag

End

End

Procedure mguvar(x,y)

Begin includes(x,y)==> Return (False) ,

Return ([x/y])

end

Campbell Ritchie

Marshal

Posts: 56520

172

posted 4 years ago

Welcome to the Ranch

I have deleted the second post on the assumption it was a mistaken duplication.

What is this supposed to find? Is it some sort of Euclid's algorithm?

What do those ⟹ operators mean? Are they guard operators? There are other operators which I am unfamiliar with. Which language is that written in?

I think you would need to translate that code into English before trying to write any computer code.

I have deleted the second post on the assumption it was a mistaken duplication.

What is this supposed to find? Is it some sort of Euclid's algorithm?

What do those ⟹ operators mean? Are they guard operators? There are other operators which I am unfamiliar with. Which language is that written in?

I think you would need to translate that code into English before trying to write any computer code.

posted 4 years ago

It is sorta covered in the JavaRanch Style Guide. |