On Sun, Jan 15, 2023 at 3:38 PM Jose Mario Quintana
<jose.mario.quint...@gmail.com> 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).

From a user perspective this is largely a syntactic issue (though, of
course, there's also implementation issues).

---------

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

---------

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

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to