sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.84k stars 923 forks source link

Reference to rand_type in use_random_source documentation #3425

Closed floholl closed 1 week ago

floholl commented 2 weeks ago

The following applies to Sonic Pi v4.5.0 under macOS (Apple silicon):

In the Sonic Pi language reference that comes with the app, the documentation for use_random_source includes the following code excerpt just before the Examples section:

rand_type :white
puts 10000.times.collect { rand.round(1) }.tally.sort
rand_type :pink
puts 10000.times.collect { rand.round(1) }.tally.sort
rand_type :perlin
puts 10000.times.collect { rand.round(1) }.tally.sort

However, this code fails to run in the given Sonic Pi version, due to the reference to rand_type, which I'm guessing has been renamed to use_random_source at some point. The code works if all references are replaced accordingly to:

use_random_source :white
puts 10000.times.collect { rand.round(1) }.tally.sort
use_random_source :pink
puts 10000.times.collect { rand.round(1) }.tally.sort
use_random_source :perlin
puts 10000.times.collect { rand.round(1) }.tally.sort

Reporting this as a required update to the documentation.

samaaron commented 2 weeks ago

Awesome - any chance you could create a PR fixing this?

floholl commented 2 weeks ago

Sure, I'll give it a try (first such occasion, so will first need to find language reference sources in the repository whenever I have a moment).

floholl commented 2 weeks ago

I just submitted pull request #3426 to the best of my ability. For future reference, here is the procedure I followed, based on these instructions. Feel free to (gently) correct. 🙃

  1. https://github.com/sonic-pi-net/sonic-pi > Fork > + Create a new fork
  2. Clone fork to local machine:
    $ git clone git@github.com:floholl/sonic-pi.git
  3. In local copy, open the file containing the language reference entry for use_random_source in vim:
    
    $ cd sonic-pi
    $ vim app/server/ruby/lib/sonicpi/lang/core.rb
  4. Make the edits described in original description of issue above:
    :%s/rand_type/use_random_source/gc
    :wq
  5. Add, commit, and push to my fork on GitHub:
    $ git add app/server/ruby/lib/sonicpi/lang/core.rb
    $ git commit -m "Replace rand_type with use_random_source in lang reference entry for the latter"
    $ git push
  6. https://github.com/floholl/sonic-pi > Contribute > Open pull request (used default options everywhere)

Should I (generally) close an issue for which a pull request was requested once that's been taken care of? Or should I wait until the pull request has been merged? (I'll leave this one open for now.)

coder0107git commented 2 weeks ago

I'm just watching the repo but here's my two cents.

Should I (generally) close an issue for which a pull request was requested once that's been taken care of? Or should I wait until the pull request has been merged? (I'll leave this one open for now.)

What seems to be the preferred way on Github is to leave an issue open until the PR is merged.

Btw, you should just be able to say closes #3425 in your PR description and Github will automatically close the issue when the PR is merged.

floholl commented 1 week ago

Closing this after pull request #3426 has been merged.