top | item 40952525

(no title)

nomonnai | 1 year ago

In base R, `+` is the usual arithmetic operator for numeric and complex vectors. I'm not a super R expert but I'm pretty sure the addition operator is overloaded here. It simply means:

    add(Music(), Meter(4, 4), Line(...), Line(...), Articulation(">", 1))
Edit. Found the definition in the source [1]. I think the approach is similar to Go's approach to method definition [2]. Methods are defined on types, i.e., methods are functions with special receiver arguments. The infix notation instead of prefix notation is just syntactic sugar.

[1] https://github.com/flujoo/gm/blob/69d639be86b0cef80d815a73a6...

[2] https://go.dev/tour/methods/1

discuss

order

No comments yet.