因为我太菜了,虽然其实第一部分都做出来了,但也就想好第一题比较理想的 tacit 解

{((⍺<0))(⍺⍵)(⍺⍵)}

显然的解。

APLcart 给了个 tacit idiom, 注意用到了 18.0 新出的 Over operator,在 17.1 只能用 $\{\alpha\; \omega\}$

Is(↑,⊂↓)Y ⍝ ←→ Is (↑{⍺ ⍵}↓) Y ←→ Is {(⍺↑⍵)(⍺↓⍵)} Y

但不能直接用上去,因为在 $\alpha$ 是负数的时,结果和要求是反向的

      ¯3 (↑,⊂↓) 'FooBar'
┌───┬───┐
BarFoo
└───┴───┘

这就是为啥我用了 reverse,并用 power operator 控制,对应 $\alpha <0, \alpha >0$ 两个 case。但用了 power operator 就很难转成 tacit form 了。那么上面的答案要如何写成 tacit 呢。

可以換个角度,在负数时转成正数。假设有 f 做了这个工作,那么

{(a⍵)((a⍺ f ⍵)⍵)} ⍝ ←→ {(⍺ f ⍵)(↑,⍥⊂↓)⍵} ←→ f(↑,⍥⊂↓)⊢

那么 f 是什么呢,是这个么?

{|}

殘念,并不是,反例:

      6 {|} 'FooBar'
0

那就加个 a = #w 的 special case 好了

      812 {|} 812
812
      ¯812 {|} 812
0
⍝ f ←→  (⊣⌈⊣|⍨≢∘⊢) ←→ (⊣⌈|⍨∘≢)

Final answer

      ((⊣⌈|⍨∘)(↑,⊂↓)) ⍝ ((⊣⌈|⍨∘≢)(↑{⍺ ⍵}↓)⊢) for Dyalog 17.1

对比下三种写法的長度

附赠第七题解

(/⊣∊((2¯1))) ⍝{f←⍸∘⌽∘(2∘⊥⍣¯1) ⋄ ∧/(f ⍺)∊f ⍵} for 17.1

nothing particular, 就是考 decode 的应用而已

干脆都放上来了

partition 的应用

(⊢⊂128>∨191<)

还是 decode encode
trivial 到炸了
well,我从 APLcart 拿了 arithmetic progression 改了下
mesh 的应用
写的有点糟

{/¯1=2×/×2-/(10¯1)⍵}

同样,写的比较槽

{(⌽⌈\⍵)⌊⌈\}

不难,但是感覺没啥实际用处