Anyone know if there's a way to get time to work in SCI?
done 0.8.41 available
So I'm using the new SCI release with time support
$ ys -pe '.*sci-version*'
{:major 0, :minor 8, :incremental 41}
but it doesn't seem to work for me:
$ bb -e '(time 123)'
"Elapsed time: 0.013047 msecs"
123
$ ys -pe '(time 123)'
Exception in thread "main" java.lang.Exception: Error: clojure.lang.ExceptionInfo: Could not resolve symbol: java.lang.System {:type :sci/error, :line 1, :column 1, :file "NO_SOURCE_PATH", :phase "analysis"}
at yamlscript.cli$die.invokeStatic(cli.clj:50)
at yamlscript.cli$do_run.invokeStatic(cli.clj:230)
at yamlscript.cli$_main.invokeStatic(cli.clj:375)
at yamlscript.cli$_main.doInvoke(cli.clj:349)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at yamlscript.cli.main(Unknown Source)
at java.base@21.0.1/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
I have a feeling it's because time is a macro and I'm setting it up wrong in the sci context: https://github.com/yaml/yamlscript/blob/main/core/src/yamlscript/runtime.clj#L51-L62
I think this is because you have copied bb's previous macro and are not using the one from SCI.
user=> (sci/binding [sci/out *out*] (sci/eval-string "(time 1)"))
"Elapsed time: 0.007292 msecs"
1I didn't copy anything from bb whatsoever. I was just showing the bb command works as I expected the ys command to work.
behold what I typed in the REPL above. this shows that the time macro works. I think you have added something manually to {:namespaces ...} that overrides time
is your project public?
I think so too. Behold the url I posted above: https://github.com/yaml/yamlscript/blob/main/core/src/yamlscript/runtime.clj#L51-L62 😉
of course 🙂
:) yeah so remove the 'time thing
ah right
since it is now built into SCI you don't need that
yeah, derp...
$ ys -pe '(time 123)'
"Elapsed time: 0.001493 msecs"
123
Thank you!Awesome!
Actually I think that's already in SCI on master
Hmm, so not released? I'm not sure how to use stuff from git. But I guess I can wait 🙂
are you using clj or lein?
lein
you can just copy over that configuration as well and add it to your SCI config in clojure.core. that's what I had in bb initially before I moved it to SCI:
https://github.com/babashka/babashka/commit/838608647a080d7c940d92032318756b703314d4
but I can make a new release tomorrow as well
OK I'll wait. I just made a list of things available in clojure and in sci and diffed them and looked for things I'd want and noticed time.
Thanks in advance for the release 🙂
Also a bonus that destructure will be released