« first day (242 days earlier)
← previous day
next day →
last day (1721 days later) »
Laikoni
9:34 PM
HMC:
Write a XOR function
Bool -> Bool -> Bool
without using any imports or build-in functions from Prelude. (Based on
this CMC by Adám
)
Template:
Try it online!
@H.PWiz has a 26 byte answer, my best attempt so far is 30 bytes.
Oh well, I found a 25 byte answer
H.PWiz
Just found the 25, It's very similar to my 26 but slightly less interesting
I had the patterns the other way around
Laikoni
Yeah, I think just found your 26 byte answer
Actually I think my 30 byte approach was also kind of interesting:
Try it online!
flawr
9:50 PM
Couldn't find
any
solution
@Laikoni what the heck
How can you use
let
there??
H.PWiz
@Laikoni Interestingly the restricted import doesn't let you write
[False..True]
directly
Laikoni
I saw the fact that an empty
let
works as catch-all pattern guard first in an answer by H.PWiz.
H.PWiz
Nope
Mar 9 at 9:36
, by
Potato44
I just found out that you can use `let` instead of `otherwise` in a guard.
fac n|n==0=1|let=n*fac(n-1)
https://tio.run/##y0gszk7Nyfn/Py0xWSGPS0GhJs/W1sDWEMTKSS2xzdMCSmjk6RpqcnHlJmbmKdgqFBRl5pUoqCiAdJj//w8A
flawr
Is it in the tips?
H.PWiz
No, but it would only be useful for restricted source
flawr
9:56 PM
I know, but I wouldn't start a separate
Tips for restricted source challenges in Haskell
:)
xnor
i've got 23
flawr
@Potato44 please consider adding it to the
tips for golfing in Haskell
!
Laikoni
@H.PWiz It does, it's just that
False..
appears to be parsed as one token. Inserting a spaces fixes the issue.
H.PWiz
Yeah, just noticed now...
flawr
(also works in things like
[0|_<-[0..5],let]
)
Laikoni
10:01 PM
@xnor So back to the drawing board it is ...
1 hour later…
Laikoni
11:29 PM
@Laikoni Finally found it. Now for the other logical gates ...
H.PWiz
11:48 PM
I have it too :)
« first day (242 days earlier)
← previous day
next day →
last day (1721 days later) »
all rooms
Transcript for
May
30
Jun '18
2
Jun
3
Of Monads and Men
For discussion about, learning of and golfing in Haskell
codeg...
haskell
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