Skip to content

Instantly share code, notes, and snippets.

@Dzol
Created December 13, 2015 20:41
Show Gist options
  • Save Dzol/08ac722726e66d9f27da to your computer and use it in GitHub Desktop.
Save Dzol/08ac722726e66d9f27da to your computer and use it in GitHub Desktop.
Response to "String Handling" - Erlang Central
-module(genetic).
-export([transcribe/1, test/0]).
transcribe(Sequence) when is_list(Sequence) ->
[t(X) || X <- Sequence].
t($G) -> $C;
t($C) -> $G;
t($T) -> $A;
t($A) -> $U.
test() ->
"ACUG" = transcribe("TGAC").

Compile with erl -compile genetic.erl then erl run genetic test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment