Category:J: Difference between revisions
Content added Content deleted
(Provide some minor help for the person interested in translating to or from J) |
|||
Line 30: | Line 30: | ||
== Reading J == |
== Reading J == |
||
J is meant to be read with the aid of a computer. J sentences are single lines and trying variations and simplifications of an expression is common practice. The first step in understanding any J sentence is to understand the data you started with and the data which resulted. |
J is meant to be read with the aid of a computer. J sentences are single lines and trying variations and simplifications of an expression is common practice. The first step in understanding any J sentence is to understand the data you started with and the data which resulted. When learning how a J sentence works, you can also try simpler sentences which the same data or perhaps related data. |
||
Unless you attend an institution which has made a J interpreter available to you through your web browser, if you want to see how J works you should probably [http://www.jsoftware.com/stable.htm install] a copy of J. If you want to understand how to experiment with alternative expressions you should probably study some of its [http://www.jsoftware.com/jwiki/Guides/Getting%20Started#Documentation documentation]. |
Unless you attend an institution which has made a J interpreter available to you through your web browser, if you want to see how J works you should probably [http://www.jsoftware.com/stable.htm install] a copy of J. If you want to understand how to experiment with alternative expressions you should probably study some of its [http://www.jsoftware.com/jwiki/Guides/Getting%20Started#Documentation documentation]. |
||
For example, the phrase [code](+/ % #)[/code] finds the average of a list of numbers. |
|||
<lang J> (+/ % #) 1 2 3 |
|||
2</lang> |
|||
To understand how this works, you might try working with simpler sentences and their variations. |
|||
<lang J> +/ 1 2 3 |
|||
6 |
|||
+/4 5 6 |
|||
15 |
|||
# 1 2 3 |
|||
3 |
|||
# 2 3 4 |
|||
3 |
|||
6 % 3 |
|||
2 |
|||
15 % 3 |
|||
5 |
|||
(+/ % #) 4 5 6 |
|||
15</lang> |
|||
By themselves, these experiments mean nothing, but if you know that +/ was finding the sum of a list and # was finding the length of a list and that % was dividing the two quantities (and looks almost like one of the classical division symbols) then these experiments might help confirm that you have understood things properly. |
|||
== J on RosettaCode == |
== J on RosettaCode == |