https://wiki.haskell.org/api.php?action=feedcontributions&user=JohnScholes&feedformat=atomHaskellWiki - User contributions [en]2024-03-19T11:44:21ZUser contributionsMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=Talk:APL&diff=56859Talk:APL2013-09-17T08:03:13Z<p>JohnScholes: </p>
<hr />
<div>=Array Languages=<br />
<br />
Array languages, such as APL, J and K, seem to be characterised by:<br />
* Having a very simple and uniform syntax.<br />
* Employing a terse lexical style.<br />
* Making all primitive functions take and return whole arrays.<br />
* Hiding from the programmer implementation details such as internal numeric types.<br />
Array language proponents claim that these properties have a profound effect on productivity, freeing up the programmer to think at a higher level by avoiding the distractions of several levels of programming minutiae.<br />
<br />
=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array. The <i>rank</i> of an array is its number of axes (dimensions); the <i>shape</i> of an array is a vector of its axis lengths.<br />
<br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
* APL recycles the word <i>scalar</i> to mean rank-0 array; <i>vector</i> and <i>matrix</i> are used for arrays of rank 1 and 2 respectively.<br />
* A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br />
* A length-0 character vector is distinct from a length-0 numeric vector.<br />
The article [http://archive.vector.org.uk/art10500690 <i>What is an Array?</i>] in the APL Journal <i>Vector</i> talks more about this topic.<br />
<br />
Functions: infix, associate <b>right</b> with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
<br><br />
Operators: infix, associate <b>left</b> with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
Defined functions and operators enjoy the same calling syntax as their primitive counterparts.<br><br />
See YouTube: [http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 <i> Conway's Game of Life in APL</i>] and [http://www.youtube.com/watch?v=DmT80OseAGs <i> A Sudoku Solver in APL</i>] for a flavour of APL<br />
<br />
<b>Additional Resources</b><br />
<br />
* [http://www.jsoftware.com/papers/tot.htm <i>Notation as a Tool of Thought</i>], Ken Iverson's 1979 Turing Award Lecture<br />
* [http://kparc.com/ k programming language]<br />
* [http://www.jsoftware.com/help/dictionary/dict.htm J programming language]<br />
* [http://www.jsoftware.com/jwiki/Essays J Wiki Essays], examples of using J<br />
* [http://dfns.dyalog.com D-Functions] Dyalog APL samples and musings<br />
* [http://tryapl.org TryAPL] play with APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44999Talk:APL2012-03-25T11:13:06Z<p>JohnScholes: /* APL for Haskell-ers */</p>
<hr />
<div>=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array. The <i>rank</i> of an array is its number of axes (dimensions); the <i>shape</i> of an array is a vector of its axis lengths.<br />
<br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
* APL recycles the word <i>scalar</i> to mean rank-0 array; <i>vector</i> and <i>matrix</i> are used for arrays of rank 1 and 2 respectively.<br />
* A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br />
* A length-0 character vector is distinct from a length-0 numeric vector.<br />
The article [http://archive.vector.org.uk/art10500690 <i>What is an Array?</i>] in the APL Journal <i>Vector</i> talks more about this topic.<br />
<br />
Functions: infix, associate <b>right</b> with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
<br><br />
Operators: infix, associate <b>left</b> with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
Defined functions and operators enjoy the same calling syntax as their primitive counterparts.<br><br />
See YouTube: [http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 <i> Conway's Game of Life in APL</i>] for a flavour of APL<br />
<br />
<b>Additional Resources</b><br />
<br />
* [http://www.jsoftware.com/papers/tot.htm <i>Notation as a Tool of Thought</i>], Ken Iverson's 1979 Turing Award Lecture<br />
* [http://kparc.com/ k programming language]<br />
* [http://www.jsoftware.com/help/dictionary/dict.htm J programming language]<br />
* [http://www.jsoftware.com/jwiki/Essays J Wiki Essays], examples of using J<br />
* [http://dfns.dyalog.com D-Functions] Dyalog APL samples and musings<br />
* [http://tryapl.org TryAPL] play with APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44838Talk:APL2012-03-11T13:08:20Z<p>JohnScholes: /* APL for Haskell-ers */</p>
<hr />
<div>=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array. The <i>rank</i> of an array is its number of axes (dimensions); the <i>shape</i> of an array is a vector of its axis lengths.<br />
<br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
* APL recycles the word <i>scalar</i> to mean rank-0 array; <i>vector</i> and <i>matrix</i> are used for arrays of rank 1 and 2 respectively.<br />
* A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br />
* A length-0 character vector is distinct from a length-0 numeric vector.<br />
The article [http://archive.vector.org.uk/art10500690 <i>What is an Array?</i>] in the APL Journal <i>Vector</i> talks more about this topic.<br />
<br />
Functions: infix, associate <b>right</b> with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
<br><br />
Operators: infix, associate <b>left</b> with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
Defined functions and operators enjoy the same calling syntax as their primitive counterparts.<br><br />
See YouTube: [http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 <i> Conway's Game of Life in APL</i>] for a flavour of APL<br />
<br />
<b>Additional Resources</b><br />
<br />
* [http://www.jsoftware.com/papers/tot.htm <i>Notation as a Tool of Thought</i>], Ken Iverson's 1979 Turing Award Lecture<br />
* [http://kparc.com/ k programming language]<br />
* [http://www.jsoftware.com/help/dictionary/dict.htm J programming language]<br />
* [http://www.jsoftware.com/jwiki/Essays J Wiki Essays], examples of using J<br />
* [http://dfns.dyalog.com D-Functions] Dyalog APL samples and musings<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44823Talk:APL2012-03-09T16:33:22Z<p>JohnScholes: /* APL for Haskell-ers */</p>
<hr />
<div>=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array.<br><br />
The <i>rank</i> of an array is its number of axes (dimensions).<br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
* APL recycles the word <i>scalar</i> to mean rank-0 array; <i>vector</i> and <i>matrix</i> are used for arrays of rank 1 and 2 respectively.<br />
* A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br />
* A length-0 character vector is distinct from a length-0 numeric vector.<br />
The article [http://archive.vector.org.uk/art10500690 <i>What is an Array?</i>] in the APL Journal <i>Vector</i> talks more about this topic.<br />
<br />
Functions: infix, associate <b>right</b> with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
<br><br />
Operators: infix, associate <b>left</b> with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
Defined functions and operators enjoy the same calling syntax as their primitive counterparts.<br><br />
See YouTube: [http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 <i> Conway's Game of Life in APL</i>] for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44822Talk:APL2012-03-09T16:23:32Z<p>JohnScholes: /* APL for Haskell-ers */</p>
<hr />
<div>=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array.<br><br />
The <i>rank</i> of an array is its number of axes (dimensions).<br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
* APL recycles the word <i>scalar</i> to mean rank-0 array; <i>vector</i> and <i>matrix</i> are used for arrays of rank 1 and 2 respectively.<br />
* A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br />
* A length-0 character vector is distinct from a length-0 numeric vector.<br />
The article [http://archive.vector.org.uk/art10500690 <i>What is an Array?</i>] in the APL Journal <i>Vector</i> talks more about this topic.<br />
<br />
Functions: infix, associate <b>right</b> with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate <b>left</b> with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See YouTube: [http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 <i> Conway's Game of Life in APL</i>] for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44815Talk:APL2012-03-08T21:25:46Z<p>JohnScholes: /* APL for Haskell-ers */</p>
<hr />
<div>=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes, where an item is a number, a character or an array.<br><br />
The "rank" of an array is its number of axes (dimensions).<br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
NB: APL recycles the word "scalar" to mean rank-0 array. Terms "vector" and "matrix" are used for arrays of rank 1 and 2 respectively.<br><br />
NB: A matrix with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br><br />
NB: A length-0 character vector is distinct from a length-0 numeric vector.<br><br />
<br><br />
Functions: infix, associate RIGHT with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate LEFT with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44811Talk:APL2012-03-08T20:01:40Z<p>JohnScholes: /* APL for Haskell-ers (please improve) */</p>
<hr />
<div>=APL for Haskell-ers=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes,<br><br />
where an item is a number, a character or an array.<br><br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
NB: APL recycles the word "scalar" to mean rank-0 array.<br><br />
NB: A matrix (rank-2 array) with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br><br />
NB: A length-0 character vector is distinct from a length-0 numeric vector.<br><br />
<br><br />
Functions: infix, associate RIGHT with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate LEFT with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44808Talk:APL2012-03-08T19:44:59Z<p>JohnScholes: /* APL for Haskell-ers (please improve) */</p>
<hr />
<div>=APL for Haskell-ers (please improve)=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes,<br><br />
where an item is a number, a character or an array.<br><br />
Everything is an array. There is no access to underlying scalars!<br><br />
Arrays of non-uniform type are used to model tuples.<br><br />
NB: APL recycles the word "scalar" to mean rank-0 array.<br><br />
NB: A matrix (rank-2 array) with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br><br />
NB: A length-0 character vector is distinct from a length-0 numeric vector.<br><br />
<br><br />
Functions: infix, associate RIGHT with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate LEFT with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44807Talk:APL2012-03-08T18:26:08Z<p>JohnScholes: /* APL for Haskell-ers (please improve) */</p>
<hr />
<div>=APL for Haskell-ers (please improve)=<br />
<br />
Arrays: rectanglar collection of items arranged along 0 or more axes,<br><br />
where an item is a number, a character or an array.<br><br />
Everything is an array. There is no access to underlying scalars!<br><br />
NB: APL recycles the word "scalar" to mean rank-0 array.<br><br />
NB: A matrix (rank-2 array) with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br><br />
NB: A length-0 character vector is distinct from a length-0 numeric vector.<br><br />
<br><br />
Functions: infix, associate RIGHT with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate LEFT with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44806Talk:APL2012-03-08T18:25:29Z<p>JohnScholes: /* APL for Haskell-ers (please improve) */</p>
<hr />
<div>=APL for Haskell-ers (please improve)=<br />
<br />
Array: rectanglar collection of items arranged along 0 or more axes,<br><br />
where an item is a number, a character or an array.<br><br />
Everything is an array. There is no access to underlying scalars!<br><br />
NB: APL recycles the word "scalar" to mean rank-0 array.<br><br />
NB: A matrix (rank-2 array) with 3 rows and 0 columns is distinct from one with 0 rows and 3 columns.<br><br />
NB: A length-0 character vector is distinct from a length-0 numeric vector.<br><br />
<br><br />
Function: infix, associate RIGHT with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate LEFT with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholeshttps://wiki.haskell.org/index.php?title=Talk:APL&diff=44805Talk:APL2012-03-08T18:24:20Z<p>JohnScholes: First cut of a cultural introduction between APL and Haskell</p>
<hr />
<div>=APL for Haskell-ers (please improve)=<br />
<br />
Array: rectanglar collection of items arranged along 0 or more axes,<br><br />
where an item is a number, a character or an array.<br><br />
Everything is an array. There is no access to underlying scalars!<br><br />
NB: APL recycles the word "scalar" to mean rank-0 array.<br><br />
NB: A matrix (rank-2 array) with 3 rows and 0 columns is distinct from one with 0 rows and 4 columns.<br><br />
NB: A length-0 character vector is distinct from a length-0 numeric vector.<br><br />
<br><br />
Function: infix, associate RIGHT with equal precedence.<br><br />
Functions consume array "arguments" and return array results.<br><br />
A "monadic" function is one that takes only a right argument.<br><br />
Defined functions enjoy the same syntax as primitive functions.<br><br />
<br><br />
Operators: infix, associate LEFT with equal precedence.<br><br />
Operators bind with array or function "operands" to form functions.<br><br />
A monadic operator takes only a left operand.<br><br />
<br><br />
Operator-operand binding is stronger than function-argument binding.<br><br />
APL has only a single level of high-order function.<br><br />
<br><br />
There is a rich set of primitive functions and operators.<br><br />
See http://www.youtube.com/watch?fmt=18&gl=GB&hl=en-GB&v=a9xAKttWgP4 for a flavour of APL<br />
<br />
=Haskell for APL-ers (please improve)=<br />
<br />
Haskell is a pure, strongly-typed, lazy functional language. A function's result is determined only by its arguments and there are no side-effects.<br><br />
While APL has only arrays, Haskell has:<br><br />
- Lists: [1, 2, 3]<br><br />
- Tuples: (2.3, "Haskell")<br><br />
and arbitrarily high high-order functions. The syntax allows functions to take functions as arguments and to return them as results, so it doesn't need APL's distinction between functions and operators.<br><br />
Unlike APL's arrays, the items of a list must all be of the same type, so you can't, for example, have a list whose first item is a number and its second a character string. There is exactly one flavour of empty list: [].<br><br />
We can combine the above structures to form lists-of-tuples; tuples-of-lists-of-functions; and so on.<br><br />
The term "monadic" in Haskell bears no relation to its use in APL as a function with only a right argument.<br><br />
The GHC Haskell compiler is able to represent vectors in contiguous memory locations and so access items in O(1) time.<br><br />
See ???????? for a flavour of Haskell<br></div>JohnScholes