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

Re-implement add_n/3 #27

Open
mlliarm opened this issue Jan 28, 2022 · 2 comments
Open

Re-implement add_n/3 #27

mlliarm opened this issue Jan 28, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@mlliarm
Copy link
Owner

mlliarm commented Jan 28, 2022

% add_n/3, adds a number and an interval.

I think that maybe it'd be better to use add/3 adding the intervals i(N,N) and i(Xa,Xb) instead of rewriting the logic inside add_n/3.

How it could go like:

add_n(N, i(Xa, Xb), Sum) :- 
    add(i(N, N), i(Xa, Xb), Sum).

What do you think @pmoura ?

@mlliarm mlliarm added the enhancement New feature or request label Jan 28, 2022
@pmoura
Copy link
Collaborator

pmoura commented Jan 31, 2022

The idea of adding a number to an interval always sounded odd to me. Maybe mark the add_n/3 predicate as deprecated in the next version of the library?

@mlliarm
Copy link
Owner Author

mlliarm commented Jan 31, 2022

@pmoura

I haven't forgotten of your comment, I'm still thinking about it.

I remember seeing some examples where one could have added a number N (i.e. a degenerate interval i(N,N) ) to an interval i(M,L).

I'll have to look for that practical example(s) where such a thing could occur in applications.

You're probably right here, and this predicate could be flagged as deprecated in the next release as unnecessary; I'll have to do some more reading till then though, before agreeing with its removal.

Thanks for the suggestion!

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

No branches or pull requests

2 participants