22 lines
788 B
Scheme
22 lines
788 B
Scheme
; The calog kv store from s7 Scheme, inside ONE (begin ...) form (s7's
|
|
; runSource reads a single top-level form per script). Sets a couple of keys,
|
|
; reads them back with kvGet, and checks presence with kvHas. The kv store is
|
|
; process-wide and shared across every engine.
|
|
; Run: bin/calog examples/scripts/libraries/kvInScheme.scm
|
|
|
|
(begin
|
|
|
|
; Store a string and a number under two keys.
|
|
(kvSet "tool" "calog")
|
|
(kvSet "answer" 42)
|
|
|
|
; Read the values back and print them.
|
|
(calogPrint "tool =" (kvGet "tool"))
|
|
(calogPrint "answer =" (kvGet "answer"))
|
|
|
|
; kvHas reports whether a key exists.
|
|
(calogPrint "has tool =" (kvHas "tool"))
|
|
(calogPrint "has missing =" (kvHas "missing"))
|
|
|
|
; Tear down and exit cleanly (required -- calog does not auto-exit).
|
|
(calogExit 0))
|