src/problems/subs.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 86d92162dc1f
(defpackage :rosalind/subs (:use :cl :rosalind :losh :iterate))
(in-package :rosalind/subs)

(defparameter *input* "GATATATGCATATACTT
ATAT")

(defparameter *output* "2 4 10")


(define-problem subs (data stream) *input* *output*
  (let ((haystack (read-line data))
        (needle (read-line data)))
    (iterate
      (for pos :seed -1 :then (search needle haystack :start2 (1+ pos)))
      (while pos)
      (collect (1+ pos) :into result)
      (finally (return (str:join " " result))))))