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

## 2020-01-27

## Channels

- # announcements (10)
- # aws (11)
- # beginners (158)
- # calva (8)
- # cider (14)
- # clj-kondo (1)
- # cljsrn (1)
- # clojure (83)
- # clojure-europe (5)
- # clojure-italy (25)
- # clojure-nl (3)
- # clojure-spec (12)
- # clojure-uk (20)
- # clojurescript (72)
- # community-development (18)
- # core-async (4)
- # core-logic (19)
- # cursive (11)
- # datomic (21)
- # duct (6)
- # events (1)
- # figwheel-main (3)
- # fulcro (15)
- # ghostwheel (1)
- # jobs (1)
- # leiningen (16)
- # off-topic (45)
- # onyx (3)
- # pathom (7)
- # perun (1)
- # ring (3)
- # shadow-cljs (48)
- # spacemacs (10)
- # specter (1)
- # sql (24)
- # tools-deps (7)
- # vscode (7)
- # xtdb (14)

hi, I'm having some trouble with core.logic and function arities. I'm going through the reasoned schemer to learn and I've been trying to write some of my own relations as exercises. I wrote a simple implementation of `concat`

which worked fine, and I tried to convert it to a relation:

```
(defn dumb-concat [x y]
(cond
(empty? y) x
(empty? x) y
:else (recur (conj x (first y)) (rest y))))
(defn dumb-concato [x y out]
(l/conde
[(l/emptyo y) (l/== out x)]
[(l/emptyo x) (l/== out y)]
[l/succeed (l/fresh [f r c]
(l/conso f r y)
(l/conjo x f c)
(dumb-concato c r)
)]))
```

however, when I try and test this with `(l/run 1 [q] (dumb-concato [0 1 2 3] [5 4 3] q))`

it just says `Wrong number of args (2) passed to: logic-practice.core/dumb-concato`

`(dumb-concato c r)`

^ That line looks like the error to me.

Dum-concato is just a regular function, not a core.logic relation, so you can't use it like that

What exactly a core.logic relation is kind of complicated, but a recursive definition would be something like, a core.logic relation is a function whose body is composed of core.logic relations

So dumb-concato would be a relation if it didn't call dumb-concat, but the body of dumb-concat is all non-relations (it is all functions from clojure.core)

The kind of problem you get with calling clojure.core functions in a logic program is they don't know how to deal with logic variables