🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku Set by ChanServ on 14 October 2019. |
|||
guifa | rypervenche: there are a couple of ways to do it. In this case you could say | 00:08 | |
my Hash @words; for $data.lines{ wordlist.parse($_); @words.push: %( number => +$<number>, chinese => ~$<chinese>, english => ~$<english>)} | 00:10 | ||
00:10
leont joined
|
|||
guifa | You might also try attaching an actions class to it | 00:11 | |
00:16
Black_Ribbon joined,
Black_Ribbon left
|
|||
guifa | rypervenche: bit.ly/36LsK5X (this is a link to TIO so you can see it in action) | 00:17 | |
00:21
mowcat joined,
chloekek left
00:24
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
rypervenche | Oooh, thank you. A friend mentioned I should make a class, and this integrates nicely with the grammar. Awesome. | 00:25 | |
guifa | I’d also recommend handling the entire file parsing in a single grammar | 00:34 | |
Basically the way I approach this is very iteratively. First the grammar to make sure it parses, then just get an array of hashes at the end. But then yo ucould eventually create class Entry { has $.id; has $.chinese; has $.english }, and after that a WordIndex { has @.database} and then start attaching on fun actions | 00:37 | ||
rypervenche | So at that point I'd have an array of objects? | 00:39 | |
00:45
sena_kun left
|
|||
guifa | yeah. So this does will show you how to parse everything in one step: | 00:46 | |
bit.ly/2vI3YqF (TIO link) | |||
00:51
pecastro left
01:01
sena_kun joined
01:06
marcusr left
01:07
leont left,
mowcat left
01:08
marcusr joined
|
|||
rypervenche | Oh, thank you so much. | 01:08 | |
01:42
marcusr left
01:44
marcusr joined
01:48
marcusr left,
marcusr joined
01:51
mahmudov left
02:09
Kaiepi left
|
|||
rypervenche | guifa: Everything works perfectly, except for one thing I'm not sure about. When I change to a slurp of my file, my $data has an extra 0a at the end of it. It looks like the match is returning Nil and then overwriting the entire contents of the array and I'm left with [(Any)] as my @list; | 02:10 | |
02:12
Kaiepi joined
02:16
molaf left,
wildtrees left
02:28
molaf joined
02:29
aborazmeh left
|
|||
rypervenche | I can chomp it for now, but I'm not sure why it's doing that. | 02:29 | |
02:46
sena_kun left
03:02
sena_kun joined
03:16
Cabanossi left
03:23
Cabanossi joined
|
|||
guifa | rypervenche: change from % to %%: token TOP { <entry>+ %% \n } | 03:37 | |
Your data file probably had a trailing newline. (a % b matches ababa, but not abab, whereas a %% b matches both) | 03:38 | ||
03:59
Sgeo__ joined
04:02
Sgeo_ left
04:07
angelds joined
04:20
ensamvarg joined
04:46
sena_kun left
05:02
sena_kun joined,
AlexDaniel left
|
|||
cpan-raku | New module released to CPAN! Sys::HostAddr (0.1.0) by 03JMASLAK | 05:14 | |
05:36
rindolf joined
05:43
lostinfog left
05:54
mahmudov joined
05:57
Grauwolf joined
05:59
esh joined
06:34
Doc_Holliwood left
06:46
sena_kun left
06:54
molaf left
07:00
sena_kun joined
07:01
AlexDaniel joined,
AlexDaniel left,
AlexDaniel joined
|
|||
cpan-raku | New module released to CPAN! Sys::HostAddr (0.1.1) by 03JMASLAK | 07:05 | |
08:01
evalable6 left,
linkable6 left
08:02
linkable6 joined
08:03
evalable6 joined
08:07
wamba joined
08:09
domidumont joined
08:19
wamba left,
leont joined
08:43
xinming left,
xinming joined
08:45
sena_kun left
08:53
ensamvarg left
08:58
sena_kun joined
09:11
pecastro joined
09:12
leont left
09:22
Kaiepi left
09:26
molaf joined
09:27
Kaiepi joined
09:28
Kaiepi left
09:29
Kaiepi joined
09:32
Kaiepi left,
Kaiepi joined
09:46
Doc_Holliwood joined
09:59
hacktor left
10:25
Kaiepi left
10:26
leont joined
10:30
Kaiepi joined
10:31
Kaiepi left
10:32
Kaiepi joined
10:34
Kaiepi left,
Kaiepi joined
10:46
sena_kun left
10:47
ensamvarg joined
10:51
domidumont left
10:53
leont left,
domidumont joined
10:57
Kaiepi left
11:02
Kaiepi joined,
sena_kun joined
11:07
leont joined
11:15
aborazmeh joined,
aborazmeh left,
aborazmeh joined
11:21
Actualeyes joined
11:23
cpan-raku left
11:24
leont left,
cpan-raku joined,
cpan-raku left,
cpan-raku joined
11:28
wamba joined
11:29
Kaiepi left
11:30
mahmudov left
11:33
Kaiepi joined
11:36
Kaiepi left,
Kaiepi joined
11:40
liubianshi joined
11:48
aborazmeh left
11:51
leont joined,
mowcat joined
12:06
liubianshi left
|
|||
Geth | doc: 530a6e39fe | (JJ Merelo)++ | doc/Language/modules.pod6 Sticking the note to the text |
12:09 | |
linkable6 | Link: docs.raku.org/language/modules | ||
12:22
angelds left
|
|||
cpan-raku | New module released to CPAN! Math::Libgsl::Sort (0.0.1) by 03FRITH | 12:23 | |
12:29
chloekek joined
12:32
Kaiepi left
12:36
Kaiepi joined
12:38
Kaiepi left
12:39
Kaiepi joined
12:43
AlexDaniel left,
Kaiepi left
12:44
Kaiepi joined
12:45
leont left
12:46
sena_kun left
12:50
Kaeipi joined,
Kaiepi left
13:01
sena_kun joined
13:02
mowcat left
13:03
lucasb joined
13:10
renormalist joined
13:23
sno left
13:25
sno joined
13:59
leont joined
14:23
Sgeo_ joined
14:26
Sgeo__ left
|
|||
cpan-raku | New module released to CPAN! Math::Libgsl::Complex (0.0.2) by 03FRITH | 14:31 | |
14:47
sena_kun left,
leont left
14:54
chloekek left
15:01
sena_kun joined
15:10
gabiruh left
15:14
rindolf left
15:24
gabiruh joined
|
|||
Geth | doc/search: 2a0afba129 | (Brian Duggan)++ | bin/p6doc Add search command for p6doc |
15:26 | |
15:26
mowcat joined
|
|||
Geth | doc: bduggan++ created pull request #3196: Add search command for p6doc |
15:29 | |
15:30
rindolf joined
15:40
chloekek joined
15:44
aborazmeh joined,
aborazmeh left,
aborazmeh joined
16:04
AlexDaniel joined,
AlexDaniel left,
AlexDaniel joined
16:19
zakharyas joined,
eseyman left
16:21
phi joined
|
|||
phi | Hi, let say I have a unit class called Butterfly.pm6, which contains the following code : unit class Butterfly;\n method who-am-i { put "I am " ~ $.ˆname }. Why does the P6 compiler say "no such method ^name" when I call the method in another file? | 16:24 | |
For instance, use Butterfly; my $b = Butterfly.new; $b.who-am-i; | 16:25 | ||
The issue doesn't occur when the Butterfly class is declared in the latter file. | 16:26 | ||
16:26
eseyman joined
16:30
xinming left
16:31
xinming joined
|
|||
uzl[m] | m: class Butterfly { method who-am-i { put "I am " ~ $.ˆname }; }; say Butterfly.new.who-am-i; | 16:37 | |
camelia | No such method 'ˆname' for invocant of type 'Butterfly' in method who-am-i at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
tellable6 | 2020-01-31T17:08:50Z #raku <jmerelo> uzl[m] great, thanks! | ||
uzl[m] | m: class Butterfly { method who-am-i { put "I am " ~ self.^name }; }; say Butterfly.new.who-am-i; | ||
camelia | I am Butterfly True |
||
uzl[m] | class Butterfly { method who-am-i { put "I am " ~ self.^name }; }; Butterfly.new.who-am-i; | 16:38 | |
evalable6 | I am Butterfly | ||
uzl[m] | phi: ^ You might want to use self, instead of `$.` | 16:40 | |
16:40
aborazmeh left
|
|||
phi | uzl[m]. Same issue with self.ˆname. | 16:41 | |
I am using Rakudo Star 2019.03.1 | 16:42 | ||
uzl[m], the above examples work because Butterfly is declared in the same file as the the code that uses it. | 16:44 | ||
16:45
sena_kun left
|
|||
uzl[m] uploaded an image: butterfly.png (68KB) < matrix.org/_matrix/media/r0/downlo...pWIxJGgumL > | 16:46 | ||
phi: ^ | |||
It works fine on my end. Can you share code snippet files? | 16:47 | ||
phi | Sure. | 16:48 | |
Where shall I upload the files? | 16:50 | ||
uzl[m] | You can use a pastebin service (e.g., pastebin.run/) | 16:51 | |
16:51
phi left
16:52
phi joined
|
|||
phi | Here's use-butterfly.p6 in text form: use Butterfly; my $b = Butterfly.new; $b.who-am-i; | 16:54 | |
Here's Butterfly.pm6: unit class Butterfly; method who-am-i { put self.ˆname } | 16:55 | ||
Here's how I run use-butterfly.p6: perl6 -I . use-butterfly.p6. | |||
uzl[m] | phi: How are you running it? perl6 -I. use-butterfly.p6? | ||
Ok, got it. | 16:56 | ||
phi | Yes. | ||
No such method 'ˆname' for invocant of type 'Butterfly' in method who-am-i at /Users/xxx/Desktop/p6/Butterfly.pm6 (Butterfly) line 1 in block <unit> at use-butterfly.p6 line 6 | |||
uzl[m] | I'm using the raku extension but I don't think it should make any difference. | ||
phi: For instance, matrix.org/_matrix/media/r0/downlo...pWIxJGgumL | 16:57 | ||
phi | No available formula with the name "raku", say Homebrew on Macosx | 16:58 | |
"says" | |||
In other words, only p6 is available from Homebrew (the Macosx package manager). | 16:59 | ||
uzl[m] | No, that's fine. You're probably using Rakudo prior to 2019.11. However, what I have in the picture works fine using the perl6 executable. | ||
17:00
sena_kun joined
17:01
cpan-raku left
|
|||
phi | Thank you for your help, uzl[m]. I need to install a more recent version of p6/raku. | 17:02 | |
17:02
xinming left
17:03
cpan-raku joined,
cpan-raku left,
cpan-raku joined
|
|||
uzl[m] | phi: What version are you using? | 17:03 | |
17:03
xinming joined
|
|||
phi | 2019.03.1 | 17:04 | |
uzl[m] | BTW, this is what I ran: glot.io/snippets/fkaqjjdfom | ||
17:05
wamba left
|
|||
phi | I believe you. I got rakudo-star from here: formulae.brew.sh/formula/rakudo-star | 17:06 | |
uzl[m] | We have the same source files and we're executing the same commands so I wonder if it's relatable with the Rakudo version. | 17:07 | |
*related | 17:09 | ||
You can get the binaries from rakudo.org/downloads. You could try getting the compiler's latest release and report back. | |||
phi | distro::auth=Apple Computer, | 17:10 | |
Inc.distro::desc=2020-02-02T18:09:56.562639+01:00distro::is-win=Falsedistro::name=macosxdistro::path-sep=:distro::release=18G2022distro::signature=distro::version=10.14.6kernel::arch=i386kernel::archname=x86_64-darwinkernel::auth=unknownkernel::bits=64kernel::desc=kernel::hardware=x86_64kernel::name=darwinkernel::release=Darwin Kernel Version | |||
18.7.0: Sun Dec 1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64kernel::signature=kernel::version=18.7.0moar::ar=armoar::arflags=rcsmoar::arout=moar::as=asmoar::asm=.smoar::asmout=-o | |||
moar::asmswitch=-Smoar::auxclean=@:moar::be=0moar::bindir=/usr/local/Cellar/rakudo-star/2019.03/binmoar::booltype=_Boolmoar::can_err_decl_after_stmt=1moar::can_unaligned_int32=1moar::can_unaligned_int64=1moar::can_unaligned_num64=1moar::cancgoto=1moar::canrdtscp=1moar::cat=catmoar::cc=clangmoar::cc_covflags=-fprofile-instr-generate | |||
-fcoverage-mappingmoar::ccdebugflags=-g3moar::ccdef=-Dmoar::ccdefflags=-D_DARWIN_USE_64_BIT_INODE=1moar::ccinc=-Imoar::ccinstflags=-fsanitize=addressmoar::ccjitflags=moar::ccmiscflags=-fno-omit-frame-pointer -fno-optimize-sibling-callsmoar::ccoptiflags=-O3 -DNDEBUGmoar::ccout=-o | |||
moar::ccshared=moar::ccswitch=-cmoar::ccwarnflags=-Wno-logical-op-parenthesesmoar::cflags=-fno-omit-frame-pointer -fno-optimize-sibling-calls -O3 -DNDEBUG -Wno-logical-op-parentheses -D_DARWIN_USE_64_BIT_INODE=1 -I/usr/local/opt/libffi/lib/libffi-3.2.1/includemoar::cincludes= -I3rdparty/libuv/include -I3rdparty/libuv/src | |||
-I3rdparty/libatomicops/src -I3rdparty/libtommath -I3rdparty/dyncall/dynload -I3rdparty/dyncall/dyncall -I3rdparty/dyncall/dyncallbackmoar::cmpclean=cd 3rdparty/cmp && $(RM) libcmp.a && $(MAKE) cleanmoar::cmplib=3rdparty/cmp/libcmp.amoar::cmpobjects=3rdparty/cmp/cmp.omoar::cmprule=$(AR) $(ARFLAGS) $@ 3rdparty/cmp/*.omoar::config=--optimize | |||
--prefix=/usr/local/Cellar/rakudo-star/2019.03 --make-installmoar::cppout=> moar::cppswitch=-Emoar::crossconf=moar::dasm_flags=-D POSIX=1moar::dcbclean=$(RM) 3rdparty/dyncall/dyncallback/libdyncallback_s.amoar::dcblib=3rdparty/dyncall/dyncallback/libdyncallback_s.amoar::dcbobjects=moar::dcbrule=@:moar::dcclean=cd 3rdparty/dyncall && $(MAKE) -f | |||
Makefile cleanmoar::dclib=3rdparty/dyncall/dyncall/libdyncall_s.amoar::dcobjects=moar::dcrule=cd 3rdparty/dyncall && ./configure && CC='$(CC)' CFLAGS='-fPIC' $(MAKE) -f Makefile moar::defs[0]=_DARWIN_USE_64_BIT_INODE=1moar::dlclean=$(RM) 3rdparty/dyncall/dynload/libdynload_s.amoar::dll=lib%s.dylibmoar::dllexport=__attribute__ ((visibility | |||
("default")))moar::dllib=3rdparty/dyncall/dynload/libdynload_s.amoar::dllimport=__attribute__ ((visibility ("default")))moar::dlllocal=__attribute__ ((visibility ("hidden")))moar::dlobjects=moar::dlrule=@:moar::exe=moar::expect_condition=__builtin_expect((condition), (expection))moar::expect_likely=__builtin_expect(!!(condition), | |||
1)moar::expect_unlikely=__builtin_expect(!!(condition), 0)moar::formatattribute=__attribute__((format(X, Y, Z)))moar::has_pthread_yield=0moar::havebooltype=1moar::impinst=libmoar.dylibmoar::install=$(MKPATH) $(DESTDIR)$(PREFIX)/include/libuv$(MKPATH) $(DESTDIR)$(PREFIX)/include/libuv/uv$(CP) 3rdparty/libuv/include/*.h | |||
$(DESTDIR)$(PREFIX)/include/libuv$(CP) 3rdparty/libuv/include/uv/*.h $(DESTDIR)$(PREFIX)/include/libuv/uv$(MKPATH) $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/armcc$(MKPATH) $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/gcc$(MKPATH) $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/hpc$(MKPATH) | |||
$(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/ibmc$(MKPATH) $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/icc$(MKPATH) $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/loadstore$(MKPATH) $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/msftc$(MKPATH) | |||
$(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/sunc$(CP) 3rdparty/libatomicops/src/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops$(CP) 3rdparty/libatomicops/src/atomic_ops/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/*.h | |||
$(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/armcc/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/armcc$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/gcc/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/gcc$(CP) | |||
3rdparty/libatomicops/src/atomic_ops/sysdeps/hpc/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/hpc$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/ibmc/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/ibmc$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/icc/*.h | |||
$(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/icc$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/loadstore/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/loadstore$(CP) 3rdparty/libatomicops/src/atomic_ops/sysdeps/msftc/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/msftc$(CP) | |||
3rdparty/libatomicops/src/atomic_ops/sysdeps/sunc/*.h $(DESTDIR)$(PREFIX)/include/libatomic_ops/atomic_ops/sysdeps/sunc$(MKPATH) $(DESTDIR)$(PREFIX)/include/libtommath$(CP) 3rdparty/libtommath/*.h $(DESTDIR)$(PREFIX)/include/libtommath$(MKPATH) $(DESTDIR)$(PREFIX)/include/dyncall$(CP) 3rdparty/dyncall/dynload/*.h | |||
3rdparty/libtommath/bn_mp_sqrtmod_prime.o 3rdparty/libtommath/bn_mp_sub.o 3rdparty/libtommath/bn_mp_sub_d.o 3rdparty/libtommath/bn_mp_submod.o 3rdparty/libtommath/bn_mp_to_signed_bin.o 3rdparty/libtommath/bn_mp_to_signed_bin_n.o 3rdparty/libtommath/bn_mp_to_unsigned_bin.o 3rdparty/libtommath/bn_mp_to_unsigned_bin_n.o | |||
3rdparty/libtommath/bn_mp_toom_mul.o 3rdparty/libtommath/bn_mp_toom_sqr.o 3rdparty/libtommath/bn_mp_toradix.o 3rdparty/libtommath/bn_mp_toradix_n.o 3rdparty/libtommath/bn_mp_unsigned_bin_size.o 3rdparty/libtommath/bn_mp_xor.o 3rdparty/libtommath/bn_mp_zero.o 3rdparty/libtommath/bn_prime_tab.o 3rdparty/libtommath/bn_reverse.o | |||
3rdparty/libtommath/bn_s_mp_add.o 3rdparty/libtommath/bn_s_mp_exptmod.o 3rdparty/libtommath/bn_s_mp_mul_digs.o 3rdparty/libtommath/bn_s_mp_mul_high_digs.o 3rdparty/libtommath/bn_s_mp_sqr.o 3rdparty/libtommath/bn_s_mp_sub.o 3rdparty/libtommath/bncore.omoar::tomrule=$(AR) $(ARFLAGS) $@ | |||
3rdparty/libtommath/*.omoar::translate_newline_output=0moar::usrlibs[0]=pthreadmoar::uvclean=$(RM) 3rdparty/libuv/libuv.a $(UV_DARWIN)moar::uvlib=3rdparty/libuv/libuv.amoar::uvobjects=$(UV_DARWIN)moar::uvrule=$(AR) $(ARFLAGS) $@ $(UV_DARWIN)moar::vectorizerspecifier=_Pragma ("clang loop | |||
vectorize(enable)")moar::version=2019.03moar::versionmajor=2019moar::versionminor=03moar::versionpatch=0perl6::build-date=2019-04-01T13:05:17Zperl6::can-language-versions=6.c 6.d 6.d.PREVIEWperl6::codename=perl6::implementation=Rakudo | |||
Starperl6::language-version=6.dperl6::libdir=/usr/local/Cellar/rakudo-star/2019.03/shareperl6::prefix=/usr/local/Cellar/rakudo-star/2019.03perl6::release-number=perl6::source-digest=6f6586978743151a83b7dccf9d2dff4b6d32e024perl6::version=2019.03.1repo::chain=inst#/Users/philippe/.perl6 inst#/usr/local/Cellar/rakudo-star/2019.03/share/perl6/site | |||
inst#/usr/local/Cellar/rakudo-star/2019.03/share/perl6/vendor inst#/usr/local/Cellar/rakudo-star/2019.03/share/perl6 ap# nqp# perl5# | |||
OK. I'll get the latest version, and report back. | 17:11 | ||
17:11
phi left
|
|||
Geth | doc: 2a0afba129 | (Brian Duggan)++ | bin/p6doc Add search command for p6doc |
17:12 | |
doc: a6da455e0d | (Brian Duggan)++ (committed using GitHub Web editor) | bin/p6doc Merge pull request #3196 from Raku/search Add search command for p6doc |
|||
17:12
mike__ joined
17:16
mahmudov joined,
mahmudov left,
mahmudov joined
17:17
mike__ left
17:25
Kaeipi left
17:26
Kaeipi joined
17:37
xinming left
|
|||
cpan-raku | New module released to CPAN! App::Rakuman (0.1.0) by 03TYIL | 17:38 | |
New module released to CPAN! App::GTD (0.2.0) by 03TYIL | |||
17:38
xinming joined
17:42
Tirifto joined
17:48
Kaeipi left
17:49
Kaiepi joined
17:50
Kaiepi left
18:06
hacktor joined,
ilogger2 joined
18:28
xelxebar joined
|
|||
cpan-raku | New module released to CPAN! Date::Calendar::CopticEthiopic (0.0.2) by 03JFORGET | 18:28 | |
18:34
kensanata joined
19:00
sena_kun joined
19:05
leont joined
19:10
domidumont joined,
gabiruh joined
19:16
leont left
|
|||
discord6 | <theangryepicbanana> can someone help add this to the list of modules (or whatever the docs called it) github.com/ALANVF/Raku-LLVM | 19:21 | |
19:22
chloekek joined,
phi joined
|
|||
discord6 | <theangryepicbanana> it took a long time to figure it out the last time I tried to | 19:22 | |
AlexDaniel | you mean github.com/Raku/ecosystem ? | 19:24 | |
can you send a PR? :) | |||
phi | Howdy. A few hours ago I reported and issue with a class declared in an unit, in p6 2019.03.1. | ||
discord6 | <theangryepicbanana> AlexDaniel: sure | 19:25 | |
phi | I have just installed moar-2020.01 using rakudobrew on OSX 10.14.6; yet the issue is the same. | ||
Here's my Butterfly.pm6 file: | 19:26 | ||
unit class Butterfly; method who-am-i { put self.ˆname }; | |||
And here's the content of my use-butterfly.p6 file: | 19:27 | ||
use Butterfly; my $b = Butterfly.new; $b.who-am-i; | |||
When I run perl6 -I . use-butterfly.p6, the following message gets displayed: | 19:28 | ||
19:29
japhb left
|
|||
phi | No such method 'ˆname' for invocant of type 'Butterfly' in method who-am-i at /Users/phi/Desktop/p6/Butterfly.pm | 19:29 | |
19:29
leont joined
|
|||
MasterDuke | m: class Butterfly { method who-am-i { put self.^name }; }; Butterfly.who-am-i; | 19:31 | |
camelia | Butterfly | ||
Geth | ecosystem: ALANVF++ created pull request #482: Add Raku-LLVM |
19:32 | |
MasterDuke | m: class Butterfly { method who-am-i { put self.HOW.name($) }; }; my $b = Butterfly.new; $b.who-am-i; | ||
camelia | Butterfly | ||
MasterDuke | m: class Butterfly { }; my $b = Butterfly.new; put $b.^name; | 19:35 | |
camelia | Butterfly | ||
19:44
phi left
|
|||
discord6 | <theangryepicbanana> AlexDaniel: I opened a PR, however the build seems to have failed since I don't include the llvm7 native lib | 19:47 | |
19:48
phi joined
|
|||
phi | Hi MasterDuke, try putting the Butterfly class in a separate file. | 19:48 | |
... In a unit class Butterfly class. | 19:49 | ||
19:50
leont left
|
|||
MasterDuke | even your original example (not my alternatives) work if i do that | 19:51 | |
phi | ... which OS are you running on? | 19:52 | |
MasterDuke | arch linux | ||
phi | I'm on OSX. | ||
MasterDuke | i know lizmat is on OSX, not sure who else is to confirm | 19:53 | |
phi | I can provide a screenshot, if necessary. | 19:54 | |
MasterDuke | did you create an issue in the rakudo repo already? | 19:55 | |
phi | I certainly plan to, now that I have managed to reproduce the issue using the latest version of Raku. | 19:57 | |
MasterDuke | good | 20:00 | |
discord6 | <theangryepicbanana> anyone? | 20:01 | |
phi | Cheers, MasterDuke. Signing out. | 20:04 | |
20:04
phi left
|
|||
Tirifto | Hello! Is there any way I can pass a variable to ‘use lib’? I would like to import modules at runtime with ‘require’, from a directory that only gets specified at runtime, but it looks like ‘use lib’ needs its directory specified at compile time. | 20:10 | |
discord6 | <theangryepicbanana> would require lib work? | ||
20:12
sno joined
20:15
Actualeyes joined
|
|||
Tirifto | theangryepicbanana: …it didn’t complain, so I guess it would! Thanks, I didn’t know that was valid syntax. :-) | 20:17 | |
20:19
Sgeo__ joined
20:26
gabiruh left
20:29
Celelibi joined
20:30
ChoppedBacon joined
|
|||
discord6 | <theangryepicbanana> oh nice | 20:31 | |
20:31
xinming joined
20:34
domidumont left
|
|||
Geth | ecosystem: dd41814a70 | alan.invents++ (committed using GitHub Web editor) | META.list Add Raku-LLVM |
20:37 | |
ecosystem: 08b587649f | (Aleks-Daniel Jakimenko-Aleksejev)++ (committed using GitHub Web editor) | META.list Add Raku-LLVM (#482) Add Raku-LLVM |
|||
AlexDaniel | theangryepicbanana: does debian have required dependencies in its repos? If so, please submit a PR with your deps here github.com/Raku/Blin/blob/master/d...pendencies | 20:38 | |
theangryepicbanana: this way we'll be testing your module before every release :) | 20:39 | ||
discord6 | <theangryepicbanana> ok thanks | 20:41 | |
20:45
sena_kun left
20:46
japhb joined
|
|||
AlexDaniel | I wonder if travis will keep reporting failures for the ecosystem repo | 20:46 | |
it failed to test something because there's no gcc, well, so what | |||
20:48
xi left
|
|||
Voldenet | I've seen that problem by phi and | 20:50 | |
m: class Butterfly { method who-am-i { put self.ˆname }}; Butterfly.new.who-am-i | |||
camelia | No such method 'ˆname' for invocant of type 'Butterfly' in method who-am-i at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
discord6 | <theangryepicbanana> all it needs is the LLVM-7 native lib provided by clang | ||
Voldenet | no idea what uses ˆ instead of ^ | 20:51 | |
20:51
xi joined
|
|||
MasterDuke | ha! | 20:52 | |
Voldenet++ | |||
unicodable6: ˆ | |||
unicodable6 | MasterDuke, U+02C6 MODIFIER LETTER CIRCUMFLEX ACCENT [Lm] (ˆ) | ||
Voldenet | I try to avoid utf-8 in the source, because fonts are not making it easy to tell all the glyphs apart | 20:53 | |
AlexDaniel | yeah, I actually see that it's different | 20:54 | |
MasterDuke | i do now that i'm looking | ||
AlexDaniel | but where did they take that example? | ||
Voldenet | if you use utf-8 in the source, I will find you and replace all your variables with emojis | ||
discord6 | <theangryepicbanana> AlexDaniel: done | ||
AlexDaniel | Voldenet: I use it. All the time. “” ‘’ ∞ × ÷ 「」 | ||
Voldenet: «» 〈〉 :) | 20:55 | ||
20:55
lostinfog joined
|
|||
Voldenet | I think “” and ‘’ from these can be hard to tell apart from "" and '' depending on font, everything else is at least visibly different | 20:56 | |
AlexDaniel | Voldenet: syntax highlighting | 20:57 | |
discord6 | <theangryepicbanana> nice so my module was added | 20:58 | |
Voldenet | if everyone used syntax highlighting and tools for code editing, it could be possible to use STX (0x02) and ETX (0x03) for strings… | ||
discord6 | <theangryepicbanana> hopefully this means that raku is an even better option for making languages than other languages are | 20:59 | |
20:59
sena_kun joined
|
|||
AlexDaniel | Voldenet: being able to tell '' and ‘’ apart is a non-issue | 21:00 | |
how often do you look at the code with syntax errors through something that doesn't have syntax highlighting | 21:01 | ||
Voldenet | i.imgur.com/V8RjZEQ.png :) | 21:02 | |
I know that nobody uses displays with low resolutions except me | |||
AlexDaniel | that's a very nice font | 21:03 | |
what is it? | |||
Voldenet | ibm plex | ||
AlexDaniel | well, I'm not sure I can tell other characters apart with that font | 21:04 | |
but I like the idea of tiny fonts | |||
Voldenet | it takes a bit of practice, but there's not much you can do with a sad 800x600 display | 21:05 | |
AlexDaniel | I'd use it on any other display :D | ||
guifa | Tiny fonts have their place, but lately I’ve been enjoying coding with fairly large fonts. | ||
guifa mumbles something about getting old even though he’s not even half way to his life expectancy | |||
21:08
maggotbrain joined
21:10
wamba joined
|
|||
Voldenet | Ascii is more constrained, so it's more predictable and easier to tell characters apart, so I don't have to wonder whether 「」or 「 」 is used | 21:10 | |
AlexDaniel | i.imgur.com/ZSww5Y9.png | 21:14 | |
21:17
melezhik2 joined
|
|||
Voldenet | …with this I could put over 100 lines of code on the 800x600 screen :) | 21:18 | |
AlexDaniel | it should be almost 200 | 21:20 | |
Tirifto | theangryepicbanana: Okay, no, ‘require lib’ just requires a module called ‘lib’. Bummer. :P | ||
AlexDaniel | it is probably meant to be used with no pixels between lines | ||
only a few characters go beyond 2 pixels in height, so it should be fine | 21:21 | ||
don't know why the example doesn't do that :) | |||
but to be honest I can't read it anyway, so that wouldn't've helped for sure | 21:22 | ||
Voldenet | leadings are necessary, because otherwise it'd be hard to read even one line | 21:23 | |
21:23
melezhik2 left,
kensanata left
|
|||
AlexDaniel | Voldenet: not exactly. Some tiny fonts violate that. See robey.lag.net/2010/01/23/tiny-mono...-font.html | 21:24 | |
Voldenet | There's a pixel between lines, but probably 1px is enough | 21:25 | |
AlexDaniel | Voldenet: it uses that pixel to draw g j p q y | 21:26 | |
Voldenet: btw there's a trick for non-ascii characters | 21:28 | ||
Voldenet: just let them fall back to truetype fonts | |||
this way ascii characters will render crisp and everything else will be smudgy but distinct | |||
21:29
gabiruh joined
|
|||
Voldenet | Okay, it makes sense to have descenders in that spacing, otherwise it looks more awkward | 21:29 | |
21:32
leont joined
|
|||
Voldenet | Using truetype fonts works in some environments, but sometimes I only have bitmap font + nano/vi | 21:35 | |
and it's non-trivial to install xorg everywhere :) | 21:36 | ||
TreyHarris | In a case like guifa's bit.ly/2vI3YqF example above, which spits out a 1000-element list with all but 4 undefined, how best to filter those out? `@list.grep(so *)` works, but is there a more idiomatic way? | 21:41 | |
AlexDaniel | TreyHarris: I'd write it as *.so but otherwise that's exactly how you do it | 21:47 | |
Voldenet | TreyHarris: I'd use a hash unless there's a reason not to | ||
AlexDaniel | TreyHarris: *.defined if you're picky :) | ||
discord6 | <theangryepicbanana> maybe @list.grep(&so)? | 21:49 | |
AlexDaniel | TreyHarris: or just don't put undefined values into your list | 21:50 | |
Voldenet | Using array there will actually allocate a lot of memory for no reason | 21:51 | |
AlexDaniel | pretty much what Voldenet said :) | ||
Voldenet | You may also consider this: ix.io/292Y | 21:52 | |
AlexDaniel | e: ix.io/292Y | 21:53 | |
evalable6 | AlexDaniel, Successfully fetched the code from the provided URL | ||
[{chinese => 狗, english => Dog, number => 1} {chinese => 貓, english => Cat, number => 2} {chinese => 詷, english => Word, number => 998} {chinese => 人, english => Person, number => 999}] | |||
AlexDaniel | right | ||
21:55
atweiden-air joined,
melezhik2 joined
|
|||
atweiden-air | who is signing the nqp and rakudo source tarballs with pgp fingerprint FE750D152426F3E50953176ADE8F8F5E97A8FCDE? how do i obtain their public key? | 21:56 | |
AlexDaniel | atweiden-air: it is this: pgp.mit.edu/pks/lookup?search=kiry...p;op=index | 21:59 | |
atweiden-air: I'm not sure why the search function doesn't bring it up… do you have any idea? | |||
atweiden-air: also github.com/Altai-man.gpg | 22:00 | ||
atweiden-air | is anyone else unable to obtain that key with gpg --recv-keys DE8F8F5E97A8FCDE ? | ||
AlexDaniel | atweiden-air: yeah that doesn't work | ||
atweiden-air | any idea as to why? | ||
AlexDaniel | I don't know | 22:01 | |
22:04
melezhik2 left
|
|||
atweiden-air | just added it to sks manually | 22:04 | |
TreyHarris | AlexDaniel, Voldenet I was referring to guifa's solution to rypervenche's question--if it's in scrollback you'll see I suggested not allocating so much space. But apparently in the actual data file, it it monotonically increasing, the sample just had data from the beginning and end of the real data set | 22:06 | |
So there wouldn't be any undefined items in the real list. I was just thinking about how to best filter them out in other cases where they might crop up | 22:07 | ||
22:08
atweiden-air left
|
|||
rypervenche | Well, I had an issue with those (Any) being in there, so instead of inserting the hashes into a specific element, I just did a push into the array. | 22:11 | |
22:17
aeruder joined
|
|||
Voldenet | TreyHarris: Ah, in that case .grep(?*) exists, but it's hardly idiomatic | 22:19 | |
more idiomatic would be .grep(all *.defined) | 22:20 | ||
it's even english | |||
22:21
aeruder left
22:22
chloekek left
|
|||
TreyHarris | rypervenche: I don't follow... do you mean you kept <number> in the structure and pushed it? | 22:25 | |
rypervenche | TreyHarris: Yes. | ||
22:26
aeruder joined
|
|||
rypervenche | I'm still working on the script, but this is what I have so far: gist.github.com/rypervenche/e42a89...e55a89cae4 | 22:29 | |
22:30
Sgeo__ left
|
|||
TreyHarris | rypervenche: ah, gotcha. A `my Str %numbered-hash{Int}` can stand in as a sparse array in a pinch | 22:32 | |
22:33
Sgeo joined
22:46
sena_kun left
|
|||
TreyHarris | Doesn't one of the built-in associative types do as Python3's OrderedDict does? | 22:47 | |
I notice that dd and .perl both sort the keys of a regular hash, and that made me wonder about preserving insert ordering | 22:49 | ||
rypervenche | I'm not sure I'm at the level where I understand what sparse arrays are/do. :P | 22:51 | |
22:53
lostinfog left
|
|||
TreyHarris | rypervenche: they just don't pre-allocate space when you skip indices. there are lots of ways of storing them in memory, from hash-like methods to linked-list-like | 22:54 | |
rypervenche | Ahhh | ||
TreyHarris | And usually if you print out the entire structure, unassigned slots are skipped, so you wouldn't get the 996 (Any)'s in output | ||
discord6 | <theangryepicbanana> maybe you're looking for Maps? | 22:55 | |
MasterDuke | TreyHarris: nope, the sort is purely an artifact of printing | 22:59 | |
TreyHarris | theangryepicbanana: I don't think so; Maps are immutable, and a quick test doesn't seem to show them as maintaining order | ||
23:00
sena_kun joined
|
|||
TreyHarris | MasterDuke: yes, I asked my question badly, I'm aware of the arbitrariness of ordering and the randomization between runtime invocations... I meant to ask, "is there an OrderedDictionary-like mutable container in core? I thought I remembered such a thing." | 23:00 | |
MasterDuke | heh, i wasn't clear in my answer. i mean to say, "no ordered dictionaries in the core that i'm aware of. .perl and dd do explicitly sort their printed output though" | 23:02 | |
TreyHarris | I learned Python after I'd mastered Perl and after the apocalypses had all been written (and after Pugs even, I believe), so I sometimes confuse features that were added to Python after I first learned it for Raku features. | 23:04 | |
Since OrderedDict was added to Python after I first learned it and after Pugs, I can see where I might fuzzy-mind that into thinking it was a Perl 6 thing | 23:09 | ||
guifa | rypervenche: Ah, I see, you’re not needing the order to be preserved per se, so .push does indeed work just fine. I normally use @array-with-gaps.grep(*.defined) when I want to loop over those. | 23:37 | |
TreyHarris | Not totally sure why, but I was very surprised this works: | 23:55 | |
m: (^20).pick(20).sort: * cmp *.Str | 23:56 | ||
camelia | ( no output ) | ||
TreyHarris | m: say((^20).pick(20).sort: * cmp *.Str) | ||
camelia | (0 1 10 11 12 13 14 15 16 17 18 19 2 3 4 5 6 7 8 9) | ||
TreyHarris | the bit after the colon, I mean, the part before is clear enough | 23:57 | |
m: say((^20).pick(20).sort: * cmp *) | 23:58 | ||
camelia | (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) | 23:59 | |
TreyHarris | I guess it does make perfect sense, it just seems like when used to other languages you're leaving essential stuff out and the language is just figuring it out anyway |