src/problems/prob.lisp @ 93ba483d9bc9

Move function
author Steve Losh <steve@stevelosh.com>
date Sun, 25 Aug 2019 22:59:19 -0400
parents 474d88a2af2e
children 2735aa6aab79
(in-package :rosalind)

(defparameter *input-prob*
  "ACGATACAA
0.129 0.287 0.423 0.476 0.641 0.742 0.783")

(defparameter *output-prob*
  "-5.737 -5.217 -5.263 -5.360 -5.958 -6.628 -7.009")


(define-problem prob (data stream)
    *input-prob*
    *output-prob*
  (let ((dna (read-line data))
        (gc-contents (read-all-from-string (read-line data))))
    (flet
        ((prob (gc-content)
           (iterate
             (for base :in-string dna)
             (summing (log (base-probability gc-content base) 10)))))
      (float-string (mapcar #'prob gc-contents)))))