How to resolve the algorithm Long year step by step in the Quackery programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Long year step by step in the Quackery programming language

Table of Contents

Problem Statement

Most years have 52 weeks, some have 53, according to ISO8601.

Write a function which determines if a given year is long (53 weeks) or not, and demonstrate it.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Long year step by step in the Quackery programming language

Source code in the quackery programming language

  [ dup dip
      [ 1 1 rot dayofweek 4 = ]
    31 12 rot dayofweek 4 = or ] is longyear ( n --> b )

  say "Long Years in the 21st Century" cr
  cr
  100 times
    [ 2000 i^ + longyear if 
      [ 2000 i^ + echo sp ] ]

  

You may also check:How to resolve the algorithm Short-circuit evaluation step by step in the Forth programming language
You may also check:How to resolve the algorithm Random number generator (device) step by step in the J programming language
You may also check:How to resolve the algorithm User input/Text step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Read a file line by line step by step in the F# programming language
You may also check:How to resolve the algorithm Generic swap step by step in the PHP programming language