curry, rcurry - Generate a curried procedure
|
Calling Sequence
|
|
curry(p)
curry(p, rest)
rcurry(p)
rcurry(p, rest)
|
|
Parameters
|
|
p
|
-
|
procedure or name to be curried
|
rest
|
-
|
(optional) expression sequence of arguments to be curried over
|
|
|
|
|
Description
|
|
•
|
The procedure curry returns a procedure derived from its first argument p by currying on the remaining arguments, if any, in procedure application.
|
•
|
Given a Maple expression f (usually a procedure or a name), the curried procedure curry( f, x1, x2, ..., xn ) is the procedure g for which . In the case in which , currying on no arguments returns a procedure that calls f.
|
•
|
It is useful for producing a derived procedure from an existing one within the context of other commands such as map, zip, select, remove, and apply.
|
•
|
The procedure rcurry is similar to curry, but curries on the specified arguments from the right of the parameter list.
|
•
|
The definition of currying used here is adapted from "The Haskell 98 Report" ("The Haskell Language Report"), by Simon Peyton Jones, et. al. (http://haskell.org/onlinereport/)
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
>
|
|
| (2) |
>
|
|
>
|
|
| (3) |
>
|
|
>
|
|
| (4) |
>
|
|
>
|
|
| (5) |
>
|
|
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
>
|
|
| (9) |
>
|
|
| (10) |
Suppose you want to print a table, specified as a list of equations, in a neat form.
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
' .----.
( -.--.-
) -.--.-
, --..--
- -....-
. .-.-.-
/ -..-.
0 -----
1 .----
2 ..---
3 ...--
4 ....-
5 .....
6 -....
7 --...
8 ---..
9 ----.
: ---...
= -...-
? ..--..
a .-
b -...
c -.-.
d -..
e .
f ..-.
g --.
h ....
i ..
j .---
k -.-
l .-..
m --
n -.
o ---
p .--.
q --.-
r .-.
s ...
t -
u ..-
v ...-
w .--
x -..-
y -.--
z --..
| |
|
|
Download Help Document
Was this information helpful?