src/problems/iev.lisp @ 7fcd748a4f00

LCSQ, PRSM
author Steve Losh <steve@stevelosh.com>
date Mon, 08 Aug 2022 19:00:58 -0400
parents 2735aa6aab79
children (none)
(defpackage :rosalind/iev (:use :cl :rosalind :losh :iterate))
(in-package :rosalind/iev)

(define-problem iev (data stream)
    "1 0 0 1 0 1"
    "3.5000"
  (let* ((dd (read data))
         (dh (read data))
         (dr (read data))
         (hh (read data))
         (hr (read data))
         (rr (read data)))
    (u:float-string
      ;; It's just a weighted averageā€¦
      (* 2 (+ (* dd 1)
              (* dh 1)
              (* dr 1)
              (* hh 3/4)
              (* hr 1/2)
              (* rr 0)))
      4)))