Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
J (programming language)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Verbs and Modifiers== A program or routine β something that takes data as input and produces data as output β is called a ''verb''. J has a rich set of predefined verbs, all of which work on multiple data types automatically: for example, the verb {{mono|i.}} searches within arrays of any size to find matches: <syntaxhighlight lang="j"> 3 1 4 1 5 9 i. 3 1 NB. find the index of the first occurrence of 3, and of 1 0 1 3 1 4 1 5 9 i: 3 1 NB. find the index of the last occurrence of 3, and of 1 0 3 </syntaxhighlight> User programs can be named and used wherever primitives are allowed. The power of J comes largely from its ''modifiers'': symbols that take nouns '''and verbs''' as operands and apply the operands in a specified way. For example, the modifier {{mono|/}} takes one operand, a verb to its left, and produces a verb that applies that verb between each item of its argument. That is, {{mono|+/}} is a verb, defined as 'apply {{mono|+}} between the items of your argument' Thus, the sentence <syntaxhighlight lang="j"> +/ 1 2 3 4 5 </syntaxhighlight> produces the effect of <syntaxhighlight lang="j"> 1 + 2 + 3 + 4 + 5 +/ 1 2 3 4 5 15 </syntaxhighlight> J has roughly two dozen of these modifiers. All of them can apply to any verb, even a user-written verb, and users may write their own modifiers. While modifiers are powerful individually, allowing * repeated execution, i. e. ''do-while'' * conditional execution, i. e. ''if'' * execution of regular or irregular subsets of arguments some of the modifiers control the order in which components are executed, allowing modifiers to be combined in any order to produce the unlimited variety of operations needed for practical programming.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
J (programming language)
(section)
Add topic