为什么这不起作用?无法弄清楚这一点.似乎是字符串匹配方式的东西.我一直在收到错误error:function_clause.
-module(rna_transcription).
-export([to_rna/1, to_rna_nucleotide/1]).
to_rna(DNA) -> lists:map(fun to_rna_nucleotide/1, DNA).
to_rna_nucleotide("G") -> "C";
to_rna_nucleotide("C") -> "G";
to_rna_nucleotide("T") -> "A";
to_rna_nucleotide("A") -> "U".
Run Code Online (Sandbox Code Playgroud)
小智 5
string的元素是char类型,而不是string.
to_rna_nucleotide($G) -> $C;
to_rna_nucleotide($C) -> $G;
to_rna_nucleotide($T) -> $A;
to_rna_nucleotide($A) -> $U.
Run Code Online (Sandbox Code Playgroud)