Are libraries supported in Scryer Playground?
Closed this issue ยท 6 comments
Tried to test:
:- use_module(library(between)).
:- use_module(library(time)).
?- time((between(1,1000000,_), fail; true)).
I got this currious error:
But outside of Scryer Playground it works, like in WSL2:
Time measuring is not yet possible in the WASM port! In particular, for:
t(N) :- '$cpu_now'(N).
we get in the WASM port:
?- t(N). [N=_863]
I sent a PR adding support for $cpu_now in wasm: mthom/scryer-prolog#2186
Hi, should this issue be closed since #2186 was merged?
I tried this again and I think we broke this functionality in #16. Right now it panics with window global object should be available
. Which may be an undesired side-effect of moving the computation to WebWorkers.
Off-topic: I've seen your lightning talk for ELS2024 in the live stream. It would be amazing to have a similar thing for Prolog too!
Seems to be impossible to implement, even
after like 12 months, so closing this ticket, right?
This is something I think we can implement. We just need to make stuff like '$cpu_now'/1
configurable on machine creation, so that we can provide a JS/Wasm/C function pointer that does the necessary work. There are a lot of stuff that I think should be configurable like this, like streams, and Wasm (and therefore Scryer Playground) would benefit a lot from that. Enabling stuff like that is on my roadmap after #2490.