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 9007689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:45:21+00:00 2026-06-16T01:45:21+00:00

I am trying to understand the basic syntax of prolog and dcg but it’s

  • 0

I am trying to understand the basic syntax of prolog and dcg but it’s really hard to get ahold of proper information on the really basic stuff. Take a look at the code below, I basically just want to achieve something like this:

Output = te(a, st).

Code: 
    test(te(X,Y)) --> [X], test2(Y).
    test2(st(_X)) --> [bonk]. 

    ?- test(Output, [a, bonk],[]).
    Output = te(a, st(_G6369)). 

Simply what I want to do is to add the the word ‘st’ at the end, and the closest way I’ve managed is by doing this but unfortunately st is followed a bunch of nonsense, most likely because of the singleton _X. I simply want my Output to contain like: te(a, st).

  • 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-16T01:45:22+00:00Added an answer on June 16, 2026 at 1:45 am

    If you want to accept input of the form [Term, bonk] and obtain te(Term,st) you should change test/2 to accept bonk a return st:

    test(te(X,Y)) --> [X], test2(Y).
    test2(st) --> [bonk].
    
    
    ?-  test(Output, [a, bonk],[]).
    Output = te(a, st).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to understand the basic MVVM design approach, but I dont' understand where
I am a php programmer trying to understand python's for in syntax I get
This might be a very basic question but I'm trying to understand this behavior
Sorry for the probably basic question, but I'm trying to understand some code and
I am trying to understand how to accomplish some basic debugging stuff with gdb
I understand the basic idea of java's String interning, but I'm trying to figure
I am trying to understand prolog and definite clause grammar but I am having
I am new to python and trying to understand the following basic python syntax.
I was looking at Sinatra and trying to understand the syntax: require 'sinatra' get
I am trying to better understand basic concepts in OOP. What are static and

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.