Well.. hmm...
First off, I have made mistakes in previous posts. I think that the
old t. primitive has yet to receive a library implementation. That's
on my personal "things I would like to do" list. This may be relevant
here, given your reference to past discussions. I vaguely remember
making incorrect statements about lack of library support for removed
primitives.. I have not dug far enough here to know whether that's
relevant in this context or not.
Second, though, given your work with "cloaked verbs", hearing that the
interpreter shut down isn't surprising -- that has also been my
experience when working with such things.
But I would be surprised if manipulating regular gerunds would shut
down the interpreter. (These sorts of bugs might exist, but with a
good bug report, they would get fixed. But, ... that might close the
"cloaked verb" loophole, I guess.)
Anyways, this worked;
({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
0
({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
1542
({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
5
({{(x`:6)@:(y`:6)`''}}/20#?`'')`:6(1e8)
0.184449
And, I guess I could elaborate on that by building larger trains.
For example:
({{(x`:6)@:(y`:6)`''}}/200#(200$[`])`:6`'')`:6] 12345
12345
Or
({{(x`:6)@:(y`:6)`''}}/200#(200$+`%)`:6`'')`:6] 1
223.787
This was rather slow -- which should probably be expected from that
stepwise generation of a gerund containing 40000 verbs. But it did not
shut down J.
FYI,
--
Raul
On Sun, Jan 22, 2023 at 1:21 PM Jose Mario Quintana
<[email protected]> wrote:
>
> I am replying inline...
>
> On Sun, Jan 15, 2023 at 6:09 PM Raul Miller <[email protected]> wrote:
> >
> > On Sun, Jan 15, 2023 at 3:38 PM Jose Mario Quintana
> > <[email protected]> wrote:
> > > I am aware that BQN has first-class functions. Is there any other array
> > > language that also has them?
> >
> > In this context, a mozilla page on "first class functions" is interesting:
> >
> > https://developer.mozilla.org/en-US/docs/Glossary/First-class_Function
> >
> > "A programming language is said to have First-class functions when
> > functions in that language are treated like any other variable. For
> > example, in such a language, a function can be passed as an argument
> > to other functions, can be returned by another function and can be
> > assigned as a value to a variable."
> >
> > ---------
> >
> > Here, BQN uses upper case vs. lower case to distinguish the role of a
> > function definition (roughly analogous to distinguishing between a
> > gerund and its verb form).
>
> Right, I personally do not like too much that convention; in general, I use
> lowercase names for functions and uppercase names for nouns (which I seldom
> use).
>
> >
> > From a user perspective this is largely a syntactic issue (though, of
> > course, there's also implementation issues).
>
> The key word is "largely." Any gerund still is a noun; thus, gerunds are
> just representations of their associated functions.
>
> >
> > ---------
> >
> > The K/Q approach is also interesting here. (K is a family of languages
> > rather than a single language -- it's intentionally undocumented with
> > large differences between releases, and Q is (somewhat more stably)
>
> There is a fair amount of q documentation here,
>
> Reference card | kdb+ and q documentation - Kdb+ and q documentation
> (kx.com) <https://code.kx.com/q/ref/>
>
> > implemented in K.) Here, arrays are themselves "first class functions"
> > -- specifically indexing a list has the same syntax as calling a
> > function. There's no rank (all arrays are rank 1, though they may
>
> Right, since there are list of lists of ... ;so, that does seem to be a big
> issue (although one would have to write, for example, verbs for matrix
> multiplication and inverse unless a suitable library is available).
>
> > contain arrays analogous to J's boxing) and K's monadic verbs support
> > a multi-argument sort of valence analogous to APL's multi-dimensional
> > indexing A[1 2 3; 4 5 6;7 8 9] for example. And you might get into
> > different operators when applying "functions" to values (though,
> > because of the many versions, it's difficult to describe this
> > comprehensively).
>
> Lo and behold, q verbs are genuinely first-class, they can take and produce
> verbs and, apparently, is the recommended way to program functionally in q.
> The following is a toy example to illustrate the method by calculating a
> sum of squares,
>
> q){x y z}[(+/);{x xexp 2}]
> {x y z}[+/;{x xexp 2}]
> q)({x y z}[(+/);{x xexp 2}]) 1 2 3 4 / redundant parentheses for clarity
> 30f
>
> or one could use the built-in keyword ' instead of {x y z}. In j, of
> course, one can do this,
>
> +/@:*:
> +/@:*:
> (+/@:*:) 1 2 3 4
> 30
>
> Yet, there is a subtle potentially critical difference, the q version {x y
> z} is dynamic, but the j version @: is not because @: is a conjunction (not
> surprisingly, tacit j8xx dynamic versions are possible when black cats are
> involved).
>
> >
> > ---------
> >
> > Anyways, ... I guess one of the things which makes J's gerunds be
> > considered as "not first class" is that they have a unique syntax
> > which must be used when we consider them as verb definitions -- more
> > specifically we can't use some of this syntax with actual verb
> > definitions. (Interestingly, in some contexts, this distinction
> > vanishes. So in those contexts we might consider verbs as first class
> > while thinking of adverbs and conjunctions as not first class.)
> >
>
> Some time ago we had a similar discussion, I mentioned that, in my opinion,
> the j9xx tacit tools were relatively weak and I proposed an exercise that
> was just beyond trivial,
>
> [Jchat] Was [Jprogramming] Tacit completeness (jsoftware.com)
> <http://www.jsoftware.com/pipermail/chat/2021-December/009017.html>
>
> Unfortunately, the j903 calculus add-on was unusable for that purpose. I
> wonder if some progress has been made.
>
> Perhaps, this thread should be moved to the Chat forum although I would
> like to see some j90x code here; but, I will let others decide.
>
> > 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