Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9218669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:55:03+00:00 2026-06-18T02:55:03+00:00

I have been enjoying Clojure core.logic but I have run into a wall. I

  • 0

I have been enjoying Clojure core.logic but I have run into a wall. I need to be able to have it use a database, either SQL or not, rather than an in memory data structure. As I have looked around I see mention of a to-stream function but no solid examples of its use.

Does anyone have a good example of using core.logic with a database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:55:04+00:00Added an answer on June 18, 2026 at 2:55 am

    As someone has already suggested in the comments look at the Datomic example in the core.logic repository. Based on the example there you could imagine writing something like this:

    (defn query [db query-string out]
      (fn [a]
        (to-stream
          (map (fn [result] (unify a out result))
            (db-query db query-string)))))
    

    All core.logic goals just return closures which take a substitution map a (you can of course call it whatever you like). Essentially you need to map over the results and unify them with out in a.

    Then you could imagine writing a core.logic program like the following:

    (run* [q]
      (fresh [row]
        (query some-db "... some query string ..." row)
        (some-other-goal row q)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
Have been searching how to convert a dictionary to a string. But the results
have been using no DOCTYPE but rather simply starting with <html> as per HTML5
have been able to output images from BLOB, however I am now wanting to
Have been pulled down into the realm of CORBA... I am trying to quickly
Have been fighting this for two days and am very frustrated but feel like
Have been reading up and checking other questions, but don't understand / can't seem
I have been doing some statistics work with Stata recently and not enjoying it
Have been googling for a while, but I don't find any page which explains
Have been trying to write an awk script which processes a log file, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.