<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; } @font-face { font-family: Calibri; } p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; } a:link, span.MsoHyperlink { color: blue; text-decoration: underline; } a:visited, span.MsoHyperlinkFollowed { color: purple; text-decoration: underline; } p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph { margin: 0cm 0cm 0.0001pt 36pt; font-size: 11pt; font-family: Calibri, sans-serif; } span.E-MailFormatvorlage17 { font-family: Calibri, sans-serif; color: windowtext; } .MsoChpDefault { } @page WordSection1 { margin: 70.85pt 70.85pt 2cm; } div.WordSection1 { } ol { margin-bottom: 0cm; } ul { margin-bottom: 0cm; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>There is a new pull request for an "do iterate(...)" bind: <a href="https://github.com/LibreCat/Catmandu/pull/308">https://github.com/LibreCat/Catmandu/pull/308</a>​<br>
</p>
<p><br>
</p>
<p>As for the dynamic path manipulation. There is already some work in that direction from Nicolas, but it is very tricky.<br>
</p>
<p><br>
</p>
<p>To make the documentation much better, I am all for that. But of course this is a joint effort from us all :)<br>
</p>
<p><br>
</p>
<p>Patrick<br>
</p>
<p><br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> librecat-dev-bounces@lists.uni-bielefeld.de <librecat-dev-bounces@lists.uni-bielefeld.de> on behalf of Klee, Carsten <Carsten.Klee@sbb.spk-berlin.de><br>
<b>Sent:</b> Monday, May 22, 2017 12:07 PM<br>
<b>To:</b> librecat-dev@lists.uni-bielefeld.de<br>
<b>Subject:</b> [librecat-dev] Things I'm missing in the Fix language</font>
<div> </div>
</div>
<div>
<div class="WordSection1">
<p class="MsoNormal">Hi everyone!</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">I know the fix language is not a programming language. But there are a few things I’m missing, which could make the fix language more usable and prevent from the costs of the creation of custom fix functions…
</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I’m missing some kind of integer iteration. In MARC records for instance, we have enumeration and sequences. Therefore a integer iteration could help to do something like</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">marc_spec(363$8/0, my.sequal)</span></p>
<p class="MsoNormal"><span lang="EN-US">do iterate(start:1, end:10, method:++, offset:1, var:i)</span></p>
<p class="MsoNormal"><span lang="EN-US">  if all_match(my.sequal, i)</span></p>
<p class="MsoNormal"><span lang="EN-US">    #…</span></p>
<p class="MsoNormal"><span lang="EN-US">  end</span></p>
<p class="MsoNormal"><span lang="EN-US">end </span></p>
<p class="MsoNormal"><span lang="EN-US">       </span></p>
<p class="MsoNormal"><span lang="EN-US">Another thing I’m missing is some kind of dynamic path manipulation. For instance I have some values within my data, which I want to be a new key:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">got:</span></p>
<p class="MsoNormal"><span lang="EN-US">my.value = ‘dc_identifier’</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">now want:</span></p>
<p class="MsoNormal"><span lang="EN-US">my.dc_identifier = ‘some val’</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I’d tried to write a fix for that like:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">value_as_key(my.value, ‘some val’)</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">But with the emit* functions I found this not trivial. And I ask myself if this functionality could be implemented in the fix language itself.
</span>Something like </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-US">set_field(my.{{my.value}}, ‘some val’)</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">would be great.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">And about the documentation of the fix functions: the Cheat Sheet is a central starting point when looking for fix functions. There should be  provided links to the PODs. Not everyone is familiar with the module/namespace/documentation
 system on CPAN or MetaCPAN. For instance in the cheat sheet I read</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">count("myarray")       # count number of elements in an array or hash</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">And this is not very helpful and I have to know, that I have to google for ‘catmandu fix count’ to finally  get to
<a href="https://metacpan.org/pod/Catmandu::Fix::count">https://metacpan.org/pod/Catmandu::Fix::count</a>.
</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Maybe all this is material for a discussion at a Catmandu workshop/meeting. Do you plan to have one in the near future?</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="">Cheers!</span></p>
<p class="MsoNormal"><span style=""> </span></p>
<p class="MsoNormal"><span style="">Carsten<b></b></span></p>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</body>
</html>