How to resolve the algorithm Function definition step by step in the langur programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Function definition step by step in the langur programming language
Table of Contents
Problem Statement
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function.
Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are created and values returned).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Function definition step by step in the langur programming language
Source code in the langur programming language
val .multiply = f(.x, .y) .x x .y
.multiply(3, 4)
val .multiply = f .x x .y
.multiply(3, 4)
val .multiply = f{x}
.multiply(3, 4)
val .times3 = f{x 3}
map .times3, [1, 2, 3]
You may also check:How to resolve the algorithm Tree traversal step by step in the Factor programming language
You may also check:How to resolve the algorithm Flatten a list step by step in the Tailspin programming language
You may also check:How to resolve the algorithm Sorting algorithms/Stooge sort step by step in the Yorick programming language
You may also check:How to resolve the algorithm Thue-Morse step by step in the Fortran programming language
You may also check:How to resolve the algorithm Boolean values step by step in the MATLAB programming language