[Jprogramming] Can a verb (adverb or conjunction) know and echo its own name?

'robert therriault' via Programming programming at jsoftware.com
Wed Aug 5 01:22:16 UTC 2020


Another option which does not require debug to be on is to embed the verb in a try. catch. end. control block

 tracer=: 4 : 0
try. x + y
 catch. 2 3 $ 'x arg';'Error Type';'y arg'; x;(, 13!:12 '');y end.
)

    4 tracer 5
9
   4 tracer 'a'
┌─────┬──────────────────────────────────┬─────┐
│x arg│Error Type                        │y arg│
├─────┼──────────────────────────────────┼─────┤
│4    │|domain error: tracer |   x    +y │a    │
└─────┴──────────────────────────────────┴─────┘
   'd' tracer 3
┌─────┬──────────────────────────────────┬─────┐
│x arg│Error Type                        │y arg│
├─────┼──────────────────────────────────┼─────┤
│d    │|domain error: tracer |   x    +y │3    │
└─────┴──────────────────────────────────┴─────┘
   2 3 tracer 3 4 5
┌─────┬──────────────────────────────────┬─────┐
│x arg│Error Type                        │y arg│
├─────┼──────────────────────────────────┼─────┤
│2 3  │|length error: tracer |   x    +y │3 4 5│
└─────┴──────────────────────────────────┴─────┘
      
Cheers, bob

> On Aug 4, 2020, at 17:21, Raul Miller <rauldmiller at gmail.com> wrote:
> 
> I cannot reproduce this result using the definition of ownName
> provided in this thread. So I am guessing you are using a different
> definition.
> 
> I would recommend something like this:
> 
> parentName=: 3 : 0
>   ;{.,}.13!:13 ''
> )
> 
> ownName=: 3 :0
>  echo parentName ''
> )
> 
> Which behaves like this:
> 
>   ownName ''
> 
>   dbr 1
>   ownName ''
> ownName
> 
> Thanks,
> 
> -- 
> Raul
> 
> 
> -- 
> zraaul
> 
> On Tue, Aug 4, 2020 at 5:28 PM Brian Schott <schott.brian at gmail.com> wrote:
>> 
>> For more clarity, the session below shows the improvement after enabling
>> debug.
>> 
>>   load 'debug'
>>   dbr 1
>>   ownName 9
>> 9
>> |ownName[0]
>> |       ownName 9
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list