User:Devon McCormick/FunctionalJ
Introduction
J: A Dynamic, Functional Language
J is a radically innovative, dynamic, functional, interpreted, interactive, array-based, multi-platform, open-source, mind-blowing notation that also happens to be implemented as a powerful, productivity-enhancing programming language.
The Entire J Language
The entire language fits on one page.
What is notation and why should we care?
Chunking – another reason notation is important
By grouping concepts and subsuming them into “chunks”, we overcome the limitations of short-term memory. A notation is often an effective way to do this. Another technique for accomplishing this is the development of a specialized vocabulary.
An example of a technical term which encapsulates a lot of meaning into a short phrase is “Hello, World” example. Keep an eye out for this example in the following expositions in which we demonstrate various features of J. We’ll start by learning some specialized J terms.
J Terms: noun, verb, monadic, dyadic, boxed
…Cognitive Tidbit
Resuming… (Definition of "Boxed")
Arrays
Precedence – Order of Operations
J Terms: adverb, conjunction
Calling them higher-order functions just isn't good enough - we need to be able to talk about them precisely.
…Cognitive Tidbit : Great Big Numbers
Someone else appreciating the power of notation.
Resuming… (Definition of "Conjunction")
J Terms: hook, fork
J Term: rank
(the last two) J Terms: explicit, tacit
Converting Between Explicit and Tacit: a Crutch "13 : "
Summary of J Terms
Example of a User-defined Adverb: a Newton Solver
Functional Programming: Procedural Contrasted with Array-based
Paul Hudak, one of the early promoters of functional programming in general and Haskell in particular, wrote a paper titled "Conception, Evolution, and Application of Functional Programming Languages" (ACM Computing Surveys, Vol. 21, No. 3, September 1989) in which he mentions APL as one of the early functional languages. However, he says little about it other than giving it as an example of a functional language that doesn't rely on lambda expressions.
He also notes how it differs from other functional programming languages like Backus's FP because "...FP's fundamental data structure is the sequence, whereas APL's is the array." However, he seems unaware of how significant this is which is understandable given the traditional blind spot of Computer Science toward the importance and utility of array notation.
Since one example is worth a hundred abstract definitions, we'll look at how a procedural - or sequence-based - implementation of an algorithm might differ from an array-based one by implementing the same simulation in the two different fashions.
Procedural Simulation of "Red or Black" Game
Array-based Simulation of "Red or Black" Game
J’s Numeric Tower
Though J has only three types - numeric, character, and boxed - there are numerous different kinds of numbers. The character type also supports Unicode as well as single-byte characters. The "tower" here builds from a base of the simplest to the (arguably) most complex numeric sub-types supported by J.
complex 2j32 186j413 3798j94357 627j3 1440j6 floating point 2.3218 641.3379 89.4357 62731.44060134 extended integer 232186413379894357 627314406013472791111 rational 23r218641 3r37 989r4357 627r314 40r601 3r4 integer 2321 86 4133798 94357 6273 1440 601 34 72 79 boolean 0 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0
There are a few other numeric notations within J not shown here, including notations for numbers based on pi and on radians.
J Resources
Join the J Forums (mailing lists) –
- programming - the main forum, covering J programming from beginner to expert, and announcements
- beta - current beta (bugs, problems, suggestions)
- chat - all other discussions on computer languages and J - messages welcomed from both J and non-J programmers
- general - installation, support, website and other infrastructure topics
- source - J engine source
The J Meetup - http://www.meetup.com/J-Dynamic-Functional-Programming, also http://www.jsoftware.com/jwiki/NYCJUG
J Software - http://www.jsoftware.com/
J Wiki - http://www.jsoftware.com/jwiki/FrontPage
Notation as a Tool of Thought - http://www.jsoftware.com/papers/tot.htm
The Joy of Functional Calculation - http://archive.vector.org.uk/art10500630
Bowling scores in J and other languages - http://xprogramming.com/articles/dbcbowlingvector/
Criticisms of J for beginners - http://www.jsoftware.com/jwiki/JforBeginnersCriticisms
Functional programming example - Simplex method - http://www.jsoftware.com/jwiki/Stories/RichardBrown
Fractals, Visualization and J by Cliff Reiter - available on Lulu.com
Cliff's animated Sierpinski pyramid - http://webbox.lafayette.edu/~reiterc/misc_frac/swaa.html
Cliff's gallery of fractals - http://webbox.lafayette.edu/~reiterc/gallery_wfrac.html
Complete gallery - http://webbox.lafayette.edu/~reiterc/gallery.html
Vector magazine of the British APL Association - https://sites.google.com/site/baavector/home
J in a Day - http://www.jsoftware.com/jwiki/IanClark/JinaDay
Oleg's J page - http://olegykj.sourceforge.net/
Books on J - http://www.jsoftware.com/jwiki/Books
This presentation - http://www.jsoftware.com/jwiki/DevonMcCormick/FunctionalJ
Attachments
Here's the handout for the talk.
File:JFunctionalMeetupIntro.pdf
Here's an example I added at the end of the talk - it contrasts an example of functional programming in a more conventional, procedural style against an array-based version which looks and performs considerably better.
File:The Red or Black Game Simulated Functionally by both procedure and array.pdf
Here are the slides from my PowerPoint presentation...