Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Metaprogramming/Nim/metaprogramming-8.nim
Normal file
15
Task/Metaprogramming/Nim/metaprogramming-8.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
template optLog1{a and a}(a): auto = a
|
||||
template optLog2{a and (b or (not b))}(a,b): auto = a
|
||||
template optLog3{a and not a}(a: int): auto = 0
|
||||
|
||||
var
|
||||
x = 12
|
||||
s = x and x
|
||||
# Hint: optLog1(x) --> ’x’ [Pattern]
|
||||
|
||||
r = (x and x) and ((s or s) or (not (s or s)))
|
||||
# Hint: optLog2(x and x, s or s) --> ’x and x’ [Pattern]
|
||||
# Hint: optLog1(x) --> ’x’ [Pattern]
|
||||
|
||||
q = (s and not x) and not (s and not x)
|
||||
# Hint: optLog3(s and not x) --> ’0’ [Pattern]
|
||||
Loading…
Add table
Add a link
Reference in a new issue