Difference between Operator and Function in APL?
3 posts
• Page 1 of 1
Difference between Operator and Function in APL?
Hi,
I've been reading Mastering Dyalog APL book and I am still not getting the difference between operator and function in APL.
When do you say something is an operator and something is a function in APL?
Thanks!
I've been reading Mastering Dyalog APL book and I am still not getting the difference between operator and function in APL.
When do you say something is an operator and something is a function in APL?
Thanks!
-
firesofmay - Posts: 7
- Joined: Sat Jun 27, 2015 2:50 pm
Re: Difference between Operator and Function in APL?
A function takes array argument(s) and produces an array result; an operator takes array or function argument(s) and usually produces a function, which can then be applied to arrays to produce array results. (Primitive operators always produce a function result.)
Operators are a powerful and useful concept and efficiently connect related concepts. They are closely related to the idea of adverbs in natural languages (and functions related to verbs): run quickly, think quickly, type quickly; run slowly, run efficiently, run haphazardly. If you have n symbols you can use them to define n functions, or n÷2 functions and n÷2 operators and thereby getting (n÷2)+(n*2)÷4 functions. (Even more if the operators are dyadic.)
An operator induces a family of functions: +/, ⌈/, ×/, ∧/, ∨/, etc. Once you've understood how / works on one function (e.g. +/ is summation), you'd have a pretty good handle on how it works on other functions (×/ is product, ⌈/ is maximum, and so on).
Operators are a powerful and useful concept and efficiently connect related concepts. They are closely related to the idea of adverbs in natural languages (and functions related to verbs): run quickly, think quickly, type quickly; run slowly, run efficiently, run haphazardly. If you have n symbols you can use them to define n functions, or n÷2 functions and n÷2 operators and thereby getting (n÷2)+(n*2)÷4 functions. (Even more if the operators are dyadic.)
An operator induces a family of functions: +/, ⌈/, ×/, ∧/, ∨/, etc. Once you've understood how / works on one function (e.g. +/ is summation), you'd have a pretty good handle on how it works on other functions (×/ is product, ⌈/ is maximum, and so on).
- Roger|Dyalog
- Posts: 238
- Joined: Thu Jul 28, 2011 10:53 am
Re: Difference between Operator and Function in APL?
Thanks Roger for the wonderful explanation.
That helped me in getting the basic difference between the two.
That helped me in getting the basic difference between the two.
-
firesofmay - Posts: 7
- Joined: Sat Jun 27, 2015 2:50 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group