Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -0,0 +1,7 @@
[ $ \import time
time.sleep(from_stack())\
python ] is sleep ( seconds --> )
say "Sleeping..."
10 sleep
say "Awake!"

View file

@ -0,0 +1,12 @@
fun doSleep () =
let
val maybeline = TextIO.inputLine TextIO.stdIn
val line = if isSome maybeline then valOf maybeline else raise Fail "Enter a number of seconds"
val maybesecs = Real.fromString line
val secs = if isSome maybesecs then valOf maybesecs else raise Fail "Bad number entered"
val () = print "Sleeping...\n"
val () = OS.Process.sleep (Time.fromReal secs)
val () = print "Awake!\n"
in
()
end

View file

@ -0,0 +1,2 @@
(* load the above function in the REPL and then: *)
PolyML.export("doSleep.o", doSleep);

View file

@ -1,8 +0,0 @@
(TextIO.print "input a number of seconds please: ";
let val seconds = valOf (Int.fromString (valOf (TextIO.inputLine TextIO.stdIn))) in
TextIO.print "Sleeping...\n";
OS.Process.sleep (Time.fromReal seconds); (* it takes a Time.time data structure as arg,
but in my implementation it seems to round down to the nearest second.
I dunno why; it doesn't say anything about this in the documentation *)
TextIO.print "Awake!\n"
end)