Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
Kisaragi Hiu
dotfiles
Commits
ed9483a7
Commit
ed9483a7
authored
Jan 28, 2018
by
Kisaragi Hiu
Browse files
Add common lisp version of random-string and add extension to the racket version
parent
f0cbc183
Changes
2
Hide whitespace changes
Inline
Side-by-side
random-string.cl
0 → 100755
View file @
ed9483a7
#
!/usr/bin/env
clisp
; vim: filetype=lisp
; random-string [length]
(
defvar
*charset*
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
)
(
defun
select-random-item
(
seq
)
(
elt
seq
(
random
(
length
seq
)
;; create a newly randomly seeded random state
(
make-random-state
t
))))
(
defun
random-string
(
&optional
(
len
16
))
(
map
'string
(
lambda
(
x
)
(
select-random-item
*charset*
))
(
make-string
len
)))
(
format
t
(
if
*args*
(
random-string
(
parse-integer
(
first
*args*
)))
(
random-string
)))
random-string
→
random-string
.rkt
View file @
ed9483a7
File moved
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment