How to resolve the algorithm Pinstripe/Display step by step in the Lambdatalk programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Pinstripe/Display step by step in the Lambdatalk programming language

Table of Contents

Problem Statement

The task is to demonstrate the creation of a series of vertical pinstripes across the entire width of the display.

c.f. Colour_pinstripe/Display

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Pinstripe/Display step by step in the Lambdatalk programming language

Source code in the lambdatalk programming language

{def window 
 {lambda {:w :h}
  div
  {@ style="position:relative;
            top:0; left:0; 
            width::wpx; height::hpx; 
            background:#eee;"}}}
-> window

{def rec
 {lambda {:x :y :w :h :c}
  {div
   {@ style="position:absolute; 
             top::ypx; left::xpx; 
             width::wpx; height::hpx; 
             background::c;"}}}}
-> rec

{def row
 {lambda {:w :h :k}
  {S.map {{lambda {:dx :dy :h :i}
                  {rec :i         :dy :dx :h #000}
                  {rec {+ :i :dx} :dy :dx :h #fff}
          } {pow 2 :k} {* :k {/ :w 8}} {/ :h 4}} 
         {S.serie 0 {- :w 1} {pow 2 {+ :k 1}}}}}}
-> row

{def WIDTH 512}
-> WIDTH
{def HEIGHT 256}
-> HEIGHT

{{window {WIDTH} {WIDTH}}
 {S.map {row {WIDTH} {HEIGHT}}
  0 1 2 3}}


  

You may also check:How to resolve the algorithm Hello world/Text step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Faulhaber's formula step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm Arithmetic/Rational step by step in the Scheme programming language
You may also check:How to resolve the algorithm Compare sorting algorithms' performance step by step in the Julia programming language
You may also check:How to resolve the algorithm Quine step by step in the Forth programming language