shithub: sl

Download patch

ref: da8010e37d56c8c2d0289b1ef465fb5b724a7ce9
parent: 44eba0535148291926a0cc4bb926ce32c0d2385f
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Feb 5 22:56:03 EST 2025

document rand* functions

--- a/boot/flisp.boot
+++ b/boot/flisp.boot
@@ -15,9 +15,11 @@
 	      #fn("8000z0700}2:" #(aset!)) 0 0 0 0 0 0 0 0 0 0 0 #fn("9000n3012082>1|:" #(#fn("6000n1A061:" #())))
 	      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #fn("8000z0700}2:" #(aref)) 0 #fn("5000n10\x8e:" #())
 	      0)
-	    *properties* #table(*funvars* #table(lz-unpack ((data :to destination)
-							    (data :size decompressed-bytes))  void? ((x))  >= ((a . rest))  help ((term))  length= ((lst
-  n))  = ((a . rest))  <= ((a . rest))  car ((lst))  /= ((a . rest))  lz-pack ((data (level 0)))  void (rest)  nan? ((x))  *prompt* (#f)  cons? ((value))  vm-stats (nil)  * ((number…))  > ((a . rest))  cdr ((lst))  + ((number…)))  *doc* #table(> "Return #t if the arguments are in strictly decreasing order (previous\none is greater than the next one)."  lz-unpack "Return decompressed data previously compressed using lz-pack.\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified.  In the latter case a new\narray is allocated."  void? "Return #t if x is #<void> and #f otherwise."  >= "Return #t if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)."  help "Display documentation for the specified term, if available."  length= "Bounded length test.\nUse this instead of (= (length lst) n), since it avoids unnecessary\nwork and always terminates."  = "Return #t if the arguments are equal."  car "Returns the first element of a list or nil if not available."  *builtins* "VM instructions as closures."  <= "Return #t if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)."  /= "Return #t if not all arguments are equal. Shorthand for (not (= …))."  lz-pack "Return data compressed using Lempel-Ziv.\nThe data must be an array, returned value will have the same type.\nThe optional level is between 0 and 10.  With level 0 a simple LZSS\nusing hashing will be performed.  Levels between 1 and 9 offer a\ntrade-off between time/space and ratio.  Level 10 is optimal but very\nslow."  arg-counts "VM instructions mapped to their expected arguments count."  nan? "Return #t if the argument is NaN, regardless of the sign."  void "Return the constant #<void> while ignoring any arguments.\n#<void> is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though #t or nil could\nbe returned instead, in case of #<void> alone, REPL will not print\nit."  Instructions "VM instructions mapped to their encoded byte representation."  cons? "Returns #t if the value is a cons cell."  vm-stats "Print various VM-related information, such as the number of GC calls\nso far, heap and stack size, etc."  * "Return product of the numbers or 1 with no arguments."  *prompt* "Function called by REPL to signal the user input is required.\nDefault function prints \"#;> \"."  cdr "Returns the tail of a list or nil if not available."  + "Return sum of the numbers or 0 with no arguments."  *properties* "All properties of symbols recorded with putprop are recorded in this table."))
+	    *properties* #table(*funvars* #table(*prompt* (#f)  lz-unpack ((data :to destination)
+									   (data :size
+										 decompressed-bytes))  void? ((x))  >= ((a . rest))  rand-uint64 (nil)  help ((term))  length= ((lst
+  n))  = ((a . rest))  car ((lst))  <= ((a . rest))  rand-uint32 (nil)  /= ((a . rest))  void (rest)  lz-pack ((data
+  (level 0)))  rand (nil)  nan? ((x))  rand-float (nil)  cons? ((value))  vm-stats (nil)  * ((number…))  rand-double (nil)  cdr ((lst))  + ((number…))  > ((a . rest)))  *doc* #table(>= "Return #t if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)."  void? "Return #t if x is #<void> and #f otherwise."  length= "Bounded length test.\nUse this instead of (= (length lst) n), since it avoids unnecessary\nwork and always terminates."  car "Returns the first element of a list or nil if not available."  *builtins* "VM instructions as closures."  <= "Return #t if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)."  void "Return the constant #<void> while ignoring any arguments.\n#<void> is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though #t or nil could\nbe returned instead, in case of #<void> alone, REPL will not print\nit."  rand "Return a random non-negative fixnum on its maximum range."  nan? "Return #t if the argument is NaN, regardless of the sign."  Instructions "VM instructions mapped to their encoded byte representation."  rand-double "Return a random double on [0.0, 1.0] interval."  > "Return #t if the arguments are in strictly decreasing order (previous\none is greater than the next one)."  cdr "Returns the tail of a list or nil if not available."  + "Return sum of the numbers or 0 with no arguments."  lz-unpack "Return decompressed data previously compressed using lz-pack.\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified.  In the latter case a new\narray is allocated."  rand-uint64 "Return a random integer on [0, 2⁶⁴-1] interval."  help "Display documentation for the specified term, if available."  = "Return #t if the arguments are equal."  rand-uint32 "Return a random integer on [0, 2³²-1] interval."  /= "Return #t if not all arguments are equal. Shorthand for (not (= …))."  lz-pack "Return data compressed using Lempel-Ziv.\nThe data must be an array, returned value will have the same type.\nThe optional level is between 0 and 10.  With level 0 a simple LZSS\nusing hashing will be performed.  Levels between 1 and 9 offer a\ntrade-off between time/space and ratio.  Level 10 is optimal but very\nslow."  rand-float "Return a random float on [0.0, 1.0] interval."  arg-counts "VM instructions mapped to their expected arguments count."  *prompt* "Function called by REPL to signal the user input is required.\nDefault function prints \"#;> \"."  cons? "Returns #t if the value is a cons cell."  vm-stats "Print various VM-related information, such as the number of GC calls\nso far, heap and stack size, etc."  * "Return product of the numbers or 1 with no arguments."  *properties* "All properties of symbols recorded with putprop are recorded in this table."))
 	    *runestring-type* (array rune) *string-type* (array byte)
 	    *syntax-environment* #table(bcode:nconst #fn("7000n1200r2e3:" #(aref))  doc-for #fn("@000\x8710002000\x881000I60O?140B;35040<;I40402086510B;35040=88II087\\3?07122862353@30O@F087\\360O@<071228624534252686e2261e22688e2e4:" #(#fn(top-level-value)
   error "docs: " ": no funvars specified" ": funvars set but isn't a function" symbol-set-doc quote))  with-input-from #fn("<000z12021e1220e2e1e12315163:" #(#fn(nconc)
binary files a/boot/flisp.boot.builtin b/boot/flisp.boot.builtin differ
--- a/src/docs_extra.lsp
+++ b/src/docs_extra.lsp
@@ -33,3 +33,18 @@
 Either destination for the decompressed data or the expected size of
 the decompressed data must be specified.  In the latter case a new
 array is allocated.")
+
+(doc-for (rand)
+  "Return a random non-negative fixnum on its maximum range.")
+
+(doc-for (rand-uint64)
+  "Return a random integer on [0, 2⁶⁴-1] interval.")
+
+(doc-for (rand-uint32)
+  "Return a random integer on [0, 2³²-1] interval.")
+
+(doc-for (rand-double)
+  "Return a random double on [0.0, 1.0] interval.")
+
+(doc-for (rand-float)
+  "Return a random float on [0.0, 1.0] interval.")
--