#!/usr/bin/env raku
use v6;
multi sub deflate($n, $r, $y)
{
my $m = $n;
loop (my $i = 0; $i < $y; $i++)
{
$m = deflate($m, $r);
}
$m;
}
multi sub deflate($n, $r)
{
$n * (1 + $r);
}
sub MAIN(:$rate = 0.0225, :$years = 10)
{
my $purchasing-power = 1;
my $deflate = deflate($purchasing-power, $rate, $years);
my $output = qq:to/EOF/.trim;
After $years years of deflation at a rate of {$rate * 100}% per year,
purchasing power is {$deflate * 100}% of what it was initially.
EOF
$output.say;
}
Without inflation, your personal wealth would grow by the average inflation rate target plus GDP growth, compounding each year. # a list with at least one element, extracting the head and tail
multi sub tail(*@list ($head, *@tail)) { @tail }
multi sub tail(*@list) { @list }
[3]
==> tail()
==> say(); # []
[3, 4]
==> tail()
==> say(); # [4]
# pattern matching with arbitrary guards
multi sub user($name where { is-valid-user($_) }) { $name.say }
multi sub user($name) { "invalid name: $name".say }
sub is-valid-user($name)
{
# notice the additive character class in this regex: “letters plus digits”
# fail the match if $name is root
try with $name ~~ /(<+:Letter +digit>+)/ { $0 ne 'root' or fail }; $!.not
}
user('name'); # name
user('1234'); # 1234
user('root'); # invalid name: root
class Coordinates
{
has $.latitude is required;
has $.longitude is required;
}
class City
{
has Str:D $.name is required;
has Str:D $.state is required;
has Str:D $.country is required;
has Coordinates:D $.coordinates is required;
}
my $latitude = -37.840935;
my $longitude = 144.946457;
my Coordinates $coordinates .= new(:$latitude, :$longitude);
my Str:D $name = 'Melbourne';
my Str:D $state = 'Victoria';
my Str:D $country = 'Australia';
my City $melbourne .= new(:$name, :$state, :$country, :$coordinates);
my City:D $sydney = do {
my Coordinates:D $coordinates = do {
my $latitude = -33.86514;
my $longitude = 151.209900;
Coordinates.new(:$latitude, :$longitude);
};
my Str:D $name = 'Sydney';
my Str:D $state = 'New South Wales';
my Str:D $country = 'Australia';
City.new(:$name, :$state, :$country, :$coordinates);
};
# deeply nested argument deconstruction
multi sub melbourne-or-bust(
City:D $city (
Str:D :$name where 'Melbourne',
Str:D :$state,
Str:D :$country,
:$coordinates (
:$latitude,
:$longitude
)
)
)
{
my $gist = qq:to/EOF/.trim;
Welcome to the city of $name. It’s located in $state, $country.
GPS coordinates: $latitude, $longitude
EOF
$gist.say;
}
multi sub melbourne-or-bust(City:D $city)
{
'This isn’t Melbourne.'.say;
}
melbourne-or-bust($melbourne); # Welcome to the city of Melbourne ...
melbourne-or-bust($sydney); # This isn’t Melbourne
> Perl 6 was treated as the successor of Perl 5 -- and that was the mistake. It meant Perl 5 started dying, #!/usr/bin/env raku
use v6;
multi sub inflate($n, $r, $y)
{
my $m = $n;
loop (my $i = 0; $i < $y; $i++)
{
$m = inflate($m, $r);
}
$m;
}
multi sub inflate($n, $r)
{
$n * (1 - $r);
}
sub MAIN(:$rate = 0.0003, :$years = 100)
{
my $purchasing-power = 1;
my $inflate = inflate($purchasing-power, $rate, $years);
my $output = qq:to/EOF/.trim;
After $years years of inflation at a rate of {$rate * 100}% per year,
purchasing power is {$inflate * 100}% of what it was initially.
EOF
$output.say;
}
All else equal, a 1% annual rate of inflation costs you over half of your purchasing power per century. Even a 0.1% yearly inflation rate charted out over several centuries results in a collapse of purchasing power. This level of inflation practically requires investors to take countermeasures, like searching for alternative stores of value...
> Once the marginal productivity of physical capital is below the real interest rate people will abandon production even if there is a shortage of products and people are starving on the street.
Given the profit margin on farming is something like 10%, and assuming the average annual purchasing power appreciation of our hypothetical global currency of fixed supply equals the Fed’s inflation target of 2% plus 0.25% GDP growth, how do we arrive at people “starving on the street”?
> If you want to discourage consumption you should introduce consumption taxes for natural resources, co2 and other forms of pollution
Surely the level of taxation necessary to curb industrial and retail usage of fossil fuels to the same extent of global deflationary economics would make the taxation measures politically infeasible. The tax policy would need to result in unthinkably high prices to create the drastic changes necessary. Deflation OTOH would lead to a decline in capital investment, employment, and spending without requiring any level of forcible compulsion.
A global currency of fixed supply would realistically deliver a sufficiently powerful financial incentive to galvanize widespread, voluntary adoption of ecologically sustainable consumer behaviour and business practices.
> by maintaining full employment
Particularly with the rise of automation and AI, is maintaining full employment really an achievable goal? We desperately need a way for the majority of humans to subsist without working bullshit jobs [1].
> hence the need to force ever greater quantities of money into the economy to keep it alive
We’re facing ecological collapse precisely because humanity has chased infinite growth.
[1]: https://www.strike.coop/bullshit-jobs/