I wrote:
> I used the Jx extensions Cloak (?:) and wl ( 104!:1) out of
convenience rather than necessity to show that the foreign verb extension
(104!:8) ...
> ... one can reproduce the behavior using an official interpreter (merely
by redefining the extensions involved). For example,
> JVERSION
> Installer: j602a_win.exe
> Engine: j701/2011-01-10/11:25
> Library: 6.02.023
>
> ('v0 a1 c2 N3' k (< o (Cloak <'wl') ;. _1)) '`^&-:`@:>`^:`0 1 2'
> ┌────┬───┬──┬─────┐
> │^&-:│@:>│^:│0 1 2│
> └────┴───┴──┴─────┘
> v0 a1 c2 N3 N3
> 0 1 2
> 1 1.64872 2.71828
> 1.64872 2.28042 3.89285
How can one redefine the extensions in an official environment?
Obvious hint: Breaking the Dictionary's rules of engagement!
I had written earlier in my first contribution of this thread:
> (o=. @:) (k=. ] [ ;:@:[ 104!:8 L:_1 ]) (wl=. 104!:1) NB. Jx (Extended
J) user-defined utilities
Spoilers follow after the countdown.
,. o |. o i. 23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Raul replied:
> You might mean o=: @: or maybe it is @ or maybe that distinction does
not
> matter.
Again, the first line of my code in the message that you first replied was:
> (o=. @:) (k=. ] [ ;:@:[ 104!:8 L:_1 ]) (wl=. 104!:1) NB. Jx (Extended
J) user-defined utilities
Raul continued:
> Maybe Cloak is like what you have defined that word to be in previous
> conversations, but if that is the case then I expect that I would also
need
> to know the definition for wl.
The challenge was (is) to redefine Cloak and wl. The challenge was also to
redefine (104!:8); That is,the verb k (see above) becomes,
(k=. ] [ ;:@:[ ( … ) L:_1 ])
where … represents the redefining code.
Raul continued:
> It might even be that the [prior?] definitions for v0 a1 c2 and N3 matter
-
> or maybe not.
The verb k is assigning referents (a verb, an adverb, a conjunction and a
noun) to the names (v0, a1 c2 and N3). So, it should not matter if there
are prior definitions for them or not.
Raul continued:
> Now, if I wanted, I could spend some time digging up old messages, and
> through trial and error maybe I could reproduce the behavior you are
> calling out, here. But after doing so, I could mostly only exchange the
> insights gained with other people inclined to make similar efforts. And I
> guess I am too lazy to do that.
That makes two of us; thus, I left it as a challenge (the customary
exercise for the reader).
The hardest one to code, by far, is wl but it has been done already. It is
essentially one of Dan's masterpieces (and if my memory is not failing me
you made some comments about it :). Anyway, the use of wl was incidental.
The right argument of k is a list of boxed referents and it can be produced
in many different ways.
On Sun, Nov 16, 2014 at 3:10 PM, Raul Miller <[email protected]> wrote:
> I guess my point - which relates to back to our use of the term
> "Dictionary" to refer to the language reference - is that it is difficult
> to reason about the meaning of a sentence when you do not know what some of
> the words in that sentence mean.
>
> For example, here:
> ('v0 a1 c2 N3' k (< o (Cloak <'wl') ;. _1)) '`^&-:`@:>`^:`0 1 2'
>
> I am uncertain about the definitions you are using for k, o and Cloak.
>
> You might mean o=: @: or maybe it is @ or maybe that distinction does not
> matter.
>
> Maybe Cloak is like what you have defined that word to be in previous
> conversations, but if that is the case then I expect that I would also need
> to know the definition for wl.
>
> It might even be that the [prior?] definitions for v0 a1 c2 and N3 matter -
> or maybe not.
>
> Now, if I wanted, I could spend some time digging up old messages, and
> through trial and error maybe I could reproduce the behavior you are
> calling out, here. But after doing so, I could mostly only exchange the
> insights gained with other people inclined to make similar efforts. And I
> guess I am too lazy to do that.
>
> Meanwhile, despite all that I have said above, it's actually rather trivial
> for a J verb to behave like =: for the case where the left argument is a
> quoted string and the right argument is a noun.
>
> set1=: 4 :'(x)=: y'
> 'n1' set1 2 3 4
> 2 3 4
> n1
> 2 3 4
>
> Nice and concise...
>
> And we could allow the right argument to be a verb with a trivial change:
>
> set2=: 2 :'(x)=: y'
> 'v2' set2 (+/ % #)
> +/ % #
> 'n2' set2 3 5 7
> 3 5 7
> v2 n2
> 5
>
> But that relies on a mechanism which I prefer not to rely on (for fear that
> it will - sensibly - be changed in the future). But that is also easy to
> work around:
>
> set3=: 2 :'(m)=: v'
> 'v3' set3 ([: > [: -&.>/ .(*&.>) (<"1=i.3) , ,:&:(<"0))
> [: > [: -&.>/ .(*&.>) (1 0 0;0 1 0;0 0 1) , ,:&:(<"0)
> 1 2 3 v3 2 3 5
> 1 1 _1
>
> Now, having gone through that exercise, I expect that your example uses the
> "absolute power bug" to assign names with adverb and conjunction values
> (which would be constructed during the assignment process from things which
> were originally nouns). But even here, it's possible to do that more
> concisely using lists-of-characters for the nouns:
>
> set4=: 2 :'".''(m)=:'',n'
> 'c4' set4 '&.:'
>
> 'v4' set4 '+/c4*:'
>
> 'n4' set4 'v4 1 2 3'
> 3.74166
>
> or using an atomic representation instead of a list of characters, to
> specify the result-to-be assigned:
>
> set5=: 2 :'(m)=: n 5!:0'
> 'c5' set5 (<'&.:')
> &.:
> 'v5' set5 ({.(+/c5*:)`'')
> +/&.:*:
> 'n5' set5 (<'0';v5 1 2 3)
> 3.74166
>
> That's getting a bit obscure, in the representation, but I imagine I am
> approaching the system that you were illustrating. Still, it falls short.
> But, if we want to support lists of names and lists of atomic
> representations (also known as "gerunds"), we could do:
>
> set6=: 2 :0
> (;:m) 4 :('x set5 y';'i.0 0')"0 n
> )
>
> Then we can do stuff like:
>
> 'c6' set6 (<'set6')
> 'n6 v6' c6 ((<'0';7 11)`(+/%#))
> v6 n6
> 9
>
> Mind you, it's simpler to just stick with =: but...
>
> But I guess my point is that you have to understand the definitions of the
> words, at least to some degree, before the sentences using those words can
> make sense. (And this matters not only for things like the above examples
> but for any body of code - and of course large bodies of code have lots of
> definitions words...).
>
> Anyways, you wind up with a mix of needing to study code, and needing other
> approaches (friends, experiments, documentation, etc.) to manage the issues
> which arise when systems get large. It can become quite daunting.
>
> Thanks,
>
> --
> Raul
>
>
> On Sun, Nov 16, 2014 at 1:36 PM, Jose Mario Quintana <
> [email protected]> wrote:
>
> > I used the Jx extensions Cloak (?:) and wl ( 104!:1) out of convenience
> > rather than necessity to show that the foreign verb extension (104!:8)
> not
> > only can take arguments that it was not supposed to take but also produce
> > results that make sense (to me, anyway) just as several official
> primitives
> > and official foreign constructions do.
> >
> > On the one hand, presumably, none of these official words were
> specifically
> > designed to take and handle forbidden arguments. On the other hand,
> > sometimes I sense that there is an overall design to be able to do so but
> > the Dictionary's rules of engagement are enforced for the user's
> > environment; although, as we know now, the enforcement is not airtight
> > (there are at least two punctures). I really have no clue if there is an
> > overall design, I only glanced at an ancient version of the code of the
> > interpreter a long time ago with my C illiterate eyes.
> >
> > To be clear, the fact that I used a modified Jx interpreter is ultimately
> > irrelevant because one can reproduce the behavior using an official
> > interpreter (merely by redefining the extensions involved). For example,
> >
> >
> > JVERSION
> > Installer: j602a_win.exe
> > Engine: j701/2011-01-10/11:25
> > Library: 6.02.023
> >
> > ('v0 a1 c2 N3' k (< o (Cloak <'wl') ;. _1)) '`^&-:`@:>`^:`0 1 2'
> > ┌────┬───┬──┬─────┐
> > │^&-:│@:>│^:│0 1 2│
> > └────┴───┴──┴─────┘
> > v0 a1 c2 N3 N3
> > 0 1 2
> > 1 1.64872 2.71828
> > 1.64872 2.28042 3.89285
> >
> >
> > How can one redefine the extensions in an official environment?
> > Obvious hint: Breaking the Dictionary's rules of engagement!
> >
> >
> > On Sat, Nov 15, 2014 at 1:13 AM, Raul Miller <[email protected]>
> > wrote:
> >
> > > On Fri, Nov 14, 2014 at 6:27 PM, Jose Mario Quintana
> > > <[email protected]> wrote:
> > > > Fantastically (or horridly, depending on one's point of view), the
> verb
> > > > (104!:8) can effortlessly make assignments that were never
> envisioned,
> > > >
> > > >
> > > > ('v0 a1 c2 N3' k (< o (?: <'wl') ;. _1)) '`^&-:`@:>`^:`0 1 2'
> > >
> > > ?:
> > > |spelling error
> > >
> > > Modified versions of J maybe should not count for the "never
> envisioned"
> > > thing.
> > >
> > > Unless, of course, you are saying that you - who designed that
> > > modification - had not envisioned that your changes would behave this
> > > way.
> > >
> > > Thanks,
> > >
> > > --
> > > Raul
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm