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

feature: Range builtin #599

Open
Laschoking opened this issue Jan 22, 2025 · 1 comment
Open

feature: Range builtin #599

Laschoking opened this issue Jan 22, 2025 · 1 comment

Comments

@Laschoking
Copy link
Collaborator

The range built-in can offer a comfortable way to generate facts.
It should process 3 arguments min, max, step_size
For example:

A(range(1, 5, 0.5)).
B(range(1, 5, 0.5), range(1, 5, 1)).
@mkroetzsch
Copy link
Member

So far, we only discussed that a built-in body predicate would be nice for this, as in

A(?X) :- IN_RANGE(?X,1,5,0.5) .
B(?X,?Y) :- IN_RANGE(?X,1,5,0.5), IN_RANGE(?Y,1,5,1) .

Whether syntactic sugar for this should be added and how this should look remains unclear. The original proposal would introduce a "special" fact format that cannot be interpreted according to the normal rules. It would be a bit like an inverse aggregation, where one fact-like statement expands into many facts. In this situation range would not be a built-in function, but rather the whole special format of range inside facts would get a different meaning from the usual "fact with a computed value of a function in some of its parameters".

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

No branches or pull requests

2 participants