[librecat-dev] Things I'm missing in the Fix language

Patrick Hochstenbach Patrick.Hochstenbach at UGent.be
Thu May 25 12:19:43 CEST 2017


There is a new pull request for an "do iterate(...)" bind: https://github.com/LibreCat/Catmandu/pull/308?


As for the dynamic path manipulation. There is already some work in that direction from Nicolas, but it is very tricky.


To make the documentation much better, I am all for that. But of course this is a joint effort from us all :)


Patrick


________________________________
From: librecat-dev-bounces at lists.uni-bielefeld.de <librecat-dev-bounces at lists.uni-bielefeld.de> on behalf of Klee, Carsten <Carsten.Klee at sbb.spk-berlin.de>
Sent: Monday, May 22, 2017 12:07 PM
To: librecat-dev at lists.uni-bielefeld.de
Subject: [librecat-dev] Things I'm missing in the Fix language

Hi everyone!

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...

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

marc_spec(363$8/0, my.sequal)
do iterate(start:1, end:10, method:++, offset:1, var:i)
  if all_match(my.sequal, i)
    #...
  end
end

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:

got:
my.value = 'dc_identifier'

now want:
my.dc_identifier = 'some val'

I'd tried to write a fix for that like:

value_as_key(my.value, 'some val')

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. Something like

set_field(my.{{my.value}}, 'some val')

would be great.

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

count("myarray")       # count number of elements in an array or hash

And this is not very helpful and I have to know, that I have to google for 'catmandu fix count' to finally  get to https://metacpan.org/pod/Catmandu::Fix::count.

Maybe all this is material for a discussion at a Catmandu workshop/meeting. Do you plan to have one in the near future?

Cheers!

Carsten

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20170525/fdf64e5b/attachment.html>


More information about the librecat-dev mailing list