src/problems/lexf.lisp @ e3aefcbf364c
Cache Uniprot results on the filesystem
This will make only the first `(run-tests)` on a given computer take forever,
instead of the first `(run-tests)` of a given Lisp session. It will also
hopefully make the Uniprot folks not hate me.
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 24 Jan 2020 23:05:16 -0500 |
parents |
2735aa6aab79 |
children |
(none) |
(defpackage :rosalind/lexf (:use :cl :rosalind :losh :iterate))
(in-package :rosalind/lexf)
(defparameter *input*
"A C G T
2")
(defparameter *output*
"AA
AC
AG
AT
CA
CC
CG
CT
GA
GC
GG
GT
TA
TC
TG
TT
")
(define-problem lexf (data stream) *input* *output*
(let* ((alphabet (sort (remove #\space (read-line data)) #'char<))
(n (read data))
(string (make-string n)))
(with-output-to-string (s)
(recursively ((n n)
(i 0))
(if (zerop n)
(progn (write-string string s)
(terpri s))
(map nil (lambda (ch)
(setf (aref string i) ch)
(recur (1- n) (1+ i)))
alphabet))))))