Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.56 KB

2020-10-14-Dave-Mason.md

File metadata and controls

53 lines (41 loc) · 1.56 KB

Articles:

Links:

Discussion:

  • 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 of foldRight which leads to O(n^2)

Ken was a purist. reduce is the visual equivalent of place + or - in between (aka over or across) all of the elements in an array. The purity of maintaining this idea is what leads to this implementation and suboptimal performance.

Previous To Do:

  • ❌ 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

To Do:

  • 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