Hacker News new | ask | show | jobs
by superzamp 631 days ago
Well that's definitely a good puzzle. I've tried to model it for a bit, but it indeed looks like we'd need to add something to the language to make it possible at all! Thanks for bringing this up.
1 comments

Same thing with income tax brackets. You need conditional logic.
For this particular case, I would say that tax-brackets sort of logic can be expressed in the destination block with ordered destinations.

For example, you could have something like this:

    send [USD/2 *] (
      source = @users:1234
      destination = {
        // first $1000 are taxed at 10%
        max [USD/2 100000] to {
          10% to @taxes
          remaining kept
        }
        // Anything above that is, taxed at 20%
        remaining to {
          20% to @taxes
          remaining kept
        }
      }
    )
(You can test it on the playground, you'll just want to feed the "users:1234" account with an initial balance in the input section)