« first day (4064 days earlier)      last day (795 days later) » 

5:00 AM
@AidenChow it can be golfier; it's always fun ;)
 
If it's a simple enough point-free form, sure.
 
4 hours ago, by Bubbler
More sophisticated transforms are possible but learning how to do it requires some understanding of lambda calculus and combinatory logic, so as a beginner you can just remember the site pointfree.io that does the transformation for you. (Note that it doesn't guarantee an optimal transformation.)
 
@AidenChow pointfree.io is helpful, there's a golfing tip for manual conversion too
 
so if i were to try to do a challenge in haskell, i have to make two answers, one in non point free form and one thats in point free form and see which one is shorter?
 
you can usually tell and it can often be useful to go in between
 
5:02 AM
@UnrelatedString Somehow, in a language like Haskell, it seems like everything should be point-free. I know point-full (?) can be golfier, but it just feels wrong somehow. X^D I have the same problem with BQN.
 
lol yeah
 
"Just post it as-is and wait until others do the transformation" is always valid :P
 
if you're only using variables once or twice, it's usually golfy, but more than that or if it's in a list comprehension, it gets complicated
 
my least favorite thing in writing jelly is when i realize explicit //³/® is actually shortest
 
Are there any functions that can't be made point-free?
 
5:05 AM
Ranges and list comprehensions are hard
 
is there a way to check if a certain integer is inside a list of integers?
like in keyword in python?
 
elem
you could also do a hoogle search for a -> [a] -> Bool
 
@JoKing Is there any general pattern that determines why it's a -> [a] -> Bool and not [a] -> a -> Bool, or do you just have to guess the order of the arguments?
 
Hoogle will search both forms for you
 
Ah, nice
 
5:10 AM
It also helps to limit search to package:base
 
Well, this has been equal parts confusing, enlightening, and fun, but I really need to go to bed now. o/
 
o/
 
What is package:base, and how is it related to Prelude?
 
Learning haskell is a highly intellectual recreational activity :P
 
what No instance for (Num Bool) arising from a use of ‘+’ mean?
cant make sense of it
 
5:13 AM
The base package is what you can import without installing 3rd party packages. Prelude is a part of base package which is loaded automatically for any source code.
 
It means you're trying to add a boolean.
 
@Nitrodon oh shoot you cant do that?
 
Haskell is strongly typed, so you can't treat bools like numbers
 
ah ok, what is the best way to convert true to 1 and false to 0
 
Bool -> Int results in fromEnum
 
5:15 AM
Yeah, I think that's the shortest
Limiting yourself to numeric operations in the first place is a good idea too
 
By the way, the duckduckgo shortcut for hoogle is !h
 
5:30 AM
...and you can do sum[1|x] where x is the boolean
 
@Bubbler this does the same thing as fromEnum?
 
Same as fromEnum x to be exact
 
it usually boils down to either "which is more useful to partially apply" or "which makes more sense if it's infix"
in this case it's the latter
 
tell me if there are any golfs :P
 
you don't need the parens around []
or the spaces around h-1
 
5:36 AM
@UnrelatedString ok thanks
 
or the parens around t
 
huh, didnt realize you can do that.
wait i tried ft and it didnt work, so i have to do f t?
 
yeah
ft would be a single identifier
 
huh, then why does f[] work without the space
 
cos that's not a single identifier
 
5:41 AM
because [] aren't valid characters for identifiers
at least for defining them
 
@UnrelatedString oh yeah, doh!
 
not sure how [] as the name of the list type of kind * -> * works but you get the idea
 
elem (h-1) t -> h-1`elem`t
 
most symboly stuff works like that
 
though I now realize it is the same length as elem(h-1)t
 
5:42 AM
@AidenChow technically you could also move the f[]=1 down so you could do f _=1, though that doesn't save any bytes
 
@Bubbler same length as just removing the spaces but yeah probably more idiomatic
 
@Bubbler oh wow ok, that was pretty obvious
what do backticks do????????
 
infix application
 
takes any function and lets you use it like an infix operator
 
@Bubbler wait how does this work?
 
5:47 AM
If x is True, it evaluates to single-element list [1]; otherwise it becomes []
Then you sum it, exploiting the fact that sum [] is 0
 
you can sort of think of list comprehensions as starting with a 1 element list the element of which can't be accessed and doesn't exist, so if all you have is a condition you get a singleton list if it's true and empty if it's false
 
@JoKing what does underscore mean?
 
fairly intuitive if you think of it in terms of what multiple lists do
or even just how multiple lists' lengths relate to the result's length
 
@AidenChow just a variable name, usually indicating an unused variable
 
_ is a special ignored variable, isn't it
you can match f _ _ no problem and neither _ is accessible in the body
 
5:51 AM
oh, that's actually a special syntax? i assumed it was just a stylistic thing
 
i forget if it originated with other languages using _ prefix to silence unused variable warnings or the other way around
 
aww, sum[1|r<-t,r==h-1] is one byte longer
 
but yeah since with no conditions a list comprehension binding from one list of length a has a elements, with a list of length a and a list of length b it has a*b elements, etc., it's clear that a list comprehension that doesn't bind from any lists should have 1 element unless there's a condition to bump that down to 0
 
6:04 AM
0
Q: Recursively rotate a ragged list

loopy waltGiven a ragged list of positive integers return a full cycle of recursive rotations starting with the unchanged input and ending with the state immediately before revisiting the initial state. Examples: [[2,3],4,5,5] -> [[2,3],4,5,5] , [4,5,5,[3,2]] , [5,5,[2,3],4] , [5,[3,2],4,5] [1,10,[2,2,4],...

 
 
2 hours later…
8:12 AM
Proof Assistants is now into public beta
3
 
@JoKing try using an expression with _ in it, rather than a pattern with _
you'll get a type error: _ is called a "hole"
you can use them to find out what type the Haskell type checker wants an expression to have
like if you have [] >>= (what goes here?), then write [] >>= _ and it will tell you what type is wanted
 
i never knew you could do that
that's cool
 
 
2 hours later…
10:05 AM
Chessle 32 (Normal) 4/6

🟩⬛⬛⬛⬛⬛
🟩🟩🟩⬛⬛⬛
🟩🟩🟩🟩🟩⬛
🟩🟩🟩🟩🟩🟩

https://jackli.gg/chessle
 
@NewPosts wow there is a lot of ragged list questions now...
 
what is your bullet rating on lichess
 
i read that as itichiness lmao
 
i just always parse lichess as lich-ess instead of li-chess
 
10:09 AM
well what is it
 
idk sounds like lychees
 
10:27 AM
I pronounce it as li as in likesal and chess as in chess
 
yes but what is your rating
 
@SegFaultPlus4 For some reason I was expecting a rickroll
5
 
i've learned to wait
 
11:04 AM
i have been thinking to disable autocompletion and lsp on my editor..
 
oh no yay haskell
 
oh yum haskell
i wonder where i left off in the tutorial
 
do you has kell?
 
0
Q: Randomly Rounding

tshInput a decimal number, round it to integer. It randomly round up or round down based on its fractional part. If input \$x\$ is an integer, the program should output it as is. If input \$x\$ is non-integer, the program has \$x-\left\lfloor x \right\rfloor\$ probability output \$\left\lceil x \rig...

 
not very well, pygamer.
 
11:14 AM
@Razetime did you know the flax is going to be evaluated from right to left now
 
nope i did not
 
11:26 AM
argh i hate my editor auto importing
 
@pxeger ooh, i thpught? Was just a thing agda had
 
12:14 PM
> thpught
In celebration of the Haskell LYAL:
The problem with Haskell is that it's a language built on lazy evaluation and nobody's actually called for it.
5
 
12:33 PM
haskell!
I've always wanted to learn haskell
(what is haskell?)
 
a functional, statically typed language
i think
its cool
 
Is it really pointfree though?
I can see 4 decimal points right there :p
 
@lyxal lmao
 
12:35 PM
@mathcat Haskell Brooks Curry was an American mathematician and logician best known for his work in combinatory logic.
 
@lyxal I've waited all day to make that joke, looking for an opportune time when there wasn't on-topic haskell learning
 
> A common misconception is that the 'points' of pointfree style are the (.) operator (function composition, as an ASCII symbol), which uses the same identifier as the decimal point. This is wrong. The term originated in topology, a branch of mathematics which works with spaces composed of points, and functions between those spaces. So a 'points-free' definition of a function is one which does not explicitly mention the points (values) of the space on which the function acts.
 
@lyxal No point in an APL solution, is there? ⊃+×/1↓⊢
 
of course there isnt
 
@Adám hence why APL is superior
 
12:36 PM
@pxeger I'm his #1 fan now
 
^^
 
@pxeger wow it's almost as if that's the joke
 
@pxeger We have Haskell and Currying. Why no "Brook(s)" in programming?
 
@Adám about to say "what is it with you and APL" and then I remembered you work for them
 
The Brook programming language and its implementation BrookGPU were early and influential attempts to enable general-purpose computing on graphics processing units. Brook, developed at Stanford University graphics group, was a compiler and runtime implementation of a stream programming language targeting modern, highly parallel GPUs such as those found on ATI or Nvidia graphics cards. BrookGPU compiled programs written using the Brook stream programming language, which is a variant of ANSI C. It could target OpenGL v1.3+, DirectX v9+ or AMD's Close to Metal for the computational backend and ran...
 
12:46 PM
@GingerIndustries Not the whole story. APL has always been a part of my life, way before I got an APL job. I think I can rightfully call myself a native APL "speaker".
 
Dec 19, 2018 at 22:09, by Zacharý
> Adám prides himself on having got APL with the breast-milk, as he attended his first APL conference at the age of one
 
1:01 PM
So turns out I'm so used to VS Code autoformatting code on saving and Copilot's autosuggestions that I get confused why MS Word isn't do either those things when I'm doing report writing
I sit there with an uncompleted sentence thinking "hey wait where's the suggested auto-fill?"
and think that something's wrong when nothing gets reformatted when I save the file
 
wut
You don't write text in VS Code?
is everything ok?
 
Not when it needs actual rich text formatting
and not when it's for uni
gosh what is it with everyone questioning why I'm using MS Word?
like really, is there something so terribly wrong with using the Office suite in 2022?!
 
No, Microsoft Word is quite good.
 
Try Notepad, it might auto-fill
 
@mathcat not like copilot does
 
1:07 PM
MS Outlook can do autofill
 
@Adám I'm glad someone understands it
 
1:19 PM
that is not where that goes
 
well where do it go?
 
on the outline
go to bed
 
well without any prompting from anyone tonight, I'm going for bed new
*now
o/ nerds
 
@lyxal oh really
 
\o
 
1:29 PM
÷/
 
1:55 PM
CMC: Make a rickroll detector: Given a link, check for instances of dQw4w9WgXcQ in the get request and return True/False based on that.
 
@mathcat lambda x:"dQw4w9WgXcQ"in x
 
VTC as unclear :p
 
why did I click delete lol
 
lmao
in the k tree, 1 min ago, by PyGamer0
idea: k plotting library using braille characters
plotting library using braille characters sounds like a nice idea to me
 
1:58 PM
@mathcat Given a Link, invoke a get request, and in the HTML code of the link check for instances of "dQw4w9WgXcQ"
 
(should work)
100 bytes
 
nice
working
[Vyxal, 10 bytes](https://‮(mathcat.surge.sh/JiIsIiIsICSrJCLiICLiIyW/moc.erehwynanohtyp.laxyv
damb
link somehow not working
 
@mathcat needs to start with https://
 
hmm no
you'll have to copy-paste it then
 
2:29 PM
i crossed 1100 rep
 
gg
I crossed 2894 rep
 
only 8900 more until ultimate power
 
I need a name for my tiny microcontroller board
 
Mr. Chill
 
serious names only please
 
2:38 PM
aw
 
currently it's called the Pyco but I don't really like that name so
anyone else?
 
3:02 PM
@GingerIndustries Mircಠ
or CnYB
 
 
2 hours later…
5:18 PM
I just realized, during the Haskell LYAL, I've mostly been typing HMQ when I meant to type HMC ._.
 
@GingerIndustries miCro
since C was written in assembly
 
HMC: Given a printable ASCII character c and an integer n greater than 1, return an n by n square of characters where the outer borders are cs and the inner characters are spaces. For example, if the character is # and the integer is 5, the output should be:
#####
#   #
#   #
#   #
#####
 
@DLosc c=input();n=int(input());print(c*n+"\n"+(c+" "*n-2+c+"\n")*n-2+c*n)
ez
 
I don't suppose there's a faster way to write take n . repeat?
 
5:36 PM
idk i have a pretty solid 67 bytes
 
First attempt, 63 bytes:
 
@pxeger lambda c,n:print(c*n+"\n"+(c+" "*n-2+c+"\n")*n-2+c*n)
53 bytes
your move
 
@pxeger Oops, didn't notice there was an input c. Here's 1 byte shorter:
 
it appears i have outgolfed pxeger
this is my greatest moment
 
in a different language
doesn't count
 
5:46 PM
ye but still
 
and your answer doesn't even work
you need brackets around the n-2s
 
i have an avearge score of 2 on my posts, let me have this
@pxeger ok then, 57 bytes
 
oh wow, 1st of 3
57 is the score to beat
 
I mean yours can be pretty easily be shortened by outputting a list of lines (which is a standard allowed I/O method)
 
5:59 PM
@pxeger you can't have a * at the start of an expression
 
@SegFaultPlus4 I mean you literally can, it literally works
 
i did not know that
 
@SegFaultPlus4 It's a form of argument unpacking
 
i learned something new today about Python
 
@DLosc What's HMC??
I know what CMC is but what's HMC?
 
6:10 PM
@ophact Haskell Mini Challenge
 
Uh... okay.
 
because of the Learn You A Lang event mentioned on the starboard
 
then i propose that LAYL #16 is Python
 
I don't really get what the benefit of the LYAL is, could you explain?
 
Basically, it's a mini LOTM
 
6:11 PM
But with no bounties right?
 
@SegFaultPlus4 Propose it here
 
Yeah, there are no bounties (unless people want to offer them)
 
@DLosc alright then
 
@ophact The original proposal goes over the whys and wherefores
 
I wonder how angry everyone would get if I were to propose JS
-15 score probably
 
6:13 PM
@ophact The general aim is to address the fact that LOTM is kinda restrictive in the languages that work. Common/popular langs are discouraged from LOTM, as are languages that are harder to use such as Malbolge or Lost. With LYAL, we just encourage people in chat to talk specifically about that language, post CMCs relating to the language, and answering with the language, as a bit of a "Give it a try", and because it only lasts a day, people can try out weirder languages "easier"
 
JS v Python, which one gets more downvotes
 
@ophact Given that LYAL is explicitly open to languages that don't qualify for LotM (either because they're too hard to use or because they're too popular), JS would be fine. I'd upvote it.
 
@cairdcoinheringaahing Maybe I should learn Haskell then
 
this will solve the debate of which one is more popular
@DLosc is Python open to LoTM
if so, i'm gonna be making bank
 
Question: which language powers this website? JavaScript obviously.
 
6:14 PM
@SegFaultPlus4 No, because it's commonly used already.
The idea of LotM is to promote less-used languages.
 
753
Q: Which tools and technologies are used to build the Stack Exchange Network?

aleembWhat tools and technologies are used to build the Stack Exchange Network? See also: Which tools and technologies are used to build Data Explorer? Return to FAQ index

 
@DLosc oof size: large
 
Why does this Haskell thing error? I'm probably missing something really obvious here
 
@ophact have u heard of P y t h o n 3
 
We wouldn't be chatting if not for JavaScript.
 
6:19 PM
@ophact I believe Haskell needs a main function for full programs
 
@ophact gotta remake TNB in Python, cya in 5 years
 
@cairdcoinheringaahing Okay... because I just pulled off the printf thing off the wiki
 
Huh weird, apparently printf isnt a thing in Haskell
Keep in mind, I know very little about Haskell :P
• Variable not in scope: printf :: Integer -> t
• Perhaps you meant ‘print’ (imported from Prelude)
 
@pxeger 57 bytes using replicate
 
Haskell isn't really for me sorry
I'll wait another two weeks
 
6:24 PM
@ophact See my question here and the response here
Or TL;DR: main = print 5 works
 
Yeah I sorta gave up on learning Haskell ;) as I said, I'll wait another two weeks
If I'm correct the next language will be F#
 
@ophact That's a pretty quick give-up. :( But yeah, it's not the easiest to learn (which is why I was looking forward to this event--I'd never been able to learn Haskell from the online tutorials, so I wanted to learn it from people I could ask questions of).
 
@ophact There are 5 langs all currently tied on 4 votes, so it could be any of those
 
@ophact Possibly. Depends what the vote totals look like in two weeks, and whether someone's available to teach F# at the time.
 
Plus, there's no requirement to pick the highest voted nomination, that's just what's normally done :P
 
6:28 PM
It could even be some other language that hasn't been nominated yet, if it gets nominated and a lot of people vote for it.
 
If I eventually wanna learn Haskell, I'll probably have to devote a lot of time to it ;)
 
@ophact Technically, C# has played a pretty large role as well :P
 
@DLosc Sadly, refactoring makes it 3 bytes longer
@pxeger Alternately, 57 bytes by using q one more time
 
7:02 PM
@lyxal Vyxal, 3 bytes: ÷*+
@mathcat That's evil
@cairdcoinheringaahing Malbolge LYAL. I don't think even Kamila understands it enough to teach.
 
@emanresuA It's nomination is currently at -3
 
Yeah lol
 
@emanresuA Kamilla wrote a goddamn Lisp interpreter in Malbolge, I think she understands it plenty :P
 
@DLosc 52 bytes! Lexical scope FTW
 
@cairdcoinheringaahing She's created some ingenious toolchain that compiles assembly to Malbolge. She does understand it plenty, but I don't think even she can just type up a program that adds two numbers.
And I doubt she'd be willing to share said toolchain.
 
7:10 PM
 
@emanresuA I think the main problem with Malbolge as a LYAL is that it isn't really a language you can mess around with. Most of LYAL is just playing around with a lang to get it to do things, Malbolge, you don't really write programs, so you can't really play around with it
 
Yeah, that's pretty much what I was trying to say
 
rate my board layout
 
Sus.
 
???
what makes it sus
there are no impostors here
 
7:16 PM
 
ಠ_ಠ
 
@emanresuA he he
gonna use that one more often
 
7:46 PM
hmm, several downvoted answers on int, float or neither
 
8:08 PM
CMQ: Should I use comic sans in a comic?
 
Only use comic sans ironically.
 
8:27 PM
and sparingly even then
 
TIL Haskell main doesn't have to be IO (), it can be IO anything!
 
Cursed idea: Recursive program
 
That's even more cursed
 
I don't see anything cursed about it
it's the most obvious and most idiomatic way to write a full program which loops forever in Haskell
 
8:37 PM
I guess...
Is there such a thing as a niladic function in Haskell?
If so, how do you call it?
 
All expressions in Haskell are lazily evaluated
so there's no difference between a "niladic function" and any single value
 
oic
I meant something like Try it online! btw, although that doesn't work for some reason :(
 
9:01 PM
Ooh, thanks :) never seen a BlockingIOError before
 
9:34 PM
@cairdcoinheringaahing It most certainly is
smh y'all here pointing out "flaws" in Haskell and they're not even the real flaws
 
oh right, but it takes a string, not an int
 
The example has printf "%s, %d, %.4f" "hello" 123 pi
 
i would hope that printf would take a string lol
 
It seems to use that cursed Haskell style varargs WW mentioned once
 
> but Haskell's type system makes this hard
 
9:36 PM
if you want to print an int just use print since ints are Show
 
Sum up Haskell in one sentence
 
@user yeah i'm lowkey horrified by this
 
lol
This seems like it's massively abusing the type system
Which I am 100% okay with because it's at least doing it in a smart way
 
Having a unified type system (is that what it's called?) like Java would help with this, but it'd ruin the amazing type inference and stuff
Actually wait no
Can you have existential types or implicit conversions in Haskell with language extensions? If so, it could be doable with a list of arguments instead of varargs
 
9:39 PM
there's an existential types extension yeah
 
Actually, existential types aren't enough because you also need to pass in an instance of the typeclass or whatever
 
been a while since i messed with it but it should work for this
 
The real challenge is having the format string be verified at compile time without macros. TS is the only language I know that can do it
 
Which is sad because if you could match on strings in Scala 3 it'd be seriously OP
 
9:41 PM
i'm pretty sure you just couldn't
you could probably implement something that works like printf that's correct at the type level but it would definitely be a different syntax than format strings
 
Can you derive an instance for a tuple H *: T if you have an instance for T?
 
like in general? probably not
 
Aww
I guess you'd have to hack up your own tuple type then
 
i may not quite know what you're asking about
also "hacking up" your own tuple type is sort of what product types are lol
 
Like data MyTuple = EmptyTuple | Head *: Tail?
 
9:46 PM
wouldn't that be a list
 
Yeah
But a heterogenous one
 
Wait data MyTuple = EmptyTuple | h *: t right?
 
i guess it wasn't clear since there's no type parameters lol
 
Or is it data MyTuple = EmptyTuple | (*:) h MyTuple?
I mean like this (can't express myself in Haskell)
 
9:48 PM
i'm not sure the way you're thinking of doing it would work
but you could just use the built-in 2-tuples and () for the end
or a custom type and () or a custom equivalent for the end
 
How are the colors showing up for avifs.xyz/tabl? It's a pretty blue for me, but it looked totally black on my grandma's computer.
 
Blue
 
blue
 
Awesome, thanks! I don't know what was up with that then.
 
@user this might illustrate something you could build from
 
9:56 PM
It's ready for playing around with again. I've added stuff since last time, and it should be much faster.
@DLosc tabl should be working right now! I know you tried it several weeks ago when it wasn't quite there.
 
@UnrelatedString I'm thinking about something like this, looks similar to the Haskell one you linked
 
Reminder that tabl's running (Dyalog) APL by default.
 
Only difference is that Scala's native tuples support destructuring, I guess
 
so do haskell's
 
Oh cool, how do you do that?
 

« first day (4064 days earlier)      last day (795 days later) »