🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: gmane.comp.ai.prolog.swi
1 messages
1 total messages Started by Daniel Lakeland Fri, 19 Apr 2002 17:20
tail recursion not working?
#42
Author: Daniel Lakeland
Date: Fri, 19 Apr 2002 17:20
60 lines
1586 bytes
From dlakelan@street-artists.org Sat Apr 20 10: 20:54 2002
List-Unsubscribe: <mailto:prolog-request@swi.psy.uva.nl?subject=unsubscribe>
List-Help: <mailto:prolog-request@swi.psy.uva.nl?subject=help>
Precedence: list
List-Post: <mailto:prolog@swi.psy.uva.nl>
X-Loop: prolog@swi.psy.uva.nl
List-Subscribe: <mailto:prolog-request@swi.psy.uva.nl?subject=subscribe>
X-Status: N
User-Agent: Mutt/1.3.27i
Resent-Sender: prolog-request@swi.psy.uva.nl
Content-Disposition: inline
X-Mailing-List: <prolog@swi.psy.uva.nl> archive/latest/1991
Status: R

I'm running swipl v 5.0.0 on Debian linux.

I've got a simple predicate: printstring

printstring([]) :- !.
printstring('') :- !.

printstring(Atom) :-
        atom(Atom), !, write(Atom).

printstring([H|T]) :-
        put(H), !, printstring(T).

when I print a big string (say 4 or 5k) I get a local stack error. I'm
running a little script that works like this:

#!/usr/bin/swipl -O -t go(1) -s

:- set_prolog_flag(tail_recursion_optimisation,true).
:- ensure_loaded('myloader'), load.


What am I doing wrong? (besides using lists of codes instead of string
objects :-))



--
Daniel Lakeland
dlakelan@endpointcomputing.com
http://www.endpointcomputing.com


----------------
* To UNSUBSCRIBE, please use the HTML form at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist

or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
(without the quotes) and *no* message body.

** An ARCHIVE of this list is maintained at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/


Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads