
J: explicit vs. tacit definitions
Are tacit and explicit definitions supposed to act as differently as
they do? Specifically (using 4.06d),
==========
a=: 3 : '(''text is: ''"_ , text"_) y.'
b=: 13 : '(''text is: ''"_ , text"_) y.'
a
+-+-+---------------------------+
|3|:|('text is: '"_ , text"_) y.|
+-+-+---------------------------+
b
+---------------+-+----------+
|+---------+-+-+|,|+----+-+-+|
||text is: |"|_|| ||text|"|_||
|+---------+-+-+| |+----+-+-+|
+---------------+-+----------+
a ''
|value error: text
| ('text is: '"_,text"_)y.
b ''
|value error: text
| b''
NB. so far, so good.
text=: 'foobar'
a ''
text is: foobar
NB. which is what I would expect
b ''
|domain error: text
| b''
NB. this is a surprise to me.
b=: 13 : '(''text is: ''"_ , text"_) y.'
b ''
text is: foobar
NB. why did I have to redefine 'b'?
text=: 'goobaz'
a ''
text is: goobaz
NB. as it 'should' be
b ''
text is: foobar
NB. it seems I have to redefine 'b' again!
b
+---------------+-+------------+
|+---------+-+-+|,|+------+-+-+|
||text is: |"|_|| ||foobar|"|_||
|+---------+-+-+| |+------+-+-+|
+---------------+-+------------+
b=: 13 : '(''text is: ''"_ , text"_) y.'
b
+---------------+-+------------+
|+---------+-+-+|,|+------+-+-+|
||text is: |"|_|| ||goobaz|"|_||
|+---------+-+-+| |+------+-+-+|
+---------------+-+------------+
NB. it looks like the DEFINITION changed
b ''
text is: goobaz
==========
IOW, the explicit definition, 'a', seems to evaluate the global noun
'text' at execution, whereas the tacit definition, 'b', seems to
evaluate 'text' at definition.
Is this the way things are meant to be?
____________________________________