k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- 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
- [K-user] Printing K terms to stdout, Abdul Dakkak, 12/13/2012
- Re: [K-user] Printing K terms to stdout, Traian Florin Șerbănuță, 12/13/2012
- Re: [K-user] Printing K terms to stdout, Abdul Dakkak, 12/13/2012
- Re: [K-user] Printing K terms to stdout, Traian Florin Șerbănuță, 12/13/2012
Archive powered by MHonArc 2.6.16.