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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:25:30+00:00 2026-05-25T12:25:30+00:00

While troubleshooting a larger assignment for school, I found a mistake I had made,

  • 0

While troubleshooting a larger assignment for school, I found a mistake I had made, where I was treating a single item list (a stack with one item) as if it were a single item. I solved my issue, however in further testing I noticed something weird:

48 ?- 1 is [1].
true.

49 ?- -1 is [-1].
ERROR: is/2: Type error: `character' expected, found `-1'

50 ?- 0.66 is [0.66].
ERROR: is/2: Type error: `character' expected, found `0.66'

Similar behavior happens using =:=/2 instead of is/2. So for whatever reason, a single item list is considered the same as a single item, but only for non-negative integers.

Curiosity more than anything else… anybody know why this is?

Thanks!

  • 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-25T12:25:30+00:00Added an answer on May 25, 2026 at 12:25 pm

    In SWI-Prolog (and perhaps others), this is related to a backward compatibility implementation of expressions for evaluation by is/2 and =:=/2:

    .(+Int,[])
    
    A list of one element evaluates to the element. This implies "a" evaluates to 
    the character code of the letter `a' (97). This option is available for 
    compatibility only. It will not work if `style_check(+string)' is active as "a"
    will then be transformed into a string object. The recommended way to specify the
    character code of the letter `a' is 0'a.
    

    As character codes are non-negative integers, this may explain why the behaviour you’re seeing only works for such numbers and not floating point and negative numbers.

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

Sidebar

Related Questions

While troubleshooting a misbehavior in Spree where the product list was not paginating and
While working in a Java app, I recently needed to assemble a comma-delimited list
In a recent project, I had the pleasure of troubleshooting a bug that involved
While going through the checkBox I found there is written CheckBox checkbox = (CheckBox)sender
I'm currently using an SQL CONNECT statement to access a remote system. While troubleshooting,
While troubleshooting a server with very high I/O wait, I notice there is a
I'm having some problems with deploying my application and while troubleshooting, I came across
I have been troubleshooting this for a while, and I am kind of new
While troubleshooting a contact form with an e-mail host they told me to use
I am very new to Linux and it seems I made a big mistake

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.