Nemokosch | how can I define a switch with sub MAIN? | 00:34 | |
you know, something like --amend for git commit | |||
hm, Bool:D :$switch will do the trick? | 00:36 | ||
I mean, I want a multi actually, the switch would have a clause | 00:37 | ||
Yeuph | So switching the sigil from $ to % worked, though I don't understand why. | 00:40 | |
Hmmm, the words I'm storing in the textfile are duplicating in the set. | 00:49 | ||
kinda was hoping Raku woulda been smart enough to figure out not to do that on it's own - because *set* | 00:50 | ||
I guess I need to add some condition check when writing to the textfile to not duplicate words? | 00:51 | ||
Rogue | There should not be duplicates in a set | 02:05 | |
can you post your most recent code @Yeuph#9974 ? | |||
Yeuph | my %SetText is SetHash; | ||
%SetText.set(slurp "SetText.txt"); | |||
my $InputWord; | |||
repeat { | |||
$InputWord = prompt 'Add word to %SetText: '; | |||
%SetText.set($InputWord); | |||
spurt "SetText.txt", %SetText; | |||
} while $InputWord ne "I'm done"; | |||
%SetText.unset("I'm done"); | |||
%SetText.say; | |||
at the end you can see the "%SetText.say" | 02:06 | ||
it'll list duplicate words in the %SetText and also the textfile (SetText.txt) | 02:07 | ||
it'll list duplicate words in the %SetText and also store duplicates in the textfile (SetText.txt) | |||
Rogue | Hm, one problem I see is that you're using the result of `slurp` in the first call to `.set` | 02:09 | |
slurp returns the entire contents of the file as a single string | |||
you want to split that string on space | 02:11 | ||
so something like `%SetText.set: (slurp 'SetText.txt').split(/\s/)` | 02:12 | ||
you're getting what *appear* to be duplicates because you have a string in there which looks like multiple words | 02:14 | ||
Yeuph | ahh | ||
ok, so I was just storing some string of words as a single element in the set; and any new words as a new element (and a new string) | 02:16 | ||
Rogue | yep | ||
Yeuph | I'll do your fix | ||
but its worth checking to see if 2 exact strings will duplicate | |||
because *science* | |||
Rogue | yeah it's always good to verify even what you really strong assume will work | ||
yeah it's always good to verify even what you really strongly assume will work | |||
because the moment you don't is the moment you happen to have overlooked something :P | 02:18 | ||
or so it often seems | |||
02:20
frost joined
|
|||
Yeuph | well its still storing identical strings as duplicates (before your split code anyway) | 02:22 | |
kinda curious | |||
🤷 | |||
*split* works! | 02:26 | ||
ty ty sir | |||
or sir-ette | 02:27 | ||
Rogue | you're welcome | 02:28 | |
and sir is right haha | |||
03:06
frost left
04:56
frost joined
07:19
frost left
07:59
laidback_01 left
08:01
immediate joined
08:02
laidback_01 joined
08:09
laidback_01 left
08:39
laidback_01 joined
08:48
frost joined
09:08
frost left
09:10
dakkar joined
10:12
Guest53 joined,
Guest53 left
|
|||
Nemokosch | Is there a way to get around the recursive application of hyper? I don't think I ever wanted that behavior; I usually want to pass a list to the operator | 10:14 | |
I mean, yes, probably I can keep using Z | |||
10:22
immediate left
14:03
discord-raku-bot left
14:04
discord-raku-bot joined
16:37
laidback_01 left
17:35
dakkar left
21:11
discord-raku-bot left
21:12
discord-raku-bot joined
21:57
qorg11 left
22:16
qorg11 joined
|