In Shen/Scheme it would be a bit different. I will add an easier way to do it when I release a new version, but for now try this:
- After compiling, copy shen-scheme.scm to load-shen.scm
- Comment out or delete the line that starts with "(define-top-level-value 'get-shen-scheme-home-path ..."
- Comment out and delete the expression at the end of the file that starts with "(scheme-start ..."
- Add this at the end of the file: (initialize-shen)
Then from the Chez REPL you can do:
Chez Scheme Version 9.5.4
Copyright 1984-2020 Cisco Systems, Inc.
> (load "load-shen.scm")
> (kl:load "/tmp/test.shen") ; file contains (define test X Y -> (+ X Y))
(fn test)
run time: 0.0015089999999999826 secs
loaded
> (kl:test 1 2)
3
All the Shen functions are prefixed with "kl:" in Scheme, so "kl:load" is calling Shen's "load" function. "kl:eval" will call Shen's `eval` function, etc:
> (load "load-shen.scm")
> (kl:eval '(+ 1 2 3))
6
> (kl:eval '(define test X Y -> (+ X Y)))
#(shen.printF "(fn test)")
> (kl:test 4 5)
9