64aa58880d55

EVAL
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 23 Feb 2019 12:42:13 -0500
parents 474d88a2af2e
children 93ba483d9bc9 c26fa4d063ba f94bcb404676
branches/tags (none)
files src/problems/eval.lisp

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/problems/eval.lisp	Sat Feb 23 12:42:13 2019 -0500
@@ -0,0 +1,20 @@
+(in-package :rosalind)
+
+(defparameter *input-eval* "10
+AG
+0.25 0.5 0.75")
+
+(defparameter *output-eval* "0.422 0.563 0.422")
+
+(define-problem eval (data stream)
+    *input-eval*
+    *output-eval*
+  (let* ((string-length (read data))
+         (substring (read-line data))
+         (gc-contents (read-all data))
+         (chances (- string-length (1- (length substring)))))
+    (float-string (mapcar (lambda (gc-content)
+                            (* chances (sequence-probability
+                                         (coerce gc-content 'double-float)
+                                         substring)))
+                          gc-contents))))