if i have a file using #lang racklog can i require that into a #lang racket file and “use” it somehow ??
sort of define all the data and relations in racklog, then execute quireies from racket ?
In general it depends on the language. If racklog exports bindings you can import them using require as usual.
best way to find that out ?
just try it ?
Try it - but also study the docs of racklog.
okies, well it “worked” in that it didnt blow up and it ouput to the console the output of my existing query, no idea what new functions its introduced though, can i name the import/require and inspect it ?
You can use (require (only-in racklog a b c)to import only a, b and c.
You can also use(require (rename-in racklog [old new])` to rename an import in the importing module.
so there isnt an easy way to inspect what (require "data.logic.rkt") provided ?
Yes, you can use module->all-exported-names
Actually, module->exports is probably better.
brill thanks :smile:
okies. it exports bugger all lol :wink:
(module->exports "data.logic.rkt")
'((0 (ingredient ()) (name ()) (recipe ())))
'()
>
You can get the racklog primitives from the racklog module.
yeah i think i just came to an understanding …
that importing this sort of loaded up a global logic DB
so the racklog module functions should work on these facts now …
The docs doesn’t say much on #lang racklog …
no … its a shame …
im playing about with a recipe store / meal planner and id like to try and do some clever “automation” so storing all the info in a logic DB seemed like it might be a sensible aproach.
i also dont know if it would be possible to perist that DB again if i were to manipulate it after it was loaded though
Good question. There is got to be a solution for that.
I found the piece of code, that produces the exports of a module written in #lang racklog.
<https://github.com/racket/racklog/blob/master/lang/compiler.rkt#L16>
Your conclusion is spot on. All assertations are provided.
thanks :slightly_smiling_face: i notice your around a lot helping out, i (and i assume others) really do appreciate it :smile:
Thanks!