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 requests (constantly updating) #28

Open
kckennylau opened this issue Aug 11, 2016 · 2 comments
Open

Feature requests (constantly updating) #28

kckennylau opened this issue Aug 11, 2016 · 2 comments

Comments

@kckennylau
Copy link

kckennylau commented Aug 11, 2016

Predicates

  • Modpow (overload ^)
  • Bitwise operators (and, or, xor, not, left-shift, right-shift)
  • Power of 2
  • Power of 10
  • GCD
  • LCM
  • Split at character
  • Filter in (intersect), Filter out
  • Insert (. is second element of ? inserted into first element of ?)
  • Replace (. is first element of ? with all substring being second element of ? replaced with the third element of ?)

Metapredicates

Variables

@triska
Copy link
Contributor

triska commented Aug 11, 2016

all_equal/1 can be defined very generally, working for integers, constrained variables etc.:

all_equal([]).
all_equal([E|Es]) :- maplist(=(E), Es).

Example query:

?- all_equal(Xs).
Xs = [] ;
Xs = [_G774] ;
Xs = [_G774, _G774] ;
Xs = [_G774, _G774, _G774] ;
Xs = [_G774, _G774, _G774, _G774] .

@kckennylau
Copy link
Author

I could make use of @P to do the integer conversion, now a few bytes have been saved, but it would save much more bytes if we have a to/from base predicate.

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

No branches or pull requests

3 participants