aboutsummaryrefslogtreecommitdiff
path: root/challenge-060/richard-park/apl/FindNumbers.aplf
blob: 548dd8dcbdc072b09b65e510625defcc50e889c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
 FindNumbers{
⍝ ⍺: An integer x and real number y
⍝ ⍵: Numeric array
⍝ ←: All numbers with digits made by
⍝    concatenating elements in ⍵,
⍝    which have exactly x digits
⍝    and a value less than y
     (x y)
     l¯1+x              ⍝ Power of 10 with x digits
     c,∘.,            ⍝ All possible concatenations of ⍵
     n10¨c            ⍝ In base 10
     n⌿⍨((10*l)>n)n<y   ⍝ ←
 }