Skip to Content.
Sympa Menu

k-user - [K-user] Printing K terms to stdout

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

[K-user] Printing K terms to stdout


Chronological Thread 
  • From: Abdul Dakkak <abduld AT wolfram.com>
  • To: "k-user " <k-user AT cs.uiuc.edu>
  • Subject: [K-user] Printing K terms to stdout
  • Date: Thu, 13 Dec 2012 14:15:57 -0600 (CST)
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>



Is there a way to print things that are not ints or strings to stdout. In
kool, for example, print(true) does not print to stdout. It gets placed in
the out cell as ListItem(true), but I would like it to print. I even tried
the following:


rule toString(nil) => "nil"
rule toString(true) => "true"
rule toString(false) => "false"
rule toString(I:Int) => Int2String(I)
rule toString(S:String) => S

rule <k> puts(V:Value, Vs => Vs) ; ...</k>
<out>... . => ListItem(toString(V)) </out> [print]
rule <k> puts(.Exps) ; => . ...</k>
<out>... . => ListItem("\n") </out> [structural, print]


but that places ListItem(toString(true)) in the out cell. The out cell is
defined as

<out color="brown" stream="stdout"> .List </out>

thanks for the help





Archive powered by MHonArc 2.6.16.

Top of Page