为什么这不管用?我想不出这点。似乎与字符串的匹配方式有关。我一直收到一个错误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".
发布于 2016-03-09 08:48:44
字符串元素的类型是char,而不是string。
to_rna_nucleotide($G) -> $C;
to_rna_nucleotide($C) -> $G;
to_rna_nucleotide($T) -> $A;
to_rna_nucleotide($A) -> $U.
https://stackoverflow.com/questions/35884533
复制相似问题