• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I convert this to Java code?  RSS feed

 
Helen Miller
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Marshal
Posts: 56520
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!