# Where to find the correct syntax for #lang racklog?

**URL:** https://racket.discourse.group/t/where-to-find-the-correct-syntax-for-lang-racklog/3759
**Category:** Questions & Answers
**Created:** [May 24, 2025, 5:55pm UTC](https://racket.discourse.group/t/where-to-find-the-correct-syntax-for-lang-racklog/3759 "2025-05-24T17:55:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![UserX](https://avatars.discourse-cdn.com/v4/letter/u/c5a1d2/32.png) [@UserX](https://racket.discourse.group/u/UserX)
#### Post date: [May 24, 2025, 5:55pm UTC](https://racket.discourse.group/t/where-to-find-the-correct-syntax-for-lang-racklog/3759/1 "2025-05-24T17:55:18Z")

</div>

It appears that either I'm doing something blatantly stupid or` #lang racklog` documentation misses some points.

Here the question.

According to the documentation

> This module language accepts the syntax of Datalog (except clauses need not be safe) and compiles each predicate to a relation.

> The accepted syntax is available in the [Datalog Module Language](https://docs.racket-lang.org/datalog/datalog.html) documentation.

Then, trying to run the example given in datalog, simply swapping "racklog" in place of "datalog"

```scheme
#lang racklog

(racket/base). % here the parenthesis are not required, correct is racket/base. I remove those but then...

fib(0, 0). % from here onward, numbers are not recognized

fib(1, 1).

fib(N, F) :- N != 1,

N != 0,

N1 :- -(N, 1),

N2 :- -(N, 2),

fib(N1, F1),

fib(N2, F2),

F :- +(F1, F2).

fib(30, F)?

```

Specifically, the message of error regarding the first number is  
match-lambda: no matching clause for '#s(constant (14-unsaved-editor 6 4 39 1) 0)

The example works in #lang datalog (which should be a subset of #lang racklog)

---

<div class="post-metadata">

### Author: ![greghendershott](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/greghendershott/32/98_2.png) [@greghendershott](https://racket.discourse.group/u/greghendershott)
#### Post date: [May 25, 2025, 6:00pm UTC](https://racket.discourse.group/t/where-to-find-the-correct-syntax-for-lang-racklog/3759/2 "2025-05-25T18:00:40Z")

</div>

Although I'm not sure how actively the `racklog` package is maintained, it looks like its repo's issues page is [here](https://github.com/racket/racklog/issues), if you wanted to ask there.

---

<div class="post-metadata">

### Author: ![UserX](https://avatars.discourse-cdn.com/v4/letter/u/c5a1d2/32.png) [@UserX](https://racket.discourse.group/u/UserX)
#### Post date: [May 26, 2025, 12:50am UTC](https://racket.discourse.group/t/where-to-find-the-correct-syntax-for-lang-racklog/3759/3 "2025-05-26T00:50:38Z")

</div>

Thanks, but I think that, yes, the problem is that the package is bugged, at least for the parser for the pure #lang racklog (maybe the module to use inside #lang racket works, instead).

Thanks for your time. 🙂

I wrote a comment on reddit, just now, I copy it here, to close the question.

> Eventually I think that simply the part of the code which should read the pure `#lang racklog` has been neglected and doesn't work.
> 
> For example, going on I discovered that while
> 
> > `fib(0, 0).`
> 
> > `fib(1, 1).`
> 
> gave errors, nstead this
> 
> > `fib(+0, +0).`
> 
> > `fib(+1, +1).`
> 
> didn't.
> 
> But then, again, for the rest of the code this trick doesn't work.
> 
> Probably the mantainer was more interested to have it to work inside `#lang racket` and not as a language in itself (which after all makes sense, since Prolog is a thing).

---

<div class="post-metadata">

### Author: ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)
#### Post date: [May 26, 2025, 9:44am UTC](https://racket.discourse.group/t/where-to-find-the-correct-syntax-for-lang-racklog/3759/4 "2025-05-26T09:44:27Z")

</div>

The syntax is the same. The semantics are different.  
The problem is that bindings from `racket/base` overrides what `racklog` expects.  
This leads to the curious errors you see.

It may or may not have been an oversight.  
The examples in the repo uses:

```scheme
#lang racket
(require racklog)
<normal s-expression syntax here>

```

Having the imports this way, the racklog definitions override the ones from `#lang racket`.

See for example:

> <https://github.com/racket/racklog/blob/master/tests/houses.rkt>

But if you want to use the Datalog syntax, make a helper file, say, "helper.rkt"  
that only exports `+` and `-` from `racket/base` and import that.
