<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On 17 Sep 2019, at 01:44, Sam Overdorf <<a href="mailto:soverdor@gmail.com" class="">soverdor@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">How do I tell the difference between:<br class="">"sam1"<br class="">["sam1","sam2"]<br class="">They are both lists but behave differently when I apply<br class=""> [H|T] = List.<br class=""> H = "s"<br class=""> H = "sam1".<br class=""> The second one is what I want and then stop breaking them down.<br class=""><br class="">Weird problem...<br class=""><br class="">Thanks,<br class="">Sam<br class=""></div></div></blockquote><br class=""><div class="">I don’t think you could accomplish this without writing some additional code.</div><div class="">A naive example may be:</div><div class=""><br class=""></div><div class=""><span style="font-family: "Courier New";" class="">% ---------</span></div><div class=""><span style="font-family: "Courier New";" class="">% Normalize</span></div><div class=""><span style="font-family: "Courier New";" class="">% ---------</span></div><font face="Courier New" class=""><div>get_sam( [[E|L]|_] ) -> get_sam( L, [E] );</div></font><font face="Courier New" class=""><div>get_sam( [[]|T] ) -> get_sam( T );</div></font><font face="Courier New" class=""><div>get_sam( [E|L] ) -> get_sam( L, [E] ); </div><div>get_sam( _ ) -> throw( no_sam ).</div><div><br class=""></div><div>% --------------</div></font><font face="Courier New" class=""><div>% Accumulate SAM</div><div>% --------------</div></font><div class=""><font face="Courier New" class=""><div>get_sam( [E|L], Acc ) -> get_sam( L, [E|Acc] );</div><div>get_sam( [], Acc ) -> lists:reverse( Acc ).</div><div><br class=""></div></font></div><div class="">NOTE: Didn’t test it, but it should achieve what you’ve described.</div><div class=""><br class=""></div><div class="">Kind regards</div><div class=""><br class=""></div><div class="">V/</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""></blockquote></div></div></div><br class=""></body></html>