musifter

AoC 2021 day 1 (Smalltalk)

Dec 1st, 2021 (edited)
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/local/bin/gst -q
  2.  
  3. Collection extend [
  4.     apply: method  [ ^self collect: [:x | x perform: method] ]
  5. ]
  6.  
  7. "
  8. | Mainline
  9. "
  10. depths := stdin lines contents apply: #asNumber.
  11.  
  12. #(1 3) keysAndValuesDo: [ :part :win |
  13.     ('Part %1: ' % {part}) display.
  14.  
  15.     ((1 to: depths size - win) count: [ :i |
  16.         (depths at: i) < (depths at: i + win)
  17.     ]) displayNl.
  18. ]
  19.  
Add Comment
Please, Sign In to add comment