loco
loco copied to clipboard
$or works differently than I expected
I've just started playing with loco
, but I've hit an immediate brick wall where $or
isn't behaving how I expected it to.
I'm trying to solve Project Euler problem 1, which is nice and easy with the for
macro:
(for [x (range 1 10)
:when (or (= 0 (mod x 3))
(= 0 (mod x 5)))]
x)
=> (3 5 6 9)
But my first attempt at a similar approach with loco
didn't work:
(solutions
[($in :x 1 9)
($or ($= 0 ($mod :x 3))
($= 0 ($mod :x 5)))])
=> ({:x 1} {:x 2} {:x 3} {:x 4} {:x 5} {:x 6} {:x 7} {:x 8} {:x 9})
I'm guessing that I've totally misunderstood how $or
should be used, so I'd really appreciate a prod in the right direction.
Thanks for your work on this cool project.
Cheers, James