dusa icon indicating copy to clipboard operation
dusa copied to clipboard

Operations on sequences

Open robsimmons opened this issue 1 year ago • 0 comments

SEQ_CONCAT (n-ary)

concat [[a], [b], c] [d] [e, f] is [[a], [b], c, d, e, f]

Can be run backwards as long as there's only one free variable (prefix/postfix matching)

SEQ_FLATTEN (1-ary)

flatten [[a], [[[[b]]]], c] is [a, b, c]

Can't be run backwards

SEQ_INDEX (2-ary)

index [a, b, c, d] 2 is c

can be run backwards in mode + - is -, which gives the set interpretation of a sequence.

a X :- index [1, 8, 21, 8] _ is X
b X Y :- index [1, 8, 21, 8] X is Y

Means we derive a 1, a 8, a 21 and b 0 1, b 1 8, b 2 21, b 3 8.

SEQ_UPDATE (3-ary)... maybe spin this off to a separate ticket?

update [a,b,c,d] 2 e is [a, b, e, d]

robsimmons avatar Jun 13 '24 17:06 robsimmons