3 ms·
Aesthetically, it bothers me that you compute x by calling remdr two extra times, as opposed to computing it as the sum of y and z... or the bitwise OR of y and
by thaumasiotes 5y ago
Aesthetically, it bothers me that you compute x by calling remdr two extra times, as opposed to computing it as the sum of y and z... or the bitwise OR of y and z...
What's the difference between :(label) / :s(label) / :f(label) / :s(label1)f(label2) ?
- 1vuio0pswjnm7 5y agos and f are different conditions s=success f=failure default is unconditional Is bitwise OR a built-in or would it require writing a separate function.
- thaumasiotes 5y agoBased on the documentation, there do not appear to be any bitwise operations available in SNOBOL. It looks like computing x as remdr(3) + remdr(5) is a pure mistake. You only care about the case where remdr(15) is 0, and it's true that remdr(3) + remdr(5) is 0 if and only if remdr(15) is 0. But you're calling remdr twice where you should only be calling it once. (Or, really, you can keep the weird calculation of remdr(3) + remdr(5), which is conceptually incorrect but correct in every case that matters, but stop computing it with two extra calls to remdr. You're already calculating those values and storing them in the variables y and z; compute x as y + z, which must be much faster than calling remdr two additional times.) As a side note, why do you want to use "a language for non-numeric computation" for this purely numeric problem?
- 1vuio0pswjnm7 5y agoI think the term "non-numeric" probably refers to another popular language of the era from which SNOBOL comes called FORTRAN. The purpose of fizzbuzz as I understand it is to test a person's aptitude for programming, but not necessarily a person's ability to select the "right" programming language. If the purpose of fizbuzz is to test for programming language selection, and fizzbuzz is a "purely numeric problem", then should the proper choice be FORTRAN.
- masklinn 5y ago> What's the difference between :(label) / :s(label) / :f(label) / :s(label1)f(label2) ? Looks like it’s unconditional, conditional (success), and conditional (failure) jumps. :s(A)f(B) is how you tell it to jump to A on success and B on failure.
- 1vuio0pswjnm7 5y agoThere is also an "indirect goto" where B is a variable to be appended to string A to compute a label that is defined somewhere else in the program. :($('A' B))