<commit_before>;
; sequence.scm
;
; Test data for the GroundedPredicateNode, which is a virtual node.
; A sequence of these is evaluated, verifying that sequential evaluation
; works.
;
(use-modules (opencog))
(use-modules (opencog query))

(define green-light  (ConceptNode "green light"))
(define red-light  (ConceptNode "red light"))

(define num-green 0)
(define num-red 0)

; Return SimpleTV of true if green light, false if red light, and
; throw an exception if neither.  Increment counters so that we
; can verify that this was invoked.
(define (stop-go atom)
	(cond
		((equal? atom green-light) (begin (set! num-green (+ 1 num-green)) (stv 1 1)))
		((equal? atom red-light) (begin (set! num-red (+ 1 num-red)) (stv 0 1)))
		(else (throw 'not-a-stoplight "stop-go" "you're busted"))
	)
)

; Should throw an exception in all cases. Shouldn't do donuts on
; corn fields.
(define (off-road)
	(SatisfactionLink
		(SequentialAndLink
			(EvaluationLink
				(GroundedPredicateNode "scm: stop-go")
				(ListLink
					(ConceptNode "corn field")
				)
			)
		)
	)
)

;; Should see two green lights, and one red light, after which
;; the matching should stop.  There should be no exceptions or
;; errors when evaluating this.
(define (traffic-lights)
	(SatisfactionLink
		(SequentialAndLink
			(EvaluationLink
				(GroundedPredicateNode "scm: stop-go")
				(ListLink green-light)
			)

			(EvaluationLink
				(GroundedPredicateNode "scm: stop-go")
				(ListLink green-light)
			)

			(EvaluationLink
				(GroundedPredicateNode "scm: stop-go")
				(ListLink red-light)
			)

			(EvaluationLink
				(GroundedPredicateNode "scm: stop-go")
				(ListLink
					(ConceptNode "traffic ticket")
				)
			)
		)
	)
)
<commit_msg>SatisfactionLink is not needed for the test<commit_after>;
; sequence.scm
;
; Test data for the GroundedPredicateNode, which is a virtual node.
; A sequence of these is evaluated, verifying that sequential evaluation
; works.
;
(use-modules (opencog))
(use-modules (opencog query))

(define green-light  (ConceptNode "green light"))
(define red-light  (ConceptNode "red light"))

(define num-green 0)
(define num-red 0)

; Return SimpleTV of true if green light, false if red light, and
; throw an exception if neither.  Increment counters so that we
; can verify that this was invoked.
(define (stop-go atom)
	(cond
		((equal? atom green-light) (begin (set! num-green (+ 1 num-green)) (stv 1 1)))
		((equal? atom red-light) (begin (set! num-red (+ 1 num-red)) (stv 0 1)))
		(else (throw 'not-a-stoplight "stop-go" "you're busted"))
	)
)

; Should throw an exception in all cases. Shouldn't do donuts on
; corn fields.
(define (off-road)
	(SequentialAndLink
		(EvaluationLink
			(GroundedPredicateNode "scm: stop-go")
			(ListLink
				(ConceptNode "corn field")
			)
		)
	)
)

;; Should see two green lights, and one red light, after which
;; the matching should stop.  There should be no exceptions or
;; errors when evaluating this.
(define (traffic-lights)
	(SequentialAndLink
		(EvaluationLink
			(GroundedPredicateNode "scm: stop-go")
			(ListLink green-light)
		)

		(EvaluationLink
			(GroundedPredicateNode "scm: stop-go")
			(ListLink green-light)
		)

		(EvaluationLink
			(GroundedPredicateNode "scm: stop-go")
			(ListLink red-light)
		)

		(EvaluationLink
			(GroundedPredicateNode "scm: stop-go")
			(ListLink
				(ConceptNode "traffic ticket")
			)
		)
	)
)

{'fraction_non_alphanumeric': 0.1180637544273908, 'fraction_numerical': 0.004722550177095631, 'mean_word_length': 3.7665260196905765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5362508', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1130, 'n_words': 372}