Quantcast

[supercollider/supercollider] 8fee48: class library: adverb argument for reduce

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[supercollider/supercollider] 8fee48: class library: adverb argument for reduce

noreply
  Branch: refs/heads/master
  Home:   https://github.com/supercollider/supercollider
  Commit: 8fee48c255ed7cd634f993cbd033d2df22095845
      https://github.com/supercollider/supercollider/commit/8fee48c255ed7cd634f993cbd033d2df22095845
  Author: Julian Rohrhuber <[hidden email]>
  Date:   2017-05-05 (Fri, 05 May 2017)

  Changed paths:
    M SCClassLibrary/Common/Collections/SequenceableCollection.sc

  Log Message:
  -----------
  class library: adverb argument for reduce

The method `reduce` takes a binary operator selector (or an appropriate
function) and applies it to the collection’s items incrementally.

This patch allows us to pass an adverb to the operator, as commonly
expected for binary operations. If the operator is a function, the
adverb is the third argument.

These two expressions return the same value:
```
[1, 2] *.t [10, 20, 30]
[[1, 2], [10, 20, 30]].reduce('*', 't')
```

This feature is justified because it exposes the interface of binary
operators and calculations by reduce are very compact.


  Commit: d21b5ed8b8cb4f0ede0300f87bfd6b0b7c40b6b1
      https://github.com/supercollider/supercollider/commit/d21b5ed8b8cb4f0ede0300f87bfd6b0b7c40b6b1
  Author: Julian Rohrhuber <[hidden email]>
  Date:   2017-05-05 (Fri, 05 May 2017)

  Changed paths:
    M HelpSource/Classes/SequenceableCollection.schelp

  Log Message:
  -----------
  help: adverb for reduce


  Commit: dd1977b2691c75074460d0a4ce004c67262cd523
      https://github.com/supercollider/supercollider/commit/dd1977b2691c75074460d0a4ce004c67262cd523
  Author: Brian Heim <[hidden email]>
  Date:   2017-05-05 (Fri, 05 May 2017)

  Changed paths:
    M HelpSource/Classes/SequenceableCollection.schelp

  Log Message:
  -----------
  help: further document .reduce

Add notes on what happens if the collection has <2 elements.


  Commit: 57746585aee361c0a90ce94995dbf31563c51955
      https://github.com/supercollider/supercollider/commit/57746585aee361c0a90ce94995dbf31563c51955
  Author: Nathan Ho <[hidden email]>
  Date:   2017-05-13 (Sat, 13 May 2017)

  Changed paths:
    M HelpSource/Classes/SequenceableCollection.schelp
    M SCClassLibrary/Common/Collections/SequenceableCollection.sc

  Log Message:
  -----------
  Merge pull request #2863 from telephon/topic-reduce-needs-adverb

class library: adverb argument for reduce


Compare: https://github.com/supercollider/supercollider/compare/10e62c276199...57746585aee3
Loading...