How to resolve the algorithm Colour pinstripe/Display step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Colour pinstripe/Display step by step in the PicoLisp programming language

Table of Contents

Problem Statement

The task is to create 1 pixel wide coloured vertical pinstripes with a sufficient number of pinstripes to span the entire width of the graphics display.

The pinstripes should either follow the system palette sequence,   or a sequence that includes: black,   red,   green,   blue,   magenta,   cyan,   yellow,   and   white:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Colour pinstripe/Display step by step in the PicoLisp programming language

Source code in the picolisp programming language

(de *Colors  # Black Red Green Blue Magenta Cyan Yellow White
   ((0 0 0) (255 0 0) (0 255 0) (0 0 255)
      (255 0 255) (0 255   255) (255 255 0) (255 255 255) .) )

(let Ppm  # Create PPM of 384 x 288 pixels
   (make
      (for N 4
         (let L
            (make
               (do (/ 384 N)
                  (let C (pop *Colors)
                     (do N (link C)) ) ) )
            (do 72 (link L)) ) ) )
   (out '(display)  # Pipe to ImageMagick
      (prinl "P6")  # NetPBM format
      (prinl (length (car Ppm)) " " (length Ppm))
      (prinl 255)
      (for Y Ppm (for X Y (apply wr X))) ) )

  

You may also check:How to resolve the algorithm Base64 decode data step by step in the Pike programming language
You may also check:How to resolve the algorithm Show the epoch step by step in the Sidef programming language
You may also check:How to resolve the algorithm Averages/Mean time of day step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Averages/Arithmetic mean step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Compound data type step by step in the AutoHotkey programming language