Prolog term concatenation
Posted
by d0pe
on Stack Overflow
See other posts from Stack Overflow
or by d0pe
Published on 2010-06-10T17:34:47Z
Indexed on
2010/06/15
22:22 UTC
Read the original article
Hit count: 250
prolog
|concatenation
Hi, I'm trying to format a result from a program but getting an hard time.
I wanted to give something like this as result:
Res = do(paint(x) do(clean(a), do(repair(b) , initialState)))
basically, I want to concatenate successive terms to initialState atom but, it doesn't work with atom_concat since the other terms to concatenate aren't atoms and also I wanted to add the ) everytime I pass through the "do" function.
So it would be something like: Res = initialState.
When do function was called, I would have a function like
concatenateTerm(Pred, Res, Res).
Pred beeing repair(b) for instance and obtain the result: res = do(repair(b),
initialState).
Is this possible to be done?
Thanks
© Stack Overflow or respective owner