Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
FP (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Functionals== In contrast to primitive functions, functionals operate on other functions. For example, some functions have a ''unit'' value, such as 0 for ''addition'' and 1 for ''multiplication''. The functional '''unit''' produces such a '''value''' when applied to a '''function f''' that has one: '''unit +''' = 0 '''unit Γ''' = 1 '''unit foo''' = β₯ These are the core functionals of FP: '''composition''' '''f'''β'''g''' where '''f'''β'''g''':'''x''' = '''f''':('''g''':'''x''') '''construction''' ['''f'''<sub>1</sub>,...,'''f'''<sub>n</sub>] where ['''f'''<sub>1</sub>,...,'''f'''<sub>n</sub>]:'''x''' = γ'''f'''<sub>1</sub>:'''x''',...,'''f'''<sub>n</sub>:'''x'''γ '''condition''' ('''h''' β '''f''';'''g''') where ('''h''' β '''f''';'''g'''):'''x''' = '''f''':'''x''' if '''h''':'''x''' = '''T''' = '''g''':'''x''' if '''h''':'''x''' = '''F''' = '''β₯''' otherwise '''apply-to-all''' ''Ξ±'''''f''' where ''Ξ±'''''f''':γ'''x'''<sub>1</sub>,...,'''x'''<sub>n</sub>γ = γ'''f''':'''x'''<sub>1</sub>,...,'''f''':'''x'''<sub>n</sub>γ '''insert-right''' /'''f''' where /'''f''':γ'''x'''γ = '''x''' and /'''f''':γ'''x'''<sub>1</sub>,'''x'''<sub>2</sub>,...,'''x'''<sub>n</sub>γ = '''f''':γ'''x'''<sub>1</sub>,/'''f''':γ'''x'''<sub>2</sub>,...,'''x'''<sub>n</sub>γγ and /'''f''':γ γ = '''unit f''' '''insert-left''' \'''f''' where \'''f''':γ'''x'''γ = '''x''' and \'''f''':γ'''x'''<sub>1</sub>,'''x'''<sub>2</sub>,...,'''x'''<sub>n</sub>γ = '''f''':γ\'''f''':γ'''x'''<sub>1</sub>,...,'''x'''<sub>n-1</sub>γ,'''x'''<sub>n</sub>γ and \'''f''':γ γ = '''unit f'''
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)