:Namespace phase1
⎕ML←⎕IO←1
⍝ Dyalog 18.0 used
⍝ 1: In the Long One...
q1←⌈/0,(+/¨⊢⊆,)
⍝ 2: Just Golfing Around
q2←∊(⊂+⌿÷(/⍨≢))⍤⊢⌸⍤,
⍝ 3: Separatist
⍝ Handling integer scalar would seem to need to
⍝ change ⎕PP , it might be needed to be mentioned
⍝ as a hint. And
⍝ the ⎕PP needed for 32-bit integer is 11,
⍝ when ⎕PP←10 , 10000000000 is printed as 1E10
⍝ The following answer assumes ⎕PP←11.
⍝ I don't see very well
⍝ how @ can be used for the problem
⍝ It can only replace *in place* I suppose.
⍝ With @ I can only came up with something like:
⍝ {(0<∊(⊂0 1)@(0=3∘|)⌽⍳≢k)\k←⍕⍵} 2123456
⍝ 2 123 456
⍝ With ⌺ : {~∘' '⊃(⊣,⍺,⊢)/{⊂⍵}⌺(⍪3 3)⊢⍕⍵}
⍝ close but still not correct.
⍝ So I'd give PCRE a try.
q3←{('(\d+)(\d{3})'⎕R('\1',⍺,'\2'))⍣≡⍕⍵}
q3←{(3|3-≢⍵)↓¯1↓,⍺,⍨(a,3)⍴⍵↑⍨-3×a←⌈3÷⍨≢⍵}
q3←{∊⍺∘,¨@(⍸0,1↓0=3|⌽⍳≢⍵),⍵}
⍝ 4: Counting DNA Nucleotides
q4←(¯1+≢⍤⊢)⌸'ACGT',⊢
⍝ 5: Uniquely Qualified
⍝ The problem description seems confusing:
⍝ Is there a requirement on the number of
⍝ duplicated elements?
⍝ The following answer taking the description
⍝ as getting: (⍺ ~ ⍵) ∪ (⍵ ~ ⍺)
⍝ (treating ⍺ ⍵ as sets).
q5←(~∪~⍨)⍥,
⍝ 6: Stairway to Heaven
q6←{' ⎕'⌷⍨⊂1+⌽∘.≥⍨⍳⍵}
q6←{' ⎕'[1+⌽∘.≥⍨⍳⍵]}
⍝ 7: Attack of the Mutations!
q7←+/⍤≠
⍝ 8: Pyramid Scheme
q8←{(⍉⊢⍪1↓⊖)⍣2⊢∘.⌊⍨⍳⍵}
q8←∘.⌊⍨(⊢,1↓⌽)∘⍳
⍝ 9: That's the Rule
⍝ 118⊤⍨8⍴2 ←→ ⌽110⊤⍨8⍴2
⍝ I think it would be difficult with N-wise reduction.
⍝ because that needs an associative function.
q9←{(118⊤⍨8⍴2)⌷⍨1+2⊥⍵}⌺3
⍝ 9: Average the new problem
q9←{a+/(⌽,⍺⍴⊃)⍣2⊢⍵÷a←1+2×⍺}
⍝ 10: Let's Split!
q10←{(~,⍥(⊂⍵/⍨⊢)⊢)∨\⍵∊⍺}
⍝ Fin: an ordered list of least to most
⍝ difficult
⍝ 7 1 5 4 6 8 2 10 9 3
⍝ And I think 3 would be too difficult
⍝ for newcomers if they don't use PCRE.
:EndNamespace