[Jprogramming] console display verb

Mike Powell mikepowell at shaw.ca
Fri Mar 9 09:44:42 HKT 2007


For the future reference of others, here is the verb I'm using to  
emulate console output:

logDisplay =: 3 : 0
if. 0~:(4!:0)y
do. t=.(5!:(''$9!:2''))y
else. t=.".>y
end.
disp =. (];.0~ 1 1,:_2+$)@":@<
,(disp t),.CR
)

My thanks to Oleg and Roger for their help.
Mike Powell

On 4-Mar-07, at 2:32 PM, Roger Hui wrote:

> It's done in C in the interpreter and it's not a lot
> of fun.  You can:
>
> a. Use J itself as a subroutine and capture its
> output.
>
> b. Wait for someone in the forum to write one.
>
> c. Write your own.
>
> For option c:
>
> c.0 The verb that Oleg Kobchenko provided works
> for nouns, other than the ... thing.
>
> c.1 For non-nouns, you need to take into account
> 9!:2, which specifies which of the 5!:x
> representation(s) to use.  Use 5!:x to produce the
> noun(s), then use c.0 to handle it/them.
>
> c.2 Once you have the output array, take into
> account 9!:36 to do the ... thing.
>
>
>
> ----- Original Message -----
> From: Mike Powell <mikepowell at shaw.ca>
> Date: Sunday, March 4, 2007 9:48 am
> Subject: Re: [Jprogramming] console display verb
>
>> Any object and ellipsis, please.
>>
>> On 4-Mar-07, at 8:26 AM, Roger Hui wrote:
>>
>>> The monad ": ?
>>>
>>> But do you mean it should work for any object,
>>> verb, adverb, and conjunction as well as nouns?
>>> Do you mean that it should do the ... thing
>>> (truncating the output which is too long in
>>> one or both of the dimensions)?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list