This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

## 2016-04-06

## Channels

- # admin-announcements (17)
- # beginners (78)
- # boot (162)
- # braid-chat (2)
- # cider (20)
- # cljs-dev (9)
- # cljsjs (41)
- # cljsrn (17)
- # clojure (98)
- # clojure-austin (5)
- # clojure-brasil (1)
- # clojure-dusseldorf (1)
- # clojure-greece (1)
- # clojure-ireland (2)
- # clojure-italy (1)
- # clojure-japan (5)
- # clojure-russia (128)
- # clojure-uk (2)
- # clojurescript (29)
- # core-async (1)
- # core-logic (7)
- # css (1)
- # cursive (12)
- # datomic (18)
- # devcards (1)
- # dirac (6)
- # emacs (31)
- # funcool (28)
- # hoplon (208)
- # jaunt (66)
- # jobs (1)
- # juxt (6)
- # lein-figwheel (14)
- # off-topic (9)
- # om (83)
- # om-next (6)
- # onyx (63)
- # overtone (1)
- # parinfer (2)
- # protorepl (23)
- # re-frame (27)
- # reagent (14)
- # ring-swagger (8)
- # slack-help (2)
- # spacemacs (1)
- # untangled (56)

How can I get all multiples of3 in range 50 using `core.logic`

? This is all I've got:

```
(run* [q]
(membero q (range 50))
(conde
[(== (mod q 3) 0)]))
```

I get the error ` clojure.core.logic.LVar cannot be cast to java.lang.Number`

@josh.freckleton: the thing is, core.logic doesn't have its own notion of names, so when you see 'q' there what you are seeing is a clojure name 'q' which is bound to an lvar. mod of course is a clojure function which has no idea what to do with an lvar. the only meaningful operations on lvars are constraints (via unification or something else). for numeric stuff often what you want can be achieved using https://github.com/clojure/core.logic/wiki/Features#clpfd

@hiredman: thanks, I'm spending some time with "the reasoned schemer", and some of this is starting to become clear, thanks for your help!

can I ask another question? I'm trying to sum up all multiples of 3 and 5, and I've got everything working except I can't connect the `sumo`

to the list of multiples of 3/5:

```
(defnc divxc [x y] ; is it divisible?
(zero? (mod x y)))
(defn sumo [x out] ; sum up a list
(conde
((emptyo x) (== out 0))
(s# (fresh [f r rs]
(firsto x f)
(resto x r)
(sumo r rs)
(fd/+ f rs out)))))
(defn mult35o [x] ; list of things divisible by 3 or 5
(fresh [a]
(fd/in a (fd/interval 1 50))
(fd/distinct [a])
(conde
((divxc a 3))
((divxc a 5)))
(== x a)))
(run* [x] ; test
(mult35o x))
(run* [x] ; test
(sumo [1 2 3 4] x))
(run* [x]
(fresh [a b]
(mult35o a)
(firsto a b)
(sumo b x)))
```

it seems that `a`

is getting assigned something like `((3 5 ...))`

, so I try to "unpack" it with `firsto`

, but in the end this doesn't work...