;;; ;;; ;;; Social-graph Demonstration ;;; ;;; ;; ;; Matcher definition ;; (define $user (matcher {[,$u [] {[$tgt (match [u tgt] [user user] {[[ ] {[]}] [_ {}]})]}] [ [integer] {[ {id}]}] [ [string] {[ {name}]}] [ [string] {[ {txt}]}] [$ [something] {[$tgt {tgt}]}] })) (define $user-table (multiset user)) (define $follow (matcher {[,$f [] {[$tgt (match [f tgt] [follow follow] {[[(& ) (& )] {[]}] [_ {}]})]}] [ [integer] {[ {fid}]}] [ [integer] {[ {tid}]}] [$ [something] {[$tgt {tgt}]}] })) (define $follow-table (multiset follow)) ;; ;; Demonstration code ;; (define $user-data { }) (define $follow-data { }) ; Users whom "Egison_Lang" follows (test (match-all [user-data follow-data user-data] [user-table follow-table user-table] [[ ) _> ) _> ) _>] ])) ; Users who don't follow back "Egison_Lang" (test (match-all [user-data follow-data user-data] [user-table follow-table user-table] [[ ) _> ) ^ ) _>> ) _>] ])) ; Users who have interested in "Haskell" in the followers of followers of "Egison_Lang" (test (match-all [user-data follow-data user-data] [user-table follow-table user-table] [[ ) _> ) ) _>> > $txt)> ) _>] ]))