<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi,</p>
<p><br>
</p>
<p>I have the following piece of code, which works correctly:</p>
<p><br>
</p>
<p> ConvertFun = fun({X, Y}) -> {[{<<"address">>,<br>
list_to_binary(inet:ntoa(X))}, {<<"stat">>, Y}]} end,<br>
ScanConverted = lists:map(ConvertFun, Results),<br>
</p>
<p><br>
</p>
<p>The reason for this very specific mapping is to convert it into exactly the format jiffy expects (in order to generate the correct JSON). I've been experimenting with rewriting this as a list comprehension (largely as a learning exercise).</p>
<p><br>
</p>
<p>Code like this fails to compile:</p>
<p><br>
</p>
<p> ScanConverted = [[{<<"address">>, list_to_binary(inet:ntoa(X))},<br>
{<<"stat">>, Y}]| {X, Y} <- Results]</p>
<p><br>
</p>
<p>src/ipmangle.erl:31: syntax error before: '<-'</p>
<p><br>
</p>
<p>Any pointers on this would be appreciated.<br>
</p>
</div>
</body>
</html>