User talk:Raul Miller

From J Wiki
Jump to navigation Jump to search

Igor Zhuravlov

Igor Zhuravlov wrote the quoted material here, presumably in response to my comments on User:Igor_Zhuravlov/Data_teleport (which he has since deleted). And, since I didn't have any other content here, I'm just leaving it here (with some comments at the end), for now.

 Variable copulas aren't allowed in tacit expressions. So, if some value has been derived in tacit expression, the only way to transfer it to another part of this expression (or, in general, of the whole program) is to pass it from one verb to another. E.g. a definition:
    expr=: (a0 b0 a1) c (a1 b1 a2)
 encodes an execution tree:
      / \
    b0   b1
    / \   / \
  a0  a1 a1  a2
 If (x a1 y) is expensive to evaluate then its result once produced in one branch should be passed to another one (from right to left branch here, I guess). One may write something like:
    expr=: (a0 b0 (3 : 'val')) c (((3 : 'val=: a1 y') : (4 : 'val=: x a1 y')) b1 a2)
 But it's polluting the global namespace. One way to work it out is to use an extended fork:
    expr=. a0`b0`a1`c`b1`a2 fork3
 with execution tree:
       / \
      b0  b1
     / \ / \
    a0  a1  a2
 An another way proposed here is to use a data teleport (say, defined under primitive t.):
    expr=: (a0 b0 t.@0) c ((0 t. a1) b1 a2)

The sentence "Variable copulas aren't allowed in tacit expressions" is ... inadequate, in my opinion.

A "Variable copula" refers to something like yyy=: expression. And, tacit expressions do not explicitly refer to their arguments.

However, tacit expressions do not exclude the use of words which have explicit definitions, so we have some obvious escapes from this claim. But there's another way, also, which is that if we're working with character data, we can write that data to a file and read it back in elsewhere, as a way of persisting the information.

But, also, we have other os interfaces (such as calling external procedures) which can achieve similar ends, if we wanted to bother with that.

So... while there is some truth and relevance in what Igor has laid out here, it's not the whole story.

With that in mind, here's an implementation for data teleport

teleport=:3 :0
  ('data',(":x),'_teleport_')=: y

Example use:

   0 teleport i.3 3
0 1 2
3 4 5
6 7 8
   teleport 0
0 1 2
3 4 5
6 7 8

I can't figure out whether this is grotesque or brilliant.

After seeing the original point, I came up with the following. It's very similar to yours but I define two adverbs instead, hopefully to better integrate into tacit expressions.

   in=: adverb def 'y [ (m,''_inout_'')=: y'
   out=: adverb def '3 : (m,''_inout_'')'

   (+/ , # , +/ % #)"1 i.3 11
 55 11  5
176 11 16
297 11 27

   ('sum'out , 'count'out , 'sum'in@(+/) % 'count'in@#)"1 i.3 11
 55 11  5
176 11 16
297 11 27

Kirk Iverson (talk) 03:49, 11 October 2019 (UTC)

Raul and Kirk, thank you for comments. Now I see this simple idea can be easily implemented by plain J, so there is no need to touch the interpreter. BTW, I have no idea why my comment was deleted and why it's first version is so reduced. Raul, you've restored my comment in full and correct form, thank you!

--Igor Zhuravlov (talk) 04:29, 11 October 2019 (UTC)

If you are referring to my edit history here - I tried using blockquote but that removes some wiki formatting. So I fiddled with your text for a while before I figured out how to mark it off as quoted and still retain the formatting. This means that the edit history looks... garbled... --Raul Miller (talk) 16:14, 11 October 2019 (UTC)



I don't agree with your revision , since mt should be loaded only by:

   load 'math/mt'

or by:

   require 'math/mt'

that is, as the whole from the top entry point. Loading just a part e.g.

   require 'math/mt/trf'

in the fresh session will make it broken due to missing dependencies: global nouns, system definitions, utilities and low-level parts. This partial loading has sense only within the limited circumstances e.g. in an addon development workflow after the whole addon has already been loaded.