« first day (1361 days earlier)
← previous day
next day →
last day (417 days later) »
Razetime
5:22 AM
Tryigng something crazy
4 hours later…
Razetime
9:08 AM
This one works fine as a normal program here:
Try it online!
but when I map it over a list, it just returns [] for some reason:
Try it online!
@Zgarb is there any solution to it?
Zgarb
10:05 AM
@Razetime Hmm, I thought
r
was the problem, but changing it to
i
fixes it only partially:
Try it online!
Razetime
oh my god
Zgarb
Try it online!
Ok there's definitely something fishy here.
Razetime
yep it's very strange lol
well this works I guess
Try it online!
Zgarb
Ok I see what's up
¶
gets a string, which is a list of characters, and separates the elements by newlines
Razetime
yes
Zgarb
10:12 AM
Then
mi
gets the int corresponding to each char of the resulting string
Razetime
ok
so the zeros come from empty lists in the splits?
Zgarb
So "2,3" -> "'2'\n','\n'3'" -> bunch of 0s with 2 and 3
Razetime
interesting
so
r
sees \n, freaks out and gives 0
for everything
is this behaviour put up somewhere in the wiki?
would be a good idea to put that there
or the tips thread
Zgarb
Yeah, that's probably what happens
I'm not sure if the behavior of
r
and
i
is fully documented. I should write that somewhere.
Razetime
10:58 AM
Try it online!
Question: How do Icenter each matrix's columns?
Zgarb
11:14 AM
What do you mean by center? Pad with 0s?
1 hour later…
LegionMammal978
12:35 PM
@Razetime It's because due to all the different types other functions can take,
r
knows it can return just about any concrete type at all; it defaults to
TNum
@Zgarb Is that roughly correct?
Razetime
12:56 PM
yes, pad with 0's
@Zgarb padding with 0's is it
I'm thinking something and then
T0
probably
Zgarb
Hmm, might be easier to build the padding by hand and join
Try it online!
Not sure if optimal
Razetime
mm cool
Yay we got it
time goes fast eh
only two more days for LotM to end
LegionMammal978
1:58 PM
Man, I really hate
?
, it takes forever to infer and it never does what you want it to
Razetime
2:30 PM
well depends where you use it
It's pretty nice for recursive functions
@LegionMammal978 I recommend downloading ghci and running husk locally
LegionMammal978
@Razetime I do, still takes forever to infer though
After all, I could hardly have patched the string parsing without testing it offline
Razetime
ah well
@Zgarb why use pairs when we can use two-element lists?
LegionMammal978
2:48 PM
@Razetime Two-element lists are really annoying, you can't even apply a function over them easily
It makes things like
‰
almost useless in practice
Razetime
3:01 PM
well, applying a function over them, meaning?
you can use them as args?
LegionMammal978
Yeah, I asked about it earlier and it takes two bytes
(well, unless the result type is the same as the argument types, but that's rare in my experience)
Razetime
gotta keep that in mind
« first day (1361 days earlier)
← previous day
next day →
last day (417 days later) »
all rooms
Transcript for
Oct
28
Oct '20
29
Oct
30
Husk
A functional golfing language inspired by Haskell. GitHub:
git...
join this room
about this room
00:00
06:00
12:00
18:00
all times are UTC
site design / logo © 2024 Stack Exchange Inc;
legal
mobile