# Pattern matching in racklog / datalog

**URL:** https://racket.discourse.group/t/pattern-matching-in-racklog-datalog/2763
**Category:** General
**Created:** [March 5, 2024, 11:51am UTC](https://racket.discourse.group/t/pattern-matching-in-racklog-datalog/2763 "2024-03-05T11:51:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bremner](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@bremner](https://racket.discourse.group/u/bremner)
#### Post date: [March 5, 2024, 11:51am UTC](https://racket.discourse.group/t/pattern-matching-in-racklog-datalog/2763/1 "2024-03-05T11:51:58Z")

</div>

I was trying to port one of the prolog examples from plai [1](https://www.plai.org/3/2/PLAI%20Version%203.2.2%20electronic.pdf#page=181) into racklog  
but it seems that the "#lang datalog"/"#lang racklog" rules for a clause  
head are stricter. So in particular rules like

```scheme
tc(plusE(L, R), numT) :-
        tc(L, numT),
        tc(R, numT).

```

are rejected. I _think_ I can use unification in the the lispy syntax,  
but that doesn't match the book very well, and also seems like kindof a  
big hammer, given the `plait` version of the same code just uses  
deconstructive-binding (aka `type-case`).

Is there an idiomatic way to translate this kind of thing into "#lang  
racklog" ?
