bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how does print-to-codes work?


From: Jasper Taylor
Subject: how does print-to-codes work?
Date: Mon, 22 Jul 2002 13:16:59 +0100
User-agent: KMail/1.4.1

I have made a procedure that tidies up the printing of floats and it works OK 
if consulted as portray/1 for the built in print predicate. But if I use 
print_to_codes the result of portray/1 is still sent to the console. Here's 
an example...

$ gprolog
GNU Prolog 1.2.14
By Daniel Diaz
Copyright (C) 1999-2002 Daniel Diaz
| ?- print(2.92).
2.9199999999999999

yes
| ?- print_to_codes(A, 2.92).

A = [50,46,57,49,57,57,57,57,57,57,57,57,57,57,57,57,57,57]

yes
| ?- consult(nicefloat).
compiling /win98/Program Files/Simile/Develop/Tests/nicefloat.pl for byte 
code...
/win98/Program Files/Simile/Develop/Tests/nicefloat.pl compiled, 6 lines read 
- 1503 bytes written, 8 ms

yes
| ?- portray(2.92).
2.92

yes
| ?- print(2.92).
2.92

yes
| ?- print_to_codes(A, 2.92).
2.92

A = []

yes
| ?-

Attachment: nicefloat.pl
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]