🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
Homer_Simpson my code is saying its line 0 if I make it 6 which is wrong pastebin.com/3NbJTa2k 00:33
oops here pastebin.com/3NbJTa2k 00:34
tonyo what's in data.ldr 00:40
Homer_Simpson 6 6 00:44
and this is saying invalid line type if I make it 0 6 : pastebin.com/rUYmSJws 00:45
even eq isnt working 01:00
Homer_Simpson anyone here 01:06
:(**@rest, *%rest) me 01:21
tonyo m: dd "6" && " ";
camelia " "
:(**@rest, *%rest) Homer_Simpson: it looks like bad code tbh 01:22
stevied /tonyo left you a present, earlier
tonyo ^^
stevied here ya go: github.com/tony-o/raku-fez/issues/80 01:23
:(**@rest, *%rest) Homer_Simpson: also you can try dd @x
stevied blank lines in .gitignore cause problems for fez
tonyo stevied: i have a branch that may fix if you're savvy 01:24
stevied i wouldn't call myself savvy, just know enough to be dangerous
tonyo the `glob` branch *should* fix that error, i'm currently testing before releasing 01:25
the current way is entirely wrong and sometimes that regex ends up with zero files so pax|tar hangs waiting on stdin
stevied what's weird is that the pax command seems to complete, it's only when .exitcode is called on it do things hang, afaict. 01:26
not sure exactly what's going on with that
i'll wait for official release. solved the problem by just deleting the blank line 01:27
Homer_Simpson present?
stevied o 01:28
Homer_Simpson the last thing I see on my irc is: <tonyo> what's in data.ldr
stevied i'm not 100% sure, but I think the blank line in .gitignore was causing mi6 to choke: github.com/skaji/mi6/issues/166#is...1399647182
i was able to install a module with 2022.12 that I couldn't earlier after getting rid of blank line 01:29
:(**@rest, *%rest) Homer_Simpson: do you have a discord 01:30
pingu yes 01:33
ill check it
I wasnt logged in 01:34
so I cant see the chat history
oh wait is it #raku-irc not #general ? 01:35
:(**@rest, *%rest) raku-irc is different from general 01:36
Saul Goodman I see say "6" && " "; but I dont see how that would help 01:38
2 mins
:(**@rest, *%rest) can you recreate the data.ldr or just send the file 01:39
@Saul Goodman 01:41
Saul Goodman the data is 6 6 01:43
but if I do when ("0" && " ") I get "line is ype 0"
which is wrong
because its 6 01:44
:(**@rest, *%rest) "0" && " " is " " i think 01:46
raschipi m:"0" && " " 01:49
evalable6 WARNINGS for /tmp/ItQOvvBmD8:
Useless use of constant string " " in sink context (line 1)
01:50
raschipi m: say "0" && " "
camelia
:(**@rest, *%rest) m: dd '0' && ' ' 01:52
raschipi m: dd '0' && ' ' 01:53
camelia " "
:(**@rest, *%rest) back to @Saul Goodman
what error do you have exactly
Saul Goodman theres no error its printing the wrong result 01:54
my file is 6 6 but the console is saying that its line 0
:(**@rest, *%rest) no? 01:55
it says invalid line type
raschipi If you smartmatch against True, it's always success. 01:56
Ops, please ignore what I said, && returns the argument.
Saul Goodman I'm telling you what error I have with my code 01:58
though its not so much an error per se
pastebin.com/gnC4jUQ5 01:59
:(**@rest, *%rest) i recreated it here glot.io/snippets/ghq0smqf9n
don't know what are you expecting 02:01
Saul Goodman that code does not work if I make it 0 6
(in the file) 02:02
:(**@rest, *%rest) i saw the problem @[0][0..1] is not a string 02:05
but you matched it against one
Saul Goodman its a sequence 02:06
according to dd
:(**@rest, *%rest) you have to join them 02:08
glot.io/snippets/ghq0smqf9n
Saul Goodman aight that works 02:09
tonyo stevied: if you could install the glob branch of fez and give it a go it'd much appreciated 02:47
stevied /tonyo ok, will do. is there a way to do a "fake" upload 02:49
I'd like to test it without actually uploading
I can throw an exit; in the code for now but wondering if there is a better way 02:50
i'm getting a message that "Directory version(0.0.10) appears to exist" 02:56
i guess some kind of check was added in the glob branch? how do I circumvent that?
tonyo stevied if you upload you have about 24 hours to run a fez remove <full dist, same that's output when you `fez list`> 03:43
the other option is doing something like an ACME package, that's what i use to test things
(Fez::ACME), it's just an empty module 03:44
rf When would I ever use try? 03:46
raschipi To separate error handling from normal code. Say an exception is very unlikely, you don't want to keep the code that deals with it mixed in normal flow. 03:50
stevied yeah, used the earlier today, in fact.
rf Makes sense 03:56
tonyo also optionally including functionality if some module exists 04:50
try require ::("Terminal::ANSIColor")
shmup messing around with raku. i have a socket listener and it's just echo'ing back the $conn.line from a client connection, if i ^c then my react block blows up "Malformed UTF-8". can someone point me to a doc that can set me straight? is there a convention that isn't trying to catch it? 04:54
:(**@rest, *%rest) are objects that don’t have .Bool coercer implemented always truthy? 13:09
lizmat m: dd Mu.Bool 13:16
camelia Bool::False
lizmat m: dd Mu.new.Bool
camelia Bool::True
lizmat that's your default .Bool
it's true if it is instantiated, else not
:(**@rest, *%rest) hmm ok 13:20
m: say '2' ~~ /[0-9]/ 15:19
m: say '2' ~~ /<[0..9]>/ 15:20
hmm
Nemokosch for what? 15:22
:(**@rest, *%rest) why does /[0-9]/ give an error 15:26
Nemokosch first you tell me: what behavior you'd prefer? 15:27
:(**@rest, *%rest) i want to parse characters in between 0 and 9 15:31
/[0-9]/ is how i would do it better yet /\d/ but im talking more general than that 15:33
/[0-9]/ instead in raku throw an error 15:34
raschip [...] in a Raku regex is a non-capturing group, not a character class 15:37
:(**@rest, *%rest) m: say '0-9' ~~ /[0-9]/ 15:38
what 15:38
m: say '0-9' ~~ /0-9/ 15:39
raschip m: say '0-9' ~~ /[0\-9]/
camelia 「0-9」
Nemokosch yeah ultimately you'd want to learn Raku regexes
raschip You need to quote the -
:(**@rest, *%rest) how can yours work
like \-? 15:40
raschip yep
m: say '0-9' ~~ /0\-9/
camelia 「0-9」
:(**@rest, *%rest) m: say '0-9' ~~ /0\-9/
Nemokosch it doesn't show up in the bridged message
misleading
:(**@rest, *%rest) discord ate away the \ 😭
Nemokosch tbh I'd rather really quote strings inside a regex 15:41
even looks better usually
and it's more transparent overall
:(**@rest, *%rest) the repetition operator in raku regex is ** 15:49
raschip Yep, exponentiation
aaa == a**3
:(**@rest, *%rest) m: regex ip-num { \d**1..3 } regex ip { (<ip-num>) '.' (<ip-num) '.' (<ip-num) '.' (<ip-num) } say '192.168.1.1' ~~ ip; 15:51
m: regex ip-num { \d**1..3 } regex ip { (<ip-num>) '.' (<ip-num>) '.' (<ip-num>) '.' (<ip-num>) } say '192.168.1.1' ~~ ip; 15:51
bruh
raschip m: '192.168.1.1' ~~ /(\d**1..3)**4 % '.'/ 15:57
camelia ( no output )
raschip m: say '192.168.1.1' ~~ /(\d**1..3)**4 % '.'/ 15:58
camelia 「192.168.1.1」
0 => 「192」
0 => 「168」
0 => 「1」
0 => 「1」
:(**@rest, *%rest) m: my regex ip-num { \d**1..3 } my regex ip { <ip-num>**4 % \. } my $match = '192.168.1.1' ~~ &ip; dd $match; 15:59
m: my regex ip-num { \d**1..3 } my regex ip { <ip-num>**4 % \. } my $match = '192.168.1.1' ~~ &ip; say $match; 16:00
raku regex are more complex and feature rich than perl/pcre regex lol 16:01
m: my regex hex { ‘0x’? <[\dA..Fa..f]>+ } say ‘DEAD’ ~~ &hex; 16:06
m: my regex hex { ‘0x’? <[\dA..Fa..f]>+ } say ‘0x1234DEAD’ ~~ &hex;
raschip Of course Raku regexes are more feature rich than Perl re, they are used to parse Raku itself... 16:07
:(**@rest, *%rest) i thought pcre is as complex as it can get
raschip Well, they are, really, but the features that make them as complex as Raku's are obscure and hard to use. They are Turing-complete, after all. Raku's regexes make those features way easier to use. 16:09
:(**@rest, *%rest) m: my regex hex-prefix { ‘0x’ } my regex hex-digit { \d | <[A..F]> | <[a..f]> } my regex hex { <hex-prefix>? <hex-digit>+ } say ‘0x1234Dead’ ~~ &hex; 16:10
i think this time i can use a grammar?
raschip Regexes and Grammars are the same thing, really, just two ways of declaring the same objects. Use whatever is more convenient... 16:12
:(**@rest, *%rest) ok so raku regexes are both used for lexing and parsing... grammars are just regexes under the hood 16:13
rf Can I make zef run tests in the it/ directory for integration tests? 17:43
[Coke] rf; "zef test ." ? 17:49
oh, it/ isn't a typo. hmm 17:50
rf Yeah like if I have tests in it/ 17:57
or xt/
[Coke] github.com/ugexe/zef/blob/main/lib...kumod#L106 18:01
Looks like the t is hardcoded
rf Darn 18:42
ugexe: Is there any way to run tests in it/ and t/ with zef? 18:43
ugexe no, like tests in e.g. xt/ are run during authoring/development typically and so the functionality doesn't really need to exist for general distribution consumption. i usually run my xt/ tests in CI manually via `raku -I. xt/my-test.rakutest` or like `prove6 -I. xt/` 19:00
so theoretically i might add xt/, but then you're asking for it/ which shows other people will want foot/ etc 19:01
rf Makes sense 19:11
Thanks for the response
ugexe another technique is running like SKIP-ALL() or whatever it is unless some ENV var is set 19:19
so put all your tests in t/, but at the top of the test check for %*ENV<RAKU_AUTHOR_TESTS> or some such
then you can do `RAKU_AUTHOR_TESTS=1 zef test .` 19:20
rf I just added prove6 to my CI pipeline I think it'll be fine, realistically I'll be the only one authoring this so if it fails CI and gets authored that's more of a me problem 19:24
ugexe yeah thats how i handle it as well with zef, which has xt/ 21:19
well i just run `raku -I xt/tet-name.rakutest` but yeah the same sentiment
pingu is there a way to do this without having to do .join pastebin.com/jL3smrqy 21:25
the contents of data.ldr is: 0 0\n1 0\n2 0\n3 0\n4 0\n5 0\n6 0\n 21:26
also im getting error: Type check failed in binding to parameter '$address'; expected Str but got Any 21:27
validateline type should not have to start making new arrays and joining stuff
just for @x -> @line works but I wanted to pass the line number as a range or an int as a function argument 21:31
not have the function hardcoded to just do all lines at once 21:32
ok I fixed one thing, this works: given (@x[0][0] ~ @x[0][1]) 21:38
now I dont need the for loop
Nemokosch could you quickly say what you are trying to achieve? 21:40
pingu its fine I fixed it 21:41
only problem is, I thought <space>0<space>0\n would be invalid ldraw but its valid so now I gotta change the code again 21:42
so: my $line = 0; my $index = 0; loop (@x[$line][$index] = 0 ; @x[$line][$index] le chr(32) ; $index++) { #`{...}`} 21:48
raschip v6.e.PREVIEW isn't available in the REPL? 21:55
thundergnat m: gist.github.com/thundergnat/ff2f5e...0b28e9e68c 21:59
camelia 0
1
2
3
4
5
-1
-1
3
4
0
thundergnat pingu: seems like you are doing an awful lot of extra work. See the above gist ^^ 22:00
pingu yes but at least im learning, not just copying other peoples code 22:03
ill try this thx 22:04
thundergnat 👍 Kudos for learning. Nothing wrong with copying either, as long as you are doing it to gain understanding. 22:06
Nemokosch raschip: the way the REPL works is, well, not very smart, simply put 23:02
it doesn't actually create a compilation unit, for example, so it cannot set a version 23:03
maybe if you can get rakudo execute stuff before opening the REPL
pingu: what thundergnat said + please keep in mind that Raku is kind of a language with batteries, a nuclear reactor, a swiss army knife and a space station included 23:06
one of the most common things to happen is "oh why did nobody tell me this cool thing existed"
raschip Nemokosch: True, but I'm having REPL problems lately and I wasn't sure if it was just me or a general thing, thanks. 23:11
tellable6 raschip, I'll pass your message to Nemokosch
Nemokosch freshly defined operators also wouldn't work, as another example 23:12
tonyo . 23:37