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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:01:40+00:00 2026-05-19T10:01:40+00:00

Some script is working successful by swi-prolog 5.11.11 on linux-system, but not so well

  • 0

Some script is working successful by swi-prolog 5.11.11 on linux-system, but not so well on windows-system by Swi-Prolog 5.6.48

main :-
    open('output.txt',write,OS),
    elements(Points),
    get_set(Eq, Points),
    alpha_isotone(Eq, Points),
    write(OS,Eq),nl(OS),
    false,
    close(OS).

Problem – under the windows file output.txt is empty and all information is staying in pseudo-terminal.
Under linux it’s working well, but end of file is missed often. Like

>> tail output.txt      
[6,1,3,6,6,6]
[6,1,6,6,6,6]
[6,3,1,6,6,6]
[6,3,3,6,3,6]
[6,3,3,6,5,6]
[6,3,3,6,6,6]
[6,3,6,6,6,6]
[6,6,1,6,6,6]
[6,6,3,6,6,6]
[6,6,6,

What am I doing wrong? (except of my english)

  • 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-05-19T10:01:41+00:00Added an answer on May 19, 2026 at 10:01 am

    If one wanted to keep the close(OS) within a “single” main/0 clause, this also works:

    main :-
        open('output.txt',write,OS),
        (   elements(Points),
            get_set(Eq, Points),
            alpha_isotone(Eq, Points),
            write(OS,Eq),nl(OS),
            false
            ;
            close(OS)
        ).
    

    This syntax is not recommended as it is hard to remember what is the precedence of the conjunction , versus disjunction ; unless you frequently use such coding, and it is on that account less readable than the version presented by larsmans.

    Prolog defines the relative precedence of operators, even for AND, OR, and “neck” :-, by assigning Precedence values to each (users do this with op/3 when defining their own operators), ranging from 0 to 1200.

    There is also a reversal of the usual convention here, in that we normally mean the higher precedence operator is to be applied before lower precedence operators. But in Prolog the lower Precedence value indicates an operator binds (is applied) first.

    Actual precedence values vary with the implementation, but conjunction , has lower Precedence value than disjunction ; and thus binds first.

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

Sidebar

Related Questions

Working on some tweaks for a build script, I noticed that the output from
.load() was working fine, but for some reason it's not in Chrome now (presumably
Possible Duplicate: Is there any working memory profiler for Python3 I have some script
I'm working on a script that is supposed to install some software from a
I'm working on a simple GUI Python script to do some simple tasks on
Im working on a shopping cart script in php and need some advice on
I have been working on this for some time. The script does work and
I am working on a script to remotely kill two processes, delete some folders,
i've been trying to login through AJAX but somehow its not working. my controller
I'm working on some script and I would like to create search. My project

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.