Skip to content
loading...

re: Daily Challenge #212 - DNA to RNA VIEW POST

FULL DISCUSSION
 

Super simple! I love the polyglot answers 👌🏿
Clojure

(ns dailyChallenge.206)

(def- NUCLEOTIDES
  "Valid Nucleotides"
  (re-pattern "G|C|T|A|U"))

(defn DNA->RNA [sequence] 
  "validates and converts DNA pairs to RNA"
 {:pre [(!= "" (re-match NUCLEOTIDES (uppercase sequence))]}
  ;;Java.String method interop
  (.toUpperCase (replace sequence #"t|T" "u")))
code of conduct - report abuse