OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-generate commits / a8ce76c

Get rid of the srfi-style cruft.
a8ce76cda104ad11c60130edaf476197a6786cca
by Linas Vepstas <linasvepstas@gmail.com> · 2020-04-22T16:14:50.000Z

Changed files (1) +16 -25

demo/seir.scm +16 -25
……@@ -502,37 +502,28 @@
502502(cog-set-value! (car individual-list) seir-state infected)
503503
504504; ---------------------------------------------------------------------
505; Obtain a list of all friendship relations, and all encounters between
506; strangers. We don't really need to have these (they can always be
507; generated on the fly) but they're handy to look at and have around.
508
509(define all-relations (remove-duplicate-atoms (append-map
510 (lambda (individual) (cog-incoming-by-type individual 'SetLink))
511 individual-list)))
512
513(format #t "The social network consists of ~D pair-wise relationships\n"
514 (length all-relations))
515
505; Reporting statistics.
506;
507; Two reports are provided. The first describes the structure of the
508; generated network: the number of friend and stranger relationships
509; in the network. The second describes the progression of the disease
510; state.
511;
512; Obtain a list of pairs of interacting individuals, who interact either
513; through friendship or stranger encounters.
516514(define (get-relations-of-type RELATION)
517 (filter-map (lambda (relpair)
518 (equal? RELATION (gar (car
519 (cog-incoming-by-type relpair 'EvaluationLink)))))
520 all-relations))
515 (exec-unwrap
516 (Get
517 (TypedVariable (Variable "$pair") (Type "SetLink"))
518 (Present (Evaluation RELATION (Variable "$pair"))))))
521519
522(define friend-relations (get-relations-of-type (Concept "friend")))
523520(format #t "The social network consists of ~D friend-pairs\n"
524 (length friend-relations))
521 (length (get-relations-of-type (Concept "friend"))))
525522
526(define stranger-relations (get-relations-of-type (Concept "stranger")))
527523(format #t "The social network consists of ~D stranger-pairs\n"
528 (length stranger-relations))
524 (length (get-relations-of-type (Concept "stranger"))))
529525
530; ---------------------------------------------------------------------
531; Reporting statistics.
532;
533; As the simulation progresses, some reports are needed. This implements
534; a very simple reporting function.
535;
526; ---------
536527; Obtain a list of individuals in a given state.
537528(define (get-individuals-in-state STATE)
538529 (exec-unwrap