> to achieve it. ARs make it possible to pass verbs around, but executing > them requires dropping into explicit code. To remedy this, I offer a
Unorthodox tacit verbs can execute them. > Sentence execution can produce ARs, and can take ARs created by verbs to > represent verbs and modifiers. That sounds pretty classy to me, but I > don't know whether it's first-class. Yet, imao it is not first-classy, according to Wikipedia, " In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.[1] Some programming language theorists require support for anonymous functions (function literals) as well.[2] In languages with first-class functions, the names of functions do not have any special status; they are treated like ordinary variables with a function type.[3] " Verbs, in particular, should be able to take and produce verbs, the atomic representations of verbs do not qualify because their type is noun, not verb. The verb <, for instance, should be able to take a verb and produce a boxed verb; more generally, all the other structural verbs should work similarly, in particular, verbs should be able to take boxed arrays of nouns, verbs, adverbs, and conjunctions and produce similar constructions, or any entity (noun, verb, adverb, or conjunction). By cloaking adverbs and conjunctions as verbs all of the above is possible when hacking, for instance, a j806 official interpreter. Atomic representations are bulky relative to what they represent; this might not be much of an issue when one is hand coding. However, it may become an issue when producing and executing lots of large verbs automatically. The following is a tiny demonstration using a single short verb from the standard library, 9!:14'' j806/j64nonavx/windows/release/commercial/ www.jsoftware.com/2017-11-06T10:01:33 fix=. (;:'f.') cloak=. (0:`)(,^:) NB. cloaking f. as a verb A=. 5!:1< 'splitnostring' NB. not shown because is messy (B=. <@:fix'splitnostring') NB. boxing splitnostring ┌─────────────────────────────────────────────────────────────────────────────────┐ │#@[ }.&.> [ ((i.@#@] e. #@[ ({~^:a:&0@(,&_1)@(] I. +) { _1 ,~ ]) I.@E.) <;.1 ]) ,│ └─────────────────────────────────────────────────────────────────────────────────┘ stp=. ] (([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1 2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.&a:@:(<;._2@,~) ]) [ (0 0 $ 13!:8^:((0 e. ])`(12"_)))@:(2 -:/\ ])@:(".&.>)@:((10{a.) -.&a:@:(<;._2@,~) ]) ::(0 0&$@(1!:2&2)@:('Mismatch!'"_))) ".@:('0( : 0)'"_) stp 71 NB. recovering the verb A 5!:0 > B ) ┌────────┬─────┬──────────┬────────────┐ │Sentence│Space│Time │Space * Time│ ├────────┼─────┼──────────┼────────────┤ │A 5!:0 │6784 │5.33662e_6│0.0362036 │ ├────────┼─────┼──────────┼────────────┤ │> B │768 │6.05634e_7│0.000465127 │ └────────┴─────┴──────────┴────────────┘ Furthermore, one can produce tacit adverbs which refer tacitly to the arguments of the verbs that they produce. (I asked this question before: can one do that with the help of j90x enhanced retro-trains? I did not get an answer) One can also produce tacit adverbs which provide scope to anonymous recursive verbs defined using $:; so they can be embedded in other tacit anonymous verbs and work as intended. One can produce useful curried tacit adverbs of arbitrary (fixed or variable) arity, including fixed 2-arity adverbs (aka, double adverbs) which can be used as an alternative to tacit conjunctions (user-defined tacit conjunctions are not possible in j806 because the train (a c a) is absent) and allow one to write (nv nv a) instead of (nv c nv). Thus, j806 unorthodox tacit adverbial programming is complete. On Mon, Jan 16, 2023 at 8:35 PM Henry Rich <henryhr...@gmail.com> wrote: > > I have never understood the zeal for having verbs return verbs, but it > must be real if some are willing to use dangerous backdoor hacks into JE > to achieve it. ARs make it possible to pass verbs around, but executing > them requires dropping into explicit code. To remedy this, I offer a > proposal, backward compatible with older J: > > 1. (". y) and Apply (x 128!:2 y) to be modified so that if the result of > execution is not a noun, it is replaced by its AR (instead of '' as > previously). > > 2. (". y) and Apply to be modified so that if y (for ".) or x (for > Apply) is boxed, the sentence is executed as usual except that each box > is converted using (box 5!:0) before being put onto the execution stack. > > The idea is that you can execute (". > expr-producing-AR,exp-producing-AR,...) without having to get any > modifiers involved. > > Sentence execution can produce ARs, and can take ARs created by verbs to > represent verbs and modifiers. That sounds pretty classy to me, but I > don't know whether it's first-class. > > Henry Rich > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm