Brachylog
Brachylog copied to clipboard
Feature requests (constantly updating)
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
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] .
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.