How to resolve the algorithm Sum of squares step by step in the Lambdatalk programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sum of squares step by step in the Lambdatalk programming language

Table of Contents

Problem Statement

Write a program to find the sum of squares of a numeric vector. The program should work on a zero-length vector (with an answer of   0).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sum of squares step by step in the Lambdatalk programming language

Source code in the lambdatalk programming language

{def sumsq
 {lambda {:s}
  {+ {S.map {lambda {:i} {* :i :i}} :s}}}}
-> sumsq

{sumsq 1 2 3 4 5}
-> 55
{sumsq 0}
-> 0


  

You may also check:How to resolve the algorithm Mutual recursion step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Knapsack problem/Continuous step by step in the REXX programming language
You may also check:How to resolve the algorithm Abundant odd numbers step by step in the Delphi programming language
You may also check:How to resolve the algorithm Sparkline in unicode step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Plot coordinate pairs step by step in the TI-89 BASIC programming language