jello icon indicating copy to clipboard operation
jello copied to clipboard

INVESTIGATE: PWC 261p2

Open codereport opened this issue 1 year ago • 1 comments

https://theweeklychallenge.org/blog/perl-weekly-challenge-261/

How to refer back to first arg at this point

image

codereport avatar Mar 19 '24 14:03 codereport

You need to use Φ₁ and l to get at the first argument. However, (len iota0 2 pow) * is a 2 2 chain (an ε' combinator), which means 2 2 2 (Φ₁) will shadow the ε' by Jellys resolution rules. To get around this you can use B₁/i:

> [5,3,6,1,12] 3 :: len iota0 2 pow * i pair l
                     L    Ḷ   2  *  × ¹  ,   ḷ
   L        [5,3,6,1,12] 3 ➡️  5
   LḶ       [5,3,6,1,12] 3 ➡️  [0, 1, 2, 3, 4]
   LḶ2      [5,3,6,1,12] 3 ➡️  [0, 1, 2, 3, 4]2
   LḶ2*     [5,3,6,1,12] 3 ➡️  [1, 2, 4, 8, 16]
   LḶ2*×    [5,3,6,1,12] 3 ➡️  [3, 6, 12, 24, 48]
   LḶ2*×¹   [5,3,6,1,12] 3 ➡️  [3, 6, 12, 24, 48]
   LḶ2*×¹,  [5,3,6,1,12] 3 ➡️  [[3, 6, 12, 24, 48], 3]
   LḶ2*×¹,ḷ [5,3,6,1,12] 3 ➡️  [[3, 6, 12, 24, 48], [5, 3, 6, 1, 12]]
    This is a 1-1-0-2-2-1-2-2 dyadic chain (BEₚε'B₁Φ₁)
              └┬┘   ⋮ ⋮ ⋮   ⋮
               B    ⋮ ⋮ ⋮   ⋮
               └─┬──┘ ⋮ ⋮   ⋮
                Eₚ    ⋮ ⋮   ⋮
                 └─┬──┘ ⋮   ⋮
                  ε'    ⋮   ⋮
                   └─┬──┘   ⋮
                    B₁      ⋮
                     └──┬───┘
                       Φ₁
>

tom-huntington avatar Mar 26 '24 03:03 tom-huntington