0

I'm trying to use 2 templates in findall but I'm getting error because of the ' ', between first template and second, it asks me to put an operand, I put + then it shows the C as template1 '+' template2 but I don't want the + to appear on C.

Also tried findall((+z-AS-Sesio-Hsemana, u-CU-Hsemana), between(1,NH,Sesio), C)

but then the ',' between Hsemana and u-CU-Hsemana appears too, and I just want a blank space ' '.

  • Prolog syntax doesn't support blank/space between terms to form a compound term. If you're just concerned about outputting the information to the screen with a space instead of comma, then capture the result and write a predicate that uses `write` or `print` to write it out in a format that you like. – lurker Oct 30 '15 at 20:14
  • if I print C then add something, it prints: [C] something because C is a List – Daniel Roca Lopez Oct 30 '15 at 20:16
  • 1
    If `C` is a list (for example, if `C` is `[1,2,3]`) then, yes, if you `print` or `write` `C`, you're going to get `[1,2,3]` because that's what it is. If you want instead to see `1 2 3`, then you must write a predicate that accepts a list and writes each element out followed by a space. If that's not what you want, then you need to explain in more detail in your question with some examples. Note that the purpose of `findall` is to gather all the solutions to a predicate, it's not an output formatting tool. – lurker Oct 30 '15 at 20:20
  • 1
    well, that wasn't exactly what I wanted but I helped me to solve the problem, thanks! – Daniel Roca Lopez Oct 30 '15 at 20:22
  • 1
    I'm glad it was helpful. :) – lurker Oct 30 '15 at 20:23

1 Answers1

0

thanks to lurker's comment on my question, I found the answer:

findall((+z-AS-Sesio-Hsemana), between(1,NH,Sesio), C), append(C,u-CU-Hsemana, C2), do something with C2