Skip to content

Instantly share code, notes, and snippets.

@lispm
Created April 23, 2017 18:08
Show Gist options
  • Save lispm/1d9543046a9ad327d1707ce9deec87bf to your computer and use it in GitHub Desktop.
Save lispm/1d9543046a9ad327d1707ce9deec87bf to your computer and use it in GitHub Desktop.
(define-condition invalid-nucleotide-error (error)
((nucleotide :initarg :nucleotide)))
(defvar *nuc-table*
'((#\G . #\C) (#\C . #\G) (#\T . #\A) (#\A . #\U)))
(defun transcribe (nucleotide)
(or (cdr (assoc nucleotide *nuc-table*))
(error 'invalid-nucleotide-error :nucleotide nucleotide)))
(defun to-rna (string)
(map 'string #'transcribe string))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment