Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operations on sequences #38

Open
robsimmons opened this issue Jun 13, 2024 · 0 comments
Open

Operations on sequences #38

robsimmons opened this issue Jun 13, 2024 · 0 comments

Comments

@robsimmons
Copy link
Owner

robsimmons commented Jun 13, 2024

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant