How to resolve the algorithm Filter step by step in the langur programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Filter step by step in the langur programming language

Table of Contents

Problem Statement

Select certain elements from an Array into a new Array in a generic way.

To demonstrate, select all even numbers from an Array. As an option, give a second solution which filters destructively, by modifying the original Array rather than creating a new Array.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Filter step by step in the langur programming language

Source code in the langur programming language

val .arr = series 7

writeln "   array: ", .arr
writeln "filtered: ", filter f{div 2}, .arr

  

You may also check:How to resolve the algorithm Four bit adder step by step in the Lambdatalk programming language
You may also check:How to resolve the algorithm Loops/Downward for step by step in the Crystal programming language
You may also check:How to resolve the algorithm Narcissistic decimal number step by step in the APL programming language
You may also check:How to resolve the algorithm Luhn test of credit card numbers step by step in the REXX programming language
You may also check:How to resolve the algorithm Sum of a series step by step in the Oz programming language