Discussion:
[Bug-apl] Right-arrow, correct behaviour?
Elias Mårtenson
2017-06-28 10:02:03 UTC
Permalink
I have defined a function as such:

∇ Z ← foo X
→(X=0)/zero
Z ← 'not zero'
→
zero:
Z ← 'zero'
∇

When calling this function with a non-zero argument, I expect the return
value to be 'not zero'. Instead it simply exits the function. Is this
correct behaviour?

Regards,
Elias
Kacper Gutowski
2017-06-28 10:22:35 UTC
Permalink
∇ Z ← foo X
→(X=0)/zero
Z ← 'not zero'

Z ← 'zero'

When calling this function with a non-zero argument, I expect the return
value to be 'not zero'. Instead it simply exits the function. Is this
correct behaviour?
I think this is correct, it's returning an escape.
You probably wanted to do →0 instead of →.

-k
Elias Mårtenson
2017-06-28 10:24:47 UTC
Permalink
Post by Kacper Gutowski
Post by Elias MÃ¥rtenson
∇ Z ← foo X
→(X=0)/zero
Z ← 'not zero'
→
Z ← 'zero'
∇
When calling this function with a non-zero argument, I expect the return
value to be 'not zero'. Instead it simply exits the function. Is this
correct behaviour?
I think this is correct, it's returning an escape.
You probably wanted to do →0 instead of →.
Got it. Thanks!
Juergen Sauermann
2017-06-28 10:27:29 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Elias,<br>
<br>
I think so. <b>→</b> without argument is <b>ESCAPE</b> not <b>GOTO
0</b>.<br>
ESCAPE unrolls the <b>)SI</b> stack until it reaches immediate
execution.<br>
<br>
Similar to throwing an exception and stopping at a <b>try</b> <b>{}</b>
block.<br>
<br>
/// Jürgen<br>
<br>
</font><br>
<div class="moz-cite-prefix">On 06/28/2017 12:02 PM, Elias Mårtenson
wrote:<br>
</div>
<blockquote
cite="mid:CADtN0W+PK6Bthu-WYE637WLZZ1RLqEC-Xjr8AwenLuekqbLd+***@mail.gmail.com"
type="cite">
<div dir="ltr">I have defined a function as such:
<div><br>
</div>
<div>
<div><font face="monospace, monospace">∇ Z ← foo X</font></div>
<div><font face="monospace, monospace">  →(X=0)/zero</font></div>
<div><font face="monospace, monospace">  Z ← 'not zero'</font></div>
<div><font face="monospace, monospace">  →</font></div>
<div><font face="monospace, monospace">zero:</font></div>
<div><font face="monospace, monospace">  Z ← 'zero'</font></div>
<div><font face="monospace, monospace">∇</font></div>
</div>
<div><br>
</div>
<div>When calling this function with a non-zero argument, I
expect the return value to be 'not zero'. Instead it simply
exits the function. Is this correct behaviour?</div>
<div><br>
</div>
<div>Regards,</div>
<div>Elias</div>
</div>
</blockquote>
<br>
</body>
</html>

Loading...