1+:2
|domain error
| 1 +:2
1(+: :: (a=:3:)) a=:0
0
(+: :: (a=:3:)) a=:0
0
a
3:
still a bug with that one... but the good news:
2 +: ( :: ('a' assign 3: [ ])) a=: 0
3
a
3
+: ( :: ('a' assign 3: [ ])) a=: 0
0
a
0
works as hoped... and if it doesn't raise an error then the normal code that
would assign the flag runs normally.
A useful feature suggestion though would be a try. finally. form to make
semaphores/mutexes easier/possible.
It turns out though, that I don't know how to make the above return (or just
smoutput/print) any error. One of my tries:
+: ( :: (('a' assign 3:) ] 13!:12 ('' [ ]))) a=: 0
0
2 +: ( :: (('a' assign 3:) ] 13!:12 ('' [ ]))) a=: 0
|domain error
| 2 +:( ::(('a'assign 3:)]13!:12(''[])))a=:0
a
0
----- Original Message -----
From: Henry Rich <[email protected]>
To: [email protected]
Cc:
Sent: Saturday, September 14, 2013 12:19:58 PM
Subject: Re: [Jgeneral] :: (adverse) weirdness -- was Bug in adverb define
'' + ( :: ('a' assign 3: [ ])) a=: 0
You are executing the verb against a cell of fills. When the execution
of a verb on a fill-cell fails, the error is quietly ignored, and a
result of scalar 0 is used to give the shape/type of the result. Here,
the error in u causes v not to be executed.
Offhand, this seems questionable: if u fails when u :: v is executed, it
seems hasty to assume a default shape without executing v. But that
apparently is what happens.
' ' + ( :: ('a' assign 3: [ ])) a=: 0
3
a
3
Here you are executing on a real domain error, and the error path is
executed.
Henry Rich
On 9/14/2013 11:50 AM, Pascal Jasmin wrote:
> '' + ( :: ('a' assign 3: [ ])) a
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm