How to resolve the algorithm Partial function application step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Partial function application step by step in the Quackery programming language
Table of Contents
Problem Statement
Partial function application is the ability to take a function of many parameters and apply arguments to some of the parameters to create a new function that needs only the application of the remaining arguments to produce the equivalent of applying all arguments to the original function. E.g:
Note that in the partial application of a parameter, (in the above case param1), other parameters are not explicitly mentioned. This is a recurring feature of partial function application.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Partial function application step by step in the Quackery programming language
Source code in the quackery programming language
[ [] unrot
swap nested
' join nested
join nested
' witheach nested
swap join
do ] is fs ( f s --> [ )
[ 2 * ] is f1 ( n --> n )
[ 2 ** ] is f2 ( n --> n )
[ ' f1 swap fs ] is fsf1 ( s --> [ )
[ ' f2 swap fs ] is fsf2 ( s --> [ )
' [ 0 1 2 3 ] fsf1 echo cr
' [ 0 1 2 3 ] fsf2 echo cr
' [ 2 4 6 8 ] fsf1 echo cr
' [ 2 4 6 8 ] fsf2 echo cr
( ... or, using Quackery's partial applicator "witheach",
which applies the word or nest following it to each
item in a nest on the top of the stack ... )
cr
' [ [ 0 1 2 3 ] [ 2 4 6 8 ] ]
witheach
[ dup ' [ fsf1 fsf2 ]
witheach [ do echo cr ] ]
You may also check:How to resolve the algorithm Loops/Continue step by step in the Fortran programming language
You may also check:How to resolve the algorithm Array concatenation step by step in the Klong programming language
You may also check:How to resolve the algorithm Roots of unity step by step in the CoffeeScript programming language
You may also check:How to resolve the algorithm Hickerson series of almost integers step by step in the Go programming language
You may also check:How to resolve the algorithm Program name step by step in the Elena programming language