See comments below:

Den 2017-10-24 kl. 07:14, skrev Jose Mario Quintana:
EH> Hi all!

Hi

EH> All user-written adverbs and conjunctions are something similar to the
EH> macros in assembler and C++?

I am not familiar with modern macros but if macros have an arbitrary but
fixed number of parameters then the answer is: not necessarily.
I am not familiar with those either, but my assumption is that the text set in the parameters simply replaces the parameters in the macros.

   abrakadabra t0
abrakadabra + 1 % 1 + abrakadabra

EH> There are external interfaces. You  could call C/C++ code for example.
I
EH> don't know if it is possible for tacit code. I guess not.

Tacit code can load libraries (e.g., addons) and execute verbs defined in
those libraries which might, or might not, call C/C++ code.  I am not sure
if my answer answers your question though. :)
If you can extend J with adverbs and conjunctions written in C/C++, you could possibly generate the source code, compile them, link them and call them. That would be very different from the current macro-like adverb and conjunction definitions, it seems.

EH> What you do is to generate programs? In runtime, when running tacit

Tacit adverbs, in J and Jx and tacit conjunctions in Jx produce entities
(nouns, verbs, adverbs, and conjunctions); those entities (apart from
nouns) can be explicit or tacit but I prefer to keep everything tacit.
Explicit adverbs and conjunctions produce the same kind of entities and
those can be explicit or tacit, but you already know this since your
explicit AtTacit below produces tacit verbs.

EH> code, there is only the same built in code? Except then for some added
EH> functionality in Jx? But using explicit code, you can read user input
EH> and generate programs? Like we used to do with Do(".) ? How would you
EH> compare the methods you have with this traditional method to generate
code?
EH>
EH> Here my tacit conjunction AtTacit, equivalent with @:
EH>     AtTacit=: 2 : '[: u v'
EH>
EH> The tacit code that actually executes is the second line, as far as i
EH> understand. AtTacit only remains until I give it verb arguments, and
EH> that will always happen before the actual tacit code is even parsed, as
EH> far as I understand.
EH>
EH>     <AtTacit-
EH> [: < -
EH>
EH> Your t0 can be defined like this?
EH>
EH>     t0=: 1 : 'u + 1 % 1 + u'
EH>     u t0 t0
EH> (u + 1 % 1 + u) + 1 % 1 + u + 1 % 1 + u
EH>

Sure, but t0 defined this way is not a tacit adverb,

    t0
1 : 'u + 1 % 1 + u'

in contrast (beware of line-wrapping),

    t0=.   (] , (+`'') , (an 1) , (%`'') , (an 1) , (+`'') , ]) hg

    t0
(("_)(((`'')(&((] , (,<,'+') , (<(,'0');1) , (,<,'%') , (<(,'0');1) ,
(,<,'+') , ])@:(<@:((0;1;0)&({::)))@:[)))((`_)(`:6))))(`:6)

is tacit (it does not  have any named arguments; there are no names
whatsoever)

    v t0
v + 1 % 1 + v

    v t0 t0
(v + 1 % 1 + v) + 1 % 1 + v + 1 % 1 + v

I used hg to show that, even playing by the book, current J tacit adverbial
programming is complete but tacit conjunctional programming is absent.  I
prefer to use its evil twin sibling adv (defined in the J Wicked Toolkit);
adv was the model for the Jx version of adv (_1?:0).  I wrote the compliant
version of hg because Dan Bron implied that the original version cheated
which it did and I am proud of that ;)

By the way, I wonder where Dan is. I really miss his posts, I learned a lot
from them.
The difference still is not clear to me. I think before the resulting tacit code actually executes you have to give it an argument, and what then actually executes is exactly the same.
   t0EH=: 1 : 'u + 1 % 1 + u'
   t0JMQ=.   (] , (+`'') , (an 1) , (%`'') , (an 1) , (+`'') , ]) hg
   t0EH
1 : 'u + 1 % 1 + u'
   t0JMQ
(("_)(((`'')(&((] , (,<,'+') , (<(,'0');1) , (,<,'%') , (<(,'0');1) , (,<,'+') , ])@:(<@:((0;1;0)&({::)))@:[)))((`_)(`:6))))(`:6)
   +t0EH
+ + 1 % 1 + +
   +t0JMQ
+ + 1 % 1 + +
That t0JMQ, when the available words are replaced, does not contain any words does not make it tacit, as far as I understand. It is a mixture of tacit and explicit code, but before it all executes as a tacit expression, the replacements must be made in what seems equivalent to a text string, which can then be parsed by `:6 to another new tacit expression. It seems you are in a way handling functions as data, the question is in what ways it is better than the macro-like adverbs and conjunctions and the parse string functionality we always had, even in IBM APL/1 1980.


EH> Now you use your o=: @: ?
EH>
EH>     *:`(+/)`-`j.`(^ %:)t1 1 2 3
EH> 2.40034j16.7123
EH>      (^ %:) o j. o - o (+/) o *:  1 2 3
EH> 2.40034j16.7123
EH>
EH> The tacit executed code is the same? So it is about saving keypresses
EH> and about visual impression?
EH>

I like to use o instead of @: for the following reasons: it reminds me of
the mathematical symbol for function composition  (g º f)(x) = g(f(x)); @:
distracts me; o is easier to write.


EH> I admire your work. I'm not critical. I just want to give you the
EH> opportunity to explain it.

I appreciate your comment and your effort to understand it.  However, I
must say that "my" work has been heavily influenced by several past and
present members of the forum; yet the cheating is all mine.
:)

EH>
EH> Cheers,
EH>
EH> Erling Hellenäs


On Sat, Oct 21, 2017 at 3:43 PM, Erling Hellenäs <[email protected]>
wrote:

Hi all!

I don't understand the meaning of "tacit adverb". Before parsing of the
actual tacit trains, all adverbs and conjunctions are tied to their
arguments? What remains is a verb train to be parsed? A verb train which
contains some built-in adverbs and conjunctions? These are tied to their
arguments under the hood? Remains a verb train composed to a single verb
which executes later?
All user-written adverbs and conjunctions are something similar to the
macros in assembler and C++?
Some of the built-in adverbs and conjunctions are compiled code with verb
arguments, I guess. There is no way I know of for users to add or define
such compiled adverbs and conjunctions.
There are external interfaces. You  could call C/C++ code for example. I
don't know if it is possible for tacit code. I guess not.
What you do is to generate programs ? In runtime, when running tacit code,
there is only the same built in code? Except then for some added
functionality in Jx? But using explicit code, you can read user input and
generate programs? Like we used to do with Do(".) ? How would you compare
the methods you have with this traditional method to generate code?

Here my tacit conjunction AtTacit, equivalent with @:
    AtTacit=: 2 : '[: u v'

The tacit code that actually executes is the second line, as far as i
understand. AtTacit only remains until I give it verb arguments, and that
will always happen before the actual tacit code is even parsed, as far as I
understand.

    <AtTacit-
[: < -

Your t0 can be defined like this?

    t0=: 1 : 'u + 1 % 1 + u'
    u t0 t0
(u + 1 % 1 + u) + 1 % 1 + u + 1 % 1 + u

About the verb train. I know earlier there was a performance penalty for
writing -@:-@:-@:-@:- trains and you generated parenthesis, like this i
think: (-@:(-@:(-@:(-@:-)))). I can understand that. However this is no
longer necessary, since the performance difference is corrected. It was
also always possible to write strawmans([: - [:- [: - ]).
Now you use your o=: @: ?

    *:`(+/)`-`j.`(^ %:)t1 1 2 3
2.40034j16.7123
     (^ %:) o j. o - o (+/) o *:  1 2 3
2.40034j16.7123

The tacit executed code is the same? So it is about saving keypresses and
about visual impression?

*:`(+/)`-`j.`(^ %:)t1

(^ %:)@:j.@:-@:(+/)@:*:

(^ %:)o j.o-o(+/)o*:

(^ %:)@:j.@:-@:(+/)@:*:


I admire your work. I'm not critical. I just want to give you the
opportunity to explain it.

Cheers,

Erling Hellenäs





On 2017-10-21 20:13, Jose Mario Quintana wrote:

Indeed, one can produce many useful tacit adverbs by other means.
However,
is there a general method to produce tacit adverbs using current official
interpreters?  If worse comes to worse, the adverb hg provides the means
do
to so for a vast class of adverbs (yet, there are still, at least, a
couple
of cases which are not covered by hg; which ones?).

Often is not difficult to produce tacit adverbs acting on a verb and
produce sentences where there is only one instance of the verb.  When the
argument appears more than once, it might not be not so clear.  For
example, produce a tacit adverb t0 such that,

erase'u'

     u t0
u + 1 % 1 + u

     u t0 t0
(u + 1 % 1 + u) + 1 % 1 + u + 1 % 1 + u

     ] t0 t0 t0 t0 t0 t0 t0 ("0) 1 2 3 4
3.33943969 3.84748866 4.50703342 5.26330573

Yet, I know it can be produced, obeying the rules, via hg.  However,
personally, I do not mind to break the rules when there are no adverse
consequences and I would simply write it, using the J Wicked Toolkit, in J
(or Jx) as,

t0=. [: u 'u + 1 % 1 + u' xi q adv

Another example is the one I mentioned in the first post: produce a tacit
adverb t1 such that,

     u0`u1`u2`u3`u4`u5`u6 t1
u6@:u5@:u4@:u3@:u2@:u1@:u0

     *:`(+/)`-`j.`(^ %:)t1 1 2 3
2.40034j16.7123


(
I just cannot resist mentioning, due to certain similarities, the
following
page:
Trains: past, present and future
https://learnenglish.britishcouncil.org/en/magazine/trains-p
ast-present-and-future

)


On Sat, Oct 21, 2017 at 8:25 AM, Erling Hellenäs <
[email protected]>
wrote:

Hi all!
Since the full answers to these seemingly stupid questions are not clear
to me, I will pose them:

1. Why shouldn't we just write the adverbs and conjunctions instead of
producing them this way?
2. How does this  way to do it compare to creating programs from strings
with Do(".) ?

     ".'f=: +'

     1 f 1
2
     ".'f=: /'

     +f 1 2 3
6
     ".'f=: @:'

     +f- 1
_1

Cheers,
Erling Hellenäs



On 2017-10-21 13:34, Erling Hellenäs wrote:

After executing the modified script the examples in the post worked and I
could read it. /Erling

On 2017-10-21 12:32, Erling Hellenäs wrote:

Hi all!
I commented a printout that did not seem to work and modified the
script
slightly while hopefully keeping its function.

9!:14''
o=. @:
ar=. 5!:1 @:<
a0=. `''
a1=. (@:[) ((<'&')`) (`:6)
a2=. (`(<(":0);_)) (`:6)
NB.(a0=. `'') (a1=. (@:[) ((<'&')`) (`:6)) (a2=. (`(<(":0);_)) (`:6))
((`'')(((@:[)(&`))(`:6)))((`_)(`:6))
av=. ((ar'a0')`)  (`(ar'a1')) (`(ar'a2') ) (`:6)
NB. Adverbing a monadic verb (adv)
assert 1 4 9 -: 1 2 3 *: av
aw=. < o ((0;1;0)&{::)  NB. Fetching the atomic representation
a3=. (@: (aw f.)) ('av'f.)
a4=. "_
a5=. `:6
a6=. ((( ar'a4') ; ] ; ( ar'a3')"_) ('av'f.)) (`:6)
hg=. `((ar'a6')`(ar'a5')) (`:6)
assert 1 4 9 -: 1 2 3 ((<'*:') ; ]) hg
erase'a0 a1 a2 a3 a4 a5 a6 ar av aw'

It then executed nicely.

Cheers,
Erling Hellenäs



----------------------------------------------------------------------
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

Reply via email to