Yeah, "operator" is kind of strange terminology. But arrays are simple - any array argument to a function should always have the same result. So, ? is not a function (except for arrays which contain nothing other than 1s), but % is a function.
Thanks, -- Raul On Thu, Nov 23, 2017 at 5:51 PM, Don Guinn <[email protected]> wrote: > That's the one I remember from college. Not sure how it should be extended > to arrays like J does. But "operator" is the one who's definition that goes > all over the place. > > On Thu, Nov 23, 2017 at 3:17 PM, Raul Miller <[email protected]> wrote: > >> When I was in college, I was taught that a function is a relation >> between domain and range where each item in the domain corresponds to >> exactly one item in the range. >> >> (Some people call domain "input" and range "output".) >> >> Thanks, >> >> -- >> Raul >> >> >> On Thu, Nov 23, 2017 at 3:31 PM, Don Guinn <[email protected]> wrote: >> > Years ago got involved with what functions and operators are. I don't >> > remember them being defined when I was in school. Teachers just started >> > using the names. So, I got hold of several textbooks from early >> elementary >> > school to college looking for definitions. Never found one. Googled it. >> > Lots more than I ever wanted to know. >> > >> > On Thu, Nov 23, 2017 at 1:17 PM, Raul Miller <[email protected]> >> wrote: >> > >> >> Note that verbs, adverbs and conjunctions are all functions. This >> >> includes both the primitive, derived tacit and explicit variants. >> >> Also, gerunds represent functions. >> >> >> >> That said, the definition of a first class citizen at >> >> https://en.wikipedia.org/wiki/First-class_citizen seems hostile to >> >> some concepts of pure functional languages. In particular, the >> >> requirement that first class citizens be "modifiable". So I'd be a bit >> >> hesitant to rely on that conception. >> >> >> >> Thanks, >> >> >> >> -- >> >> Raul >> >> >> >> On Thu, Nov 23, 2017 at 10:25 AM, Erling Hellenäs >> >> <[email protected]> wrote: >> >> > Hi all! >> >> > >> >> > https://en.wikipedia.org/wiki/Scope_(computer_science)# >> >> Lexical_scope_vs._dynamic_scope >> >> > >> >> > AddScan =: 3 : 0 >> >> > add=.4 : 'x + y' >> >> > add/\y >> >> > ) >> >> > AddScan 2 3 4 >> >> > 2 5 9 >> >> > >> >> > I don't understand how your example shows lexically scoped functions, >> >> but as >> >> > far as I understand, "add" in the example above is an explicit >> >> definition of >> >> > a lexically scoped function. >> >> > >> >> > I don't think functions are first class citizens in J according to >> this >> >> > definition. https://en.wikipedia.org/wiki/First-class_citizen >> >> > >> >> > Functions can not return functions. They can take functions as >> arguments, >> >> > but resolution is normally done in some pre-interpretation stage, like >> >> with >> >> > macros in other languages. >> >> > >> >> > There are ways in explicit code to establish functions from from ascii >> >> > representation in runtime. Here is an example: >> >> > >> >> > Scan =: 3 : 0 >> >> > a=.1!:1 [1 >> >> > f=. a 5!:0 >> >> > f/\y >> >> > ) >> >> > Scan 2 3 4 >> >> > * >> >> > 2 6 24 >> >> > Scan 2 3 4 >> >> > + >> >> > 2 5 9 >> >> > >> >> > This function establishes a function from terminal ascii input. >> >> > >> >> > So, with explicit code you can manipulate ascii representations of >> >> functions >> >> > and create new functions at what is similar to "runtime". You can pass >> >> these >> >> > ascii representations as variables. The functions you create can be >> used >> >> as >> >> > parameters to functions, as the example shows. >> >> > >> >> > Cheers, >> >> > >> >> > Erling Hellenäs >> >> > >> >> > >> >> > Den 2017-11-21 kl. 19:56, skrev Alex Shroyer: >> >> >> >> >> >> @AndrewD: I've been using J casually for about 2 years, and consider >> >> >> myself >> >> >> an "intermediate beginner". I also use Python, and my impression is >> >> that >> >> >> Python makes it easy to see what the author *wanted* the program to >> do, >> >> >> but >> >> >> J makes it easier to see what the program *actually does*. >> >> >> >> >> >> However, one frustration I still have is regarding explicit >> definitions. >> >> >> IMO they should be replaced with something more like what the K >> language >> >> >> provides, namely first-class, lexically-scoped functions: >> >> >> >> >> >> add: {x+y} >> >> >> scan: {x\y} >> >> >> scan [add; 2 3 4] >> >> >> 2 5 9 >> >> >> >> >> >> Perhaps J's syntax could be extended someday, to recognize this type >> of >> >> >> function in an explicit definition, for example: >> >> >> >> >> >> add =: dyad def 'x+y' >> >> >> scan =: HOF def 'x\y' NB. in this scheme, HOF stands for >> >> >> 'higher-order >> >> >> function' and tells interpreter to not evaluate x or y until both >> >> >> arguments >> >> >> are bound >> >> >> add scan 2 3 4 >> >> >> 2 5 9 >> >> >> >> >> >> There are a few other things I'd like J to take from K, but that's >> the >> >> big >> >> >> one. >> >> >> >> >> >> On Mon, Nov 20, 2017 at 11:16 AM, chris burke <[email protected]> >> >> >> wrote: >> >> >> >> >> >>> Dear All >> >> >>> >> >> >>> My attempt to move this thread over to programming failed, but >> please >> >> >>> note >> >> >>> for future use that discussions like this on the language are much >> >> better >> >> >>> addressed to the programming forum. Not least, they will then reach >> >> all J >> >> >>> forum readers, not just those subscribed to general. See >> http://code. >> >> >>> jsoftware.com/wiki/System/Forums . >> >> >>> >> >> >>> Thanks. >> >> >>> >> >> >>> Chris >> >> >>> ------------------------------------------------------------ >> ---------- >> >> >>> 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 >> >> >> > ---------------------------------------------------------------------- >> > 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
