Created
July 11, 2014 13:18
-
-
Save stibear/02b9e59380bed6ce5da2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-1) | |
(define acgt '(#\a #\c #\g #\t)) | |
(define (create n) | |
(map list->string | |
(let loop ((n n)) | |
(if (zero? n) | |
(list '()) | |
(append-map | |
(lambda (x) | |
(map (lambda (y) (cons x y)) | |
(loop (- n 1)))) | |
acgt))))) | |
(define (solve lst) | |
(filter (lambda (str) (string-scan str "aag")) | |
lst)) | |
(solve (create 4)) | |
;=> ("aaag" "aaga" "aagc" "aagg" "aagt" "caag" "gaag" "taag") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment