<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>how to quelch lc warnings?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>
<P><FONT SIZE=2 FACE="Arial">Apologies for the silly example, but imagine I want to do this:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Eshell V5.5.3.1 (abort with ^G)</FONT>
<BR><FONT SIZE=2 FACE="Arial">1> Nums = [1,2,3], Nouns = [shoe,box,tape], Verbs = [].</FONT>
<BR><FONT SIZE=2 FACE="Arial">[]</FONT>
<BR><FONT SIZE=2 FACE="Arial">2> [Nums || Nums =/= []] ++ [Nouns || Nouns =/= []] ++ [Verbs || Verbs =/= []].</FONT>
<BR><FONT SIZE=2 FACE="Arial">[[1,2,3],[shoe,box,tape]]</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I have a more complex example, where I'm actually doing something useful,</FONT>
<BR><FONT SIZE=2 FACE="Arial">involving a long property list, from which I generate code. I output comments</FONT>
<BR><FONT SIZE=2 FACE="Arial">and code given that there is actually something to output in a given category.</FONT>
<BR><FONT SIZE=2 FACE="Arial">Using LCs makes for quite compact expressions:</FONT>
</P>
<P> <A HREF="file:write(Fd"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">file:write(Fd</FONT></U></A><FONT SIZE=2 FACE="Arial">, hrl_boilerplate(File, Terms)),</FONT>
<BR> <FONT SIZE=2 FACE="Arial">[</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> [</FONT><A HREF="file:write"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">file:write</FONT></U></A><FONT SIZE=2 FACE="Arial">(</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> Fd,</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> ("\n\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% -------------------------------------------------------\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% X records:\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% -------------------------------------------------------\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> )),</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> io:fwrite(Fd, "~s~n", [erl_prettypr:format(</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> erl_syntax:form_list(XForms))])</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> ] || XForms =/= []],</FONT>
<BR> <FONT SIZE=2 FACE="Arial">[</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> [</FONT><A HREF="file:write"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">file:write</FONT></U></A><FONT SIZE=2 FACE="Arial">(</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> Fd,</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> ("\n\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% -------------------------------------------------------\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% Imported records from " ++ atom_to_list(Mod) ++ ":\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% -------------------------------------------------------\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> )),</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> io:fwrite(Fd, "~s~n", [erl_prettypr:format(</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> erl_syntax:form_list(XForms1))])</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> ] || {Mod, XForms1} <- ImportedXForms],</FONT>
<BR> <FONT SIZE=2 FACE="Arial">[</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> [</FONT><A HREF="file:write"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">file:write</FONT></U></A><FONT SIZE=2 FACE="Arial">(</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> Fd,</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> ("\n\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% -------------------------------------------------------\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% Y Macros:\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> "%%% -------------------------------------------------------\n"</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> )),</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> </FONT><A HREF="file:write(Fd"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">file:write(Fd</FONT></U></A><FONT SIZE=2 FACE="Arial">, gen_y_macros(Terms, Prefix))</FONT>
<BR> <FONT SIZE=2 FACE="Arial"> ] || Y =/= []],</FONT>
<BR><FONT SIZE=2 FACE="Arial"> ...</FONT>
<BR><FONT SIZE=2 FACE="Arial">where I don't have to output boilerplate comments for empty </FONT>
<BR><FONT SIZE=2 FACE="Arial">sections. There are of course other ways to do it, but I find this</FONT>
<BR><FONT SIZE=2 FACE="Arial">layout appealing (blame Thomas Arts and John Hughes for </FONT>
<BR><FONT SIZE=2 FACE="Arial">putting me onto it).</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">The only problem I see with this is that the compiler will issue warnings</FONT>
<BR><FONT SIZE=2 FACE="Arial">such as </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">./codegen.erl:480: Warning: list comprehension has no generator (perhaps "|" mistyped as "||"?)</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Apparently, I can't tell the compiler that this is in fact not a typo.</FONT>
<BR><FONT SIZE=2 FACE="Arial">Any plans to introduce such an option?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">BR,</FONT>
<BR><FONT SIZE=2 FACE="Arial">Ulf W</FONT>
</P>
</BODY>
</HTML>