[Libguestfs] [PATCH v3 4/8] mllib: Add some imperative list manipulation functions.

Pino Toscano ptoscano at redhat.com
Thu Jul 7 17:00:46 UTC 2016


On Thursday 07 July 2016 17:30:03 Richard W.M. Jones wrote:
> This adds imperative list manipulation functions inspired by Perl.
> The functions are passed list refs which get updated in place.
> 
> This allows us to replace some awkward pure functional code like:
> 
>   let xs = ys in
>   let xs = if foo then xs @ zs else xs in
> 
> with:
> 
>   let xs = ref ys in
>   if foo then append xs zs;
> ---

TBH I've always found the "shift" and "unshift" naming of Perl
functions slightly awkward, but can live with them. (At least the
new functions do the same as Perl ones.)

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160707/5c028470/attachment.sig>


More information about the Libguestfs mailing list