about summary refs log tree commit diff
path: root/users/wpcarro/emacs/.emacs.d/wpc/random.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-11-25T06·41-0800
committerwpcarro <wpcarro@gmail.com>2022-11-25T16·49+0000
commit8fd9b91d2938bc68b4ed7d1a2dac3f753d3fa31e (patch)
tree946761316e90a6dd61339ed9a3c7f3f4e3d51187 /users/wpcarro/emacs/.emacs.d/wpc/random.el
parent094f07ad9ab1d8afb44f1e98bca639c5a1fdd0e9 (diff)
chore(wpcarro/emacs): Delete unused packages r/5318
Elisp liposuction

Change-Id: Id1940977afb33ae893264cfa388fd05c60b0ec9c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7399
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/emacs/.emacs.d/wpc/random.el')
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/random.el80
1 files changed, 0 insertions, 80 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/random.el b/users/wpcarro/emacs/.emacs.d/wpc/random.el
deleted file mode 100644
index dfe10b6d47d1..000000000000
--- a/users/wpcarro/emacs/.emacs.d/wpc/random.el
+++ /dev/null
@@ -1,80 +0,0 @@
-;;; random.el --- Functions for working with randomness -*- lexical-binding: t -*-
-
-;; Author: William Carroll <wpcarro@gmail.com>
-;; Version: 0.0.1
-;; Package-Requires: ((emacs "24"))
-
-;;; Commentary:
-;; Functions for working with randomness.  Some of this code is not as
-;; functional as I'd like from.
-
-;;; Code:
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Dependencies
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(require 'prelude)
-(require 'number)
-(require 'math)
-(require 'series)
-(require 'list)
-(require 'set)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Library
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun random-int (x)
-  "Return a random integer from 0 to `X'."
-  (random x))
-
-;; TODO: Make this work with sequences instead of lists.
-(defun random-choice (xs)
-  "Return a random element of `XS'."
-  (let ((ct (list-length xs)))
-    (list-get
-     (random-int ct)
-     xs)))
-
-(defun random-boolean? ()
-  "Randonly return t or nil."
-  (random-choice (list t nil)))
-
-;; TODO: This may not work if any of these generate numbers like 0, 1, etc.
-(defun random-uuid ()
-  "Return a generated UUID string."
-  (let ((eight  (number-dec (math-triangle-of-power :base 16 :power 8)))
-        (four   (number-dec (math-triangle-of-power :base 16 :power 4)))
-        (twelve (number-dec (math-triangle-of-power :base 16 :power 12))))
-    (format "%x-%x-%x-%x-%x"
-            (random-int eight)
-            (random-int four)
-            (random-int four)
-            (random-int four)
-            (random-int twelve))))
-
-(defun random-token (length)
-  "Return a randomly generated hexadecimal string of LENGTH."
-  (->> (series/range 0 (number-dec length))
-       (list-map (lambda (_) (format "%x" (random-int 15))))
-       (list-join "")))
-
-;; TODO: Support random-sample
-;; (defun random-sample (n xs)
-;;   "Return a randomly sample of list XS of size N."
-;;   (prelude-assert (and (>= n 0) (< n (list-length xs))))
-;;   (cl-labels ((do-sample
-;;                (n xs y ys)
-;;                (if (= n (set-count ys))
-;;                    (->> ys
-;;                         set-to-list
-;;                         (list-map (lambda (i)
-;;                                     (list-get i xs))))
-;;                  (if (set-contains? y ys)
-;;                      (do-sample n xs (random-int (list-length xs)) ys)
-;;                    (do-sample n xs y (set-add y ys))))))
-;;     (do-sample n xs (random-int (list-length xs)) (set-new))))
-
-(provide 'random)
-;;; random.el ends here