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
00:44 Manifest0 left
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
05:40 kjp left 05:42 kjp joined 06:00 CIAvash joined, CIAvash left 06:01 CIAvash joined 06:41 hudo_ joined 07:45 Manifest0 joined 09:10 CIAvash left 09:55 hudo_ left
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
12:02 hudo_ joined
lizmat Rat(Cool) might be better 12:09
13:38 Manifest0 left 15:14 hudo_ left 17:48 Some-body_ joined 17:51 DarthGandalf left 17:52 Some-body_ is now known as DarthGandalf 18:05 hudo_ joined 18:07 Some-body_ joined 18:09 DarthGandalf left 18:10 Some-body_ is now known as DarthGandalf 18:24 DarthGandalf left, Some-body_ joined 18:28 Some-body_ is now known as DarthGandalf 18:39 MasterDuke joined
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
20:39 MasterDuke left
SmokeMachine usercontent.irccloud-cdn.com/file/.../image.png 20:55
21:28 hudo_ left 21:40 DarthGandalf left
aruniecrisps Hey @SmokeMachine, thanks for the catch, I was wondering why I wasn't able to get it working 21:41
21:44 DarthGandalf joined
Apologies for not fixing this sooner 21:44
21:48 DarthGandalf left, DarthGandalf joined
@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
22:17 KOTP left 22:18 KOTP joined
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
22:38 hudo_ joined
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
22:58 Manifest0 joined
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
23:43 hudo_ left
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