fabriquer / fabrique

A build description language
Other
3 stars 1 forks source link

Slices #6

Open trombonehero opened 9 years ago

trombonehero commented 9 years ago

It would be very useful to be able to slice things like lists (er, arrays) and strings:

base_name = texfile_name[:-3];
aux = file(base_name + '.aux');
pdf = file(base_name + '.pdf');

accumulate = function(xs:list[int], op:(int,int)=>int, init:int)
    if xs.empty init else accumulate(xs[1:], op, xs[0] + init)
    ;

Note that the last bit would be greatly enhanced by #5 (generic programming)!

trombonehero commented 9 years ago

Of course, we could also get the same effect on the first example by providing fields à la Issue #7 ...

trombonehero commented 9 years ago

Since issue #7 is closed, maybe we can get away with just matching on head + the rest...