How to resolve the algorithm Cistercian numerals step by step in the F# programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Cistercian numerals step by step in the F# programming language

Table of Contents

Problem Statement

Cistercian numerals were used across Europe by Cistercian monks during the Late Medieval Period as an alternative to Roman numerals. They were used to represent base 10 integers from 0 to 9999. All Cistercian numerals begin with a vertical line segment, which by itself represents the number 0. Then, glyphs representing the digits 1 through 9 are optionally added to the four quadrants surrounding the vertical line segment. These glyphs are drawn with vertical and horizontal symmetry about the initial line segment. Each quadrant corresponds to a digit place in the number: Please consult the following image for examples of Cistercian numerals showing each glyph: [1] Due to the inability to upload images to Rosetta Code as of this task's creation, showing output here on this page is not required. However, it is welcomed — especially for text output.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Cistercian numerals step by step in the F# programming language

Source code in the fsharp programming language

// Cistercian numerals. Nigel Galloway: February 2nd., 2021
let N=[|[[|' ';' ';' '|];[|' ';' ';' '|];[|' ';' ';' '|]];
        [[|'#';'#';'#'|];[|' ';' ';' '|];[|' ';' ';' '|]];
        [[|' ';' ';' '|];[|'#';'#';'#'|];[|' ';' ';' '|]];
        [[|'#';' ';' '|];[|' ';'#';' '|];[|' ';' ';'#'|]];
        [[|' ';' ';'#'|];[|' ';'#';' '|];[|'#';' ';' '|]];
        [[|'#';'#';'#'|];[|' ';'#';' '|];[|'#';' ';' '|]];
        [[|' ';' ';'#'|];[|' ';' ';'#'|];[|' ';' ';'#'|]];
        [[|'#';'#';'#'|];[|' ';' ';'#'|];[|' ';' ';'#'|]];
        [[|' ';' ';'#'|];[|' ';' ';'#'|];[|'#';'#';'#'|]];
        [[|'#';'#';'#'|];[|' ';' ';'#'|];[|'#';'#';'#'|]];|]

let fN i g e l=N.[l]|>List.iter2(fun n g->printfn "%sO%s" ((Array.rev>>System.String)n) (System.String g)) N.[e]
               printfn "   O"
               N.[g]|>List.rev|>List.iter2(fun n g->printfn "%sO%s" ((Array.rev>>System.String)n) (System.String g)) (N.[i]|>List.rev)

[(0,0,0,0);(0,0,0,1);(0,0,2,0);(0,3,0,0);(4,0,0,0);(5,5,5,5);(6,7,8,9)]|>List.iter(fun(i,g,e,l)->printfn "\n%d%d%d%d\n____" i g e l; fN i g e l)


  

You may also check:How to resolve the algorithm Runge-Kutta method step by step in the REXX programming language
You may also check:How to resolve the algorithm Increment a numerical string step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Literals/Floating point step by step in the MIPS Assembly programming language
You may also check:How to resolve the algorithm Comma quibbling step by step in the Ring programming language
You may also check:How to resolve the algorithm Literals/Integer step by step in the jq programming language