8000 GitHub - wookay/LogicalOperators.jl · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

47 Commits

Folders and files

Repository files navigation

LogicalOperators 🧩

Documentation Build Status

This is a Julia package that handles general logical operators.

@logic

To help understanding the bitwise (&, |), short-circuiting booleans (&&, ||).

julia> using LogicalOperators

julia> @logic 3 & 10
   0b0011    3
 & 0b1010   10
   0b0010    2

694C
2

julia> @logic 10 | 7
   0b1010   10
 | 0b0111    7
   0b1111   15
15

julia> @logic 3 & 10 | 7
   0b0011    3
 & 0b1010   10
   0b0010    2
 | 0b0111    7
   0b0111    7
7

julia> @logic 3 & (10 | 7)
   0b1010   10
 | 0b0111    7
   0b1111   15
   0b0011    3
 & 0b1111   15
   0b0011    3
3
julia> using LogicalOperators

julia> using Hexagrams.八卦

julia> @logic ⊻(乾, 坤)
   0b111 乾
 ⊻ 0b000 坤
   0b111 乾
卦(0x07)
julia> using LogicalOperators

julia> x = 3;

julia> @logic x > 1
x > 1
true

julia> @logic x < 1 || x > 10 && x isa Int
x < 1 || x > 10 && x isa Int
false

short-circuiting_booleans.png

Slots

Data structures similar to a Vector.

julia> using LogicalOperators: AND, OR, XOR, NOT, ∧, ∨, ⊕, ¬

julia> AND(1, 2) == 1 ∧ 2
true

julia> OR{Int}(1, 2, 3) == 1 ∨ 2 ∨ 3
true

julia> NOT(true) == ¬true
true

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0