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

  • SEARCH
  • Home
  • 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 9156517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:47:38+00:00 2026-06-17T12:47:38+00:00

I am trying to use meta programming and DCGs to turn a list into

  • 0

I am trying to use meta programming and DCGs to turn a list into a list of clauses using Prolog. For example, I would like to turn [a, man, is, a, human] into [ (human(X) :- man(X)) ]

I figured that I could use =.. for composing terms from a list of their
constituent parts. For example, the call Term =.. [f,a,b,c] will bind Term to f(a,b,c).

My problem is trying to combine this using DCGs. So far, I have used DCGs to check whether a sentence is of a valid form:

 %% syllogism( +S )
  % Holds if the sentence S is one of four syllogisms

  % a B is a C
  syllogism  --> article, subject, is_, (article ; [] ), subject .

  % some B is a C 
  syllogism  --> some, subject, is_, (article ; [] ), subject .

  % no B is a C
  syllogism  --> no, subject, is_, (article ; [] ), subject .

  % some B is not a C
  syllogism  --> some, subject, is_, not, (article ; [] ), subject .

  subject   --> [X] .
  some      --> [some] .
  is_       --> [is] .
  article   --> [a] .
  article   --> [every] .
  not       --> [not] .
  no        --> [no] .

However I am trying to modify this so that I can produce a list of clauses whilst still relying on DCGs.

EDIT:
Basically what I am trying to achieve is take a list L and produce a list of clauses:
[a, man, is, a, human] should produce [man(X) :- human(X)]

Similarly: [no, B, is, a, C] should produce [ (false :- B(X),C(X)) ]

Thanks for your time.

  • 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-17T12:47:39+00:00Added an answer on June 17, 2026 at 12:47 pm

    It looks like you are going to need a meta-interpreter http://ktiml.mff.cuni.cz/~bartak/prolog/meta_interpret.html

    Ultimately all problems in Prolog come down to using the right kind of meta-interpreter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use elements of meta programming, but hit the wall with
I am trying to use template meta-programming to determine the base class. Is there
I'm trying to use meta data to get a postcode, so something like: $property->add_meta_box(
I'm trying to use custom meta boxes in wordpress. My goal at the moment
I'm trying to use the <meta name=apple-mobile-web-app-capable content=yes> tag to get iOS Safari to
I am trying to use .push to put items into a javascript array. I
Trying to use the Java App engine example, here . I keep getting an
I am using Kaminari for pagination and trying to use meta_search for column ordering.
I am trying to use Google Chrome Frame in my Django app. Inserting <meta
I am trying to use JavaScript to upload image to imgur by this example

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.