0

If I'm at the repl I can do

?- assert(foo(a)),assert(foo(b)),assert(foo(c)).

and that works, but not

?- assert((bar(a),bar(b),bar(c))).

or similar. Is there a way to only need to type "assert" once and pass in multiple facts? Same question for rules.

thanks!

I tried several variations of what I mentioned above to accomplish this but can't figure out how to do it. Also looked at the doc for assert/1 but it doesn't show how.

false
  • 10,264
  • 13
  • 101
  • 209

1 Answers1

2

Maybe you can instead consult from user?

?- [user].
:- dynamic(foo/1).
foo(a).
foo(b).
foo(c).

Press Ctrl-D to end consulting. If you just want to add clauses the database, you may not need to type the dynamic/1 directive.

P.S. assert/1 is a deprecated/legacy predicate. Use instead assrta/1 or assertz/1 if you must.

Paulo Moura
  • 18,373
  • 3
  • 23
  • 33
  • Ok, woah... did not know about [user]. Yep, this is exactly what I was looking for. Thanks!! Anymore repl environments like this I should be aware of? – Elliot Mummel Dec 13 '22 at 01:29