diff options
author | Colin Okay <cbeok@protonmail.com> | 2020-08-04 18:46:41 -0500 |
---|---|---|
committer | Colin Okay <cbeok@protonmail.com> | 2020-08-04 18:46:41 -0500 |
commit | 08710ae637fcb28d5f1552a1e37c93857c6ca841 (patch) | |
tree | 7421858901de5ffb8ba8aacb94c9d41ec0d48040 /examples.lisp | |
parent | 83dcb72f6fa2527f48a1e64f15e1866bf674e7e4 (diff) |
removed experimental combinators
Diffstat (limited to 'examples.lisp')
-rw-r--r-- | examples.lisp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/examples.lisp b/examples.lisp index 0a40a0c..8760b8a 100644 --- a/examples.lisp +++ b/examples.lisp @@ -119,31 +119,3 @@ vector VEC, one at a time." -;;; Silly Scrambler ;;; - - -(defun pad (str len &optional (pad-char #\Space)) - (let ((i 0)) - (with-output-to-string (out) - (loop :for c :across str :do (incf i) (princ c out)) - (loop :while (< i len) :do (incf i) (princ pad-char out))))) - -(defun scramble (n str) - (assert (< n (length str))) - (let ((str (pad str (* n (ceiling (/ (length str) n)))))) - (apply #'concatenate 'string - (mapcar #'collect (disperse! n (seq str)))))) - - -(defun chunk (n str) - (assert (zerop (mod (length str) n))) - (let ((size (/ (length str) n))) - (loop - :for i :below (length str) :by size - :collect (subseq str i (+ i size)) ))) - -(defun descramble (n str) - (concatenate 'string - (collect - (apply #'intersperse! - (mapcar #'seq (chunk n str)))))) |