aarroyoc/scryer-playground

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)).

https://play.scryer.pl/

I got this currious error:

286333308-fc12c1af-3dee-4fe8-ba13-70ec7ad1323a

But outside of Scryer Playground it works, like in WSL2:

286333878-eb8b1ead-2e83-4e71-9c48-af2eaa685215

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?

bakaq commented

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.