Iterating in the Assert Clause

38 views
Skip to first unread message

Chris

unread,
Dec 18, 2009, 5:05:48 PM12/18/09
to PyKE
Is it possible to use forall in the assert statement? For example, I'd
like to assert several facts from an arbitrary list of elements
accumulated in the foreach clause:

create_words
foreach
facts.sentence($uid, $sentence)
$words = enumerate($sentence.split(' '))
assert
forall
$i,$word in $words
facts.word($uid, $i, $word)

Bruce Frederiksen

unread,
Dec 18, 2009, 7:15:58 PM12/18/09
to py...@googlegroups.com
No, the forall may only be used in the foreach clause.

But you can just write the rule as:

create_words
  foreach
    facts.sentence($uid, $sentence)
    ($i, $word) in enumerate($sentence.split(' '))
  assert
    facts.word($uid, $i, $word)

-Bruce


--

You received this message because you are subscribed to the Google Groups "PyKE" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pyke+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyke?hl=en.



Chris

unread,
Dec 19, 2009, 4:34:57 PM12/19/09
to PyKE
Reply all
Reply to author
Forward
0 new messages