Skip to content

Commit

Permalink
[examples/1] update importing
Browse files Browse the repository at this point in the history
  • Loading branch information
RickBarretto committed May 30, 2024
1 parent 5de4fe8 commit 0f72f26
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions examples/sample1.art
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,39 @@
;;
;; Have fun!

do.import "grafito.art"
import {grafito}!

do [
graph.create "sample1" [
john: put 'person [s: "John" sex: 'm]
joan: put 'person [s: "Joan" sex: 'f]
bob: put 'person [s: "Bob" sex: 'm]
jill: put 'person [s: "Jill" sex: 'f]
graph.create "sample1" [
john: put 'person [s: "John" sex: 'm]
joan: put 'person [s: "Joan" sex: 'f]
bob: put 'person [s: "Bob" sex: 'm]
jill: put 'person [s: "Jill" sex: 'f]

link'marriedTo john joan
link'childOf @[bob jill] @[john joan]
]
link'marriedTo john joan
link'childOf @[bob jill] @[john joan]
]

do [
benchmark [
graph.verbose "sample1" [
benchmark [
graph.verbose "sample1" [

print "getting first person named Joan..."
joan: what'person [s: "Joan"]
inspect joan
print "getting first person named Joan..."
joan: what'person [s: "Joan"]
inspect joan

print "getting all male people married to Joan..."
husband: what 'person [sex: 'm marriedTo: joan]
inspect husband
print "getting all male people married to Joan..."
husband: what 'person [sex: 'm marriedTo: joan]
inspect husband

; inspect fetch 'person [
; marriedTo: what 'person [s: "Joan"]
; ]
; inspect fetch 'person [
; marriedTo: what 'person [s: "Joan"]
; ]

preview fetch 'person ø
]
preview fetch 'person ø
]
]

; do [
; graph "sample1" [
; preview fetch 'person ø
; ]
; graph "sample1" [
; preview fetch 'person ø
; ]

; execute ~"dot -Tpng sample.dot -o sample.png"

0 comments on commit 0f72f26

Please sign in to comment.