4 ms·
For my amusement mostly, here's the Julia translation: nums = [1,2,3,4,5] nums ↑ 6 # const ↑ = push!; const ⤉ = pushfirst! nums ⤉ 6
by improbable22 7y ago
For my amusement mostly, here's the Julia translation:
nums = [1,2,3,4,5]
nums ↑ 6 # const ↑ = push!; const ⤉ = pushfirst!
nums ⤉ 6
nums .+= 2 # addition-assign to add 2 to each item
nums[[2,4]] .= 99
nums
nums ⩠ 7 # ⩠(a,b) = a[a.<b].=b
nums
nums = [1,2,3,4,5]
nums ↔ "hello" # ↔(a,b) = hcat(collect(a), collect(b))
nums = nums ↔ "hello" # re-binding nums