- Talked about my APL
scan_left_fold_right_wtf
- Collection of blocks to mimic pattern matching
scan
implementation in Smalltalk
scan: aBlock
| accumulator first |
first := true.
^ self collect: [:each |
first ifTrue: [
first := false. accumulator := each
] ifFalse: [
accumulator := aBlock value: accumulator value: each
]]
#(1 2 3 4 5) scan: [ :a :b | a + b ]
- Beahviour of
scan
in APL:
-\⍳5
1 ¯1 2 ¯2 3
- Dave pointed out why
scan
is implemented in terms offoldRight
which leads to O(n^2)
Ken was a purist.
reduce
is the visual equivalent of place+
or-
in between (akaover
oracross
) all of the elements in an array. The purity of maintaining this idea is what leads to this implementation and suboptimal performance.
- ❌ Read Design Pattern Article
- ❌ Read How learning Smalltalk can improve your skills as a programmer Article
- ❌ Send plan
- ➕ Worked on Smalltalk impl of YT Video problem
- Read Design Pattern Article
- Read How learning Smalltalk can improve your skills as a programmer Article
- Read Smalltalk Case Statement
- Read Another Case for Smalltalk
- Implement
switch
/case
in Smalltalk - Send plan
- Add Smalltalk impl to YT Video Part 2