This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
aruniecrisps update: so it's definitely exporting &postfix<USD>, but for some reason i'm not able to call it as a postfix operator 00:08
antononcube @arun > [...] none of the questions you listed are actually within the problem domain of Moneys Interesting statement. So, you would never consider grouping your financial data over currency symbol or over transaction identifiers? 01:03
aruniecrisps @antononcube that's a possible use-case for later, but it's not the primary reason for making this library 02:36
librasteve sorry - had to sleep 11:29
m: sub postfix:<USD>(Rat $a){say $a}; 37.02USD;
Raku eval 37.02
librasteve ^^ postfix works afaict 11:30
I did not account for the already high overloading of the '$' dollar sign (eg for variable sigils) in raku, so I have not been able how to suppress the compiler thinking you are making a syntax error 11:32
m: sub prefix:<§>(Rat $a){say $a}; §37.02;
Raku eval 37.02
librasteve but
m: sub prefix:<$>(Rat $a){say $a}; $37.02; 11:33
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Malformed postfix call at /home/glot/main.raku:1 ------> sub prefix:<$>(Rat $a){say $a}; $37.⏏02;
lizmat This is because $37 is short for $/[37] which is valid syntax for the 38th positional match 11:38
librasteve me I would reach for unicode (but that's not to everyone's taste)
m: sub prefix:<💰>(Rat $a){say $a}; 💰37.02;
Raku eval 37.02 11:39
lizmat m: sub prefix:<$>(Rat $a){say $a}; $ 37.02 # all you need is a space
camelia 37.02
librasteve lizmat: is there a way to use $ symbol in a prefix / circumfix?
.oO 11:40
lizmat I guess if we created a pragma to disallow $37 from being legal syntax, it could work
without space
librasteve up to arun if they want it 11:41
imo the space is not really an issue - just have to set expectations in the docs
lizmat yes, that would be my thought as well 11:42
having $0 work is quite valuable
librasteve ;-)
m: sub circumfix:<$ USD>(Rat() $a){say $a}; $ 37.02 USD; 11:48
Raku eval 37.02
librasteve looks like you need to go $-ws-XXX-ws-USD (ie space before the postfix also) 11:49
NB: I added the coercion type of Rat() since I would like to take whole numbers and decimals (leaving it to arun to may a subset Curr of Rat if they want) 11:50
lizmat Rat(Cool) might be better 12:09
aruniecrisps I'm getting an email saying that META couldn't be read properly, 20:14
json { "auth": "zef:arunvickram", "build-depends": [ ], "depends": [ ], "description": "A library to facilitate using monetary values in Raku", "name": "Moneys", "source-url": "github.com/arunvickram/Moneys.git", "provides": { "Money": "lib/Moneys.rakumod" }, "resources": [ ], "test-depends": [ ], "version": "0.0.3" } 20:18
this looks right, right?
@lizmat i don't think being able to do my $x = $37.99 at the cost of disabling syntax is worth it imho 20:31
nvm it worked, i guess there was somethng up this morning is all 20:33
SmokeMachine usercontent.irccloud-cdn.com/file/.../image.png 20:55
aruniecrisps Hey @SmokeMachine, thanks for the catch, I was wondering why I wasn't able to get it working 21:41
Apologies for not fixing this sooner 21:44
@SmokeMachine should be fixed 21:50
SmokeMachine aruniecrisps: I was playing with Money <-> Red integration: gist.github.com/FCO/558d0e32ed620e...99141e0f36 22:03
If I enable debug, these are the SQL it shows: gist.github.com/FCO/455a9aa62d3d67...5e27c5c442 22:05
aruniecrisps @SmokeMachine I don't think we want to be storing Money as JSON, i think standard practice is to have the amount go to one column and the currency go to the other column 22:08
SmokeMachine This was just an example… but for now, there is no defined way to have 1 attribute writing to mere than one column… by I think there are modules on the ecosystem doing that… 22:18
aruniecrisps I'm gonna play around with a couple of things 22:43
@SmokeMachine while you're at it, try installing Moneys again 22:52
it should work
SmokeMachine usercontent.irccloud-cdn.com/file/.../image.png 22:53
aruniecrisps Looks like it hasn't updated to version 0.0.3 on your end
cdn.discordapp.com/attachments/768...1dca4& 22:54
SmokeMachine The same as before, but with real Moneys www.irccloud.com/pastebin/9n8LHDn2/ 23:08
aruniecrisps @SmokeMachine i'm getting this error when trying to install Red 23:24
cdn.discordapp.com/attachments/768...84ebf&
SmokeMachine you need install pq (from postgress), or exclude it from install 23:25
librasteve very neat example! is there a variant where all values are one currency and that is just stored once - but can be parametrised ? 23:28
aruniecrisps Postgres as in the library postgres for Raku or postgres as the postgres database and pg_* programs? @SmokeMachine 23:29
SmokeMachine DB::Pg 23:33
aruniecrisps it's trying to install pq but it's not able to find pq on raku.land or anything it looks like 23:36
SmokeMachine DB::Pg is trying to install it 23:37
librasteve: sorry, were you talking about Red+Money example? 23:38
aruniecrisps Right, I tried installing pq on my own but it looks like it's not able to install it
It's unable to find it
SmokeMachine libpq 23:42
aruniecrisps libpq is already installed on my machin 23:50
SmokeMachine I had to create a link on my system to the right place to make it work… 23:55