Brachylog icon indicating copy to clipboard operation
Brachylog copied to clipboard

Feature requests (constantly updating)

Open kckennylau opened this issue 8 years ago • 2 comments

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

kckennylau avatar Aug 11 '16 16:08 kckennylau

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] .

triska avatar Aug 11 '16 20:08 triska

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.

kckennylau avatar Aug 12 '16 07:08 kckennylau