Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

length/2 loops #210

Open
UWN opened this issue Feb 11, 2024 · 2 comments
Open

length/2 loops #210

UWN opened this issue Feb 11, 2024 · 2 comments

Comments

@UWN
Copy link

UWN commented Feb 11, 2024

Not sure this is a real error or just a compilation problem. See length#3. Also git describe and the banner show different versions.

ulrich@gupu:/opt/gupu/ALSProlog$ git pull
Already up to date.
ulrich@gupu:/opt/gupu/ALSProlog$ git describe
v3.1.24-1517-g1f9f4663
ulrich@gupu:/opt/gupu/ALSProlog$ unix/linux/als-prolog/alspro 
ALS Prolog (Threaded) Version 3.5.0-287-g81d11d5a [linux]
   Copyright (c) 1987-2024 Applied Logic Systems, Inc.

Setting up library indicies...may take a moment...Done.

gc not 64-bit yet
?- length([_|L],0).
gc not 64-bit yet
^C    Break Handler
    ------------------------
    a - Abort Computation *
    b - Break shell
    c - Continue
    d - Debug
    e - Exit Prolog
    f - Fail
    p - Return to Previous Break Level
    s - Show goal broken at
    t - Stack trace
    ? - This message
Break(1) >t
(1) builtins:stack_trace(1,break_handler)
(2) builtins:
    break_handler(stack_trace,builtins,_A is 3154173+1,
        als_shl_mgr(als_shl_mgr,builtins,1...))
(3) builtins:catch0(builtins,?,?)
(4) builtins:breakhandler(builtins,_A is 3154173+1)
(4) builtins:_A is 3154173+1
(5) builtins:length(?,3154173,0)
--Bottom of Stack--
    Break Handler
    ------------------------
    a - Abort Computation *
    b - Break shell
    c - Continue
    d - Debug
    e - Exit Prolog
    f - Fail
    p - Return to Previous Break Level
    s - Show goal broken at
    t - Stack trace
    ? - This message
Break(1) >c
gc not 64-bit yet
...
gc not 64-bit yet
Segmentation fault (core dumped)

@chuckhoupt
Copy link
Member

Thanks for the report. I'll answer the git-describe question first while I research the length/2 issue:

The reason git describe shows an ancient version number is because by default git describe only displays annotated tags. If you use git describe --tags it will show the lightweight tag used for v3.5.0. Ideally we would have used annotated tags for all release versions, but Github has a bug/mis-feature that it only tags releases made in the UI with lightweight tags.

@UWN
Copy link
Author

UWN commented Apr 8, 2024

... while I research the length/2 issue

Not sure I was clear about it, but there is a draft https://www.complang.tuwien.ac.at/ulrich/iso-prolog/prologue#length for length/2 which is followed quite closely by many implementations http://www.complang.tuwien.ac.at/ulrich/iso-prolog/length

Note that there is no need to be perfect as to the detection of all kinds of loops although the more modern systems all detect such cases rapidly. So looping for a case like http://www.complang.tuwien.ac.at/ulrich/iso-prolog/length#22 is fine. More sophisticated implementations produce a resource_error rapidly which is preferable form a resource consumption viewpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants