I think that in mathematics it's called a "pure function" which ? is not. j
assumes functions (verbs etc.) to be "pure functions".

On Thu, Nov 3, 2016 at 7:54 AM, Don Guinn <[email protected]> wrote:

> Well, I wouldn't really consider it a bug, but normally given the same
> argument, a function returns the same result no matter how many times you
> run it. So when J evaluates a tacit expression it evaluates everything it
> can when defined. So the (? bind 3) is evaluated and is replaced with the
> constant result. But ? violates this normal action of a function. The
> answer changes every time it runs.
>
> It's not the only place this happens in J. A function that gets the time
> or date changes every time it runs. Similarly, event verbs like the
> handlers for function keys must be explicit for the same reason. Well,
> that's not really true, but you really have to be careful that it doesn't
> complete execution when defined.
>
> On Thu, Nov 3, 2016 at 12:31 AM, bill lam <[email protected]> wrote:
>
>> This is a bug but it is also how 13 : works. As a workaround, it
>> needs to defer evaluation to run time by some tricks. eg,
>> 13 : '-:y+0 1 2=(? bind 3)y'
>>
>> Чт, 03 ноя 2016, jprogramming написал(а):
>> >
>> > The following J-code produces the Sierpinski triangle.
>> > f=. 3 : '-:y+0 1 2=?3'
>> > 'dot'plot+/(3%:_1 0 1)*|:f^:(i.10000)1 1 1%3
>> >
>> > Note however that the tacit code generator (13 :) evaluates the random
>> number generator (?) at compile time rather than at run time.
>> >    13 : '-:y+0 1 2=?3'
>> > [: -: 1 0 0 + ]
>> > I think that is a bug.
>> > Thank you.
>> > Bo.
>> > Game of Chaos
>> >
>> >
>> > |
>> > |   |
>> > Game of Chaos
>> >  Java applet that produces the Sierpinski triangle by shooting dice  |
>> |
>> >
>> >   |
>> >
>> >
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> --
>> regards,
>> ====================================================
>> GPG key 1024D/4434BAB3 2008-08-24
>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to