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

interval_arithmetic enhacements #3

Open
mlliarm opened this issue Nov 8, 2020 · 5 comments
Open

interval_arithmetic enhacements #3

mlliarm opened this issue Nov 8, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@mlliarm
Copy link
Owner

mlliarm commented Nov 8, 2020

The enhacements of interval_arithmetic implementation.

@mlliarm mlliarm added enhancement New feature or request help wanted Extra attention is needed labels Nov 8, 2020
mlliarm added a commit that referenced this issue Nov 8, 2020
mlliarm added a commit that referenced this issue Nov 8, 2020
@mlliarm
Copy link
Owner Author

mlliarm commented Nov 8, 2020

Implemented mid, wid, abs predicates for an interval X = [Xa, Xb].

mlliarm added a commit that referenced this issue Nov 9, 2020
mlliarm added a commit that referenced this issue Nov 9, 2020
@mlliarm mlliarm removed the help wanted Extra attention is needed label Nov 10, 2020
@mlliarm mlliarm self-assigned this Nov 10, 2020
@mlliarm
Copy link
Owner Author

mlliarm commented Nov 10, 2020

Wanted to replace my way of finding the min and the max of those numbers in the mul/3 predicate, by using min_list and max_list (see [1], [2]) from SWI-Prolog.

Didn't use them though because I was getting some warnings that min_list wasn't defined:

Unknown predicate called but not defined: min_list/2
*       while compiling object interval_arithmetic
*       in file /home/milia/Documents/dev/logtalk/ia/interval_arithmetic.lgt between lines 23-28
*     Calls to unknown and undefined predicates generate a runtime error.
*     Misspelt predicate name? Wrong number of arguments?
*     
*     Unknown predicate called but not defined: min_list/2
*       while compiling object interval_arithmetic
*       in file /home/milia/Documents/dev/logtalk/ia/interval_arithmetic.lgt between lines 23-28
*     Calls to unknown and undefined predicates generate a runtime error.
*     Misspelt predicate name? Wrong number of arguments?

Also, since these predicates are defined in SWI-Prolog, my library could turn out not to be portable to other Prologs out there.

So, sticking with the old dirty way of finding the min(a,b,c,d): min(min(a,b), min(c,d)). Same for max.

@pmoura
Copy link
Collaborator

pmoura commented Nov 10, 2020

Use the Logtalk library instead. That will give you the same functionality but in a portable way. See https://logtalk.org/library/numberlistp_0.html

@pmoura
Copy link
Collaborator

pmoura commented Nov 10, 2020

Note that min_list/2 and max_list/2 are library predicates (which you're not importing into the object), not built-in predicates (which would be recognized by the Logtalk compiler as always available).

@mlliarm
Copy link
Owner Author

mlliarm commented Nov 11, 2020

Thanks Paulo ! I'll use the built-in Logtalk library then !

mlliarm added a commit that referenced this issue Nov 11, 2020
mlliarm added a commit that referenced this issue Nov 11, 2020
mlliarm added a commit that referenced this issue Nov 14, 2020
mlliarm added a commit that referenced this issue Nov 14, 2020
mlliarm added a commit that referenced this issue Nov 15, 2020
mlliarm added a commit that referenced this issue Nov 15, 2020
mlliarm added a commit that referenced this issue Nov 15, 2020
mlliarm added a commit that referenced this issue Dec 19, 2020
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