How to resolve the algorithm Partial function application step by step in the Bracmat programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Partial function application step by step in the Bracmat 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 Bracmat programming language

Source code in the bracmat programming language

( (fs=/('(x./('(y.map'($x.$y))))))
& (f1=/('(x.$x*2)))
& (f2=/('(x.$x^2)))
& (partial=/('(x./('(y.($x)$($y))))))
& (!partial$!fs)$!f1:?fsf1
& (!partial$!fs)$!f2:?fsf2
& out$(!fsf1$(0 1 2 3))
& out$(!fsf2$(0 1 2 3))
& out$(!fsf1$(2 4 6 8))
& out$(!fsf2$(2 4 6 8))
);

  

You may also check:How to resolve the algorithm 15 puzzle game step by step in the REXX programming language
You may also check:How to resolve the algorithm Dot product step by step in the Tcl programming language
You may also check:How to resolve the algorithm Lucas-Lehmer test step by step in the Java programming language
You may also check:How to resolve the algorithm Sorting algorithms/Insertion sort step by step in the Go programming language
You may also check:How to resolve the algorithm Day of the week step by step in the SQL programming language