« first day (4022 days earlier)      last day (807 days later) » 

12:13 PM
CMS: Given a number and a list of numbers, add that number to each element of that list, then find the product of the resulting list. The numbers be Doubles or Ints, whatever you want. The catch is that you have to use underscores instead of explicit parameters
 
(how do you do that again?)
 
You basically write it in a form where each parameter is only used once and isn't used within parentheses (well, you can use it in parentheses, but only if it's (_), not in another expression like (_+2))
 
but I mean the defining part
(_, _) => whatever?
or _,_ => whatever?
 
@user Template to get you started
 
or val f : List[Int], Int => Int = whatver?
ah nvm
 
12:17 PM
@lyxal Oh no no there isn't any (x, y) => part, just the whatever part
@lyxal Yes (but with parentheses around List[Int], Int)
Hint 1: You can call foo.bar(baz) as foo bar baz
Hint 2: You can refer to a method as a sort of field (foo.bar is a first-class value even if you're not calling it on a bar)
Hint 3 (hover to see)
@user To make it easier, actually, you can forget the product part at the end and just add the number to every element of the list and return a new List[Int]
 
those hints aren't actually that helpful
 
:(
 
and the scala book doesn't actually detail _ in the anonymous function section
so I have no clue how _ works
 
Basically, whenever you see code like ... _ ... _ ... _, you turn that into (x, y, z) => ... x ... y ... z (e.g. _ + _ turns into (a, b) => a + b)
If the underscore is inside parentheses but it's the only thing inside those parentheses, then it's still held as part of that "outer" function (e.g. _.bar(_) becomes (a, b) => a.bar(b), not a => a.bar(b => b))
_.bar(_,_) also becomes (a, b, c) => a.bar(b, c) because those last two underscores are not in the outermost part of the expression, but there's nothing accompanying them inside those parentheses
 
12:34 PM
why isn't scastie.scala-lang.org/8dtlGjApRjesL0V8JeGTSg adding 3 to each number?
It just says "Wrong number of parameters, expected: 2"
 
╰(°▽°)╯
 
However, if there is something else inside those parentheses, those parens basically turn into a new function (e.g. _.bar(_+2) becomes a => a.bar(b => b + 2), not (a, b) => a.bar(b))
@lyxal See ^
Because the _ + 3 is inside parentheses, it's held as a new function. That's more useful most of the time
@lyxal Try looking at those hints again :)
 
Nope, my tired brain still ain't getting any of that
 
Aight, I'll nudge you along. Can you try writing the expression in the form _ map <something>? (where <something> doesn't contain any parentheses)
 
scala wtf
why tf do you let _.+ be a valid thing?
 
12:39 PM
:)
 
why must you do me like this scala
 
It's basically just (a, b) => a map b.+
 
that's just as bad
 
And since + is simply a method on Ints, you can refer to it like a field
 
I don't know if I like that
 
12:40 PM
@lyxal What's so bad about it?
 
it's just ... something about it seems off
+ as a field is fricking with me
 
I mean, no one uses b.+ in real code, but you do use stuff like b.baz as a function
@lyxal Oh it's just the fact that operators are simple methods?
 
wait where's the map argument coming from?
like I can see the b but I can't see the thing being mapped over
 
@lyxal You want some real fricking? Try this
 
is there some implicit context variable frickery happening here?
 
12:42 PM
Nah nah
b.+ is the same as c => b + c
So that expands to (a, b) => a.map(c => b + c)
 
as I said, some implicit context variable frickery
@user no. no don't do that to me no. Please tell me this won't be a thing in v3 of vyxal
 
>:)
+.+ will forever haunt your dreams now
 
I'm just going to pretend I never saw that
just gonna close that tab
 
I'm sitting here in my LOLCODE tower watching you peasants learn a language that is usable and makes sense
 
@lyxal burn my cache/cookies and maybe my browsing history
and then I'm going to turn off my hotspot, go to bed, and not think of whatever the f*ck that is
because I do not like that not one little bit
and whenever I write any scala, I will not commit crimes like that
my scala will be readable and not like that
 
12:47 PM
Don't worry, no one does that
 
they better not
because otherwise they'll be experiencing radiation poisoning from the nuke I drop on their computer
 
@lyxal well since I've already been nuked, I can commit scala crimes as much as I want
 
writing things like that should be a criminal felony and carry a sentence of life imprisonment
throw the key to the prison cell into the nearest volcano and let them sit in shame, eternally reflecting on how much of a horrible person they are for writing +.+ in Scala
 
Would you like some more frickery? :P
@lyxal +.+ is valid APL too
 
@user yeah but that's like dot product or something
it makes sense
tacit makes sense
@user I'm fine with that
 
12:50 PM
@lyxal That's +.× which looks even more cursed
 
@user it still makes sense
because APL is designed to make sense
+.+ in Scala doesn't make sense
it's cursed
 
Aight imma hunt down some cursed Scala
 
@user APL gives me a headache but in a good kind of a way. That sh*t you produced just makes me cry and not happy.
 
lol I think the same about my parents
 
they write cursed Scala?
 
12:54 PM
No, the sh*t they produced makes me cry and not happy
 
well are you cursed Scala?
 
I write cursed Scala >:)
 
Then I can see why
and quite frankly I'm inclined to agree if that's the case
I'd be upset if I wrote cursed scala
 
1:09 PM
@user I think that's a problem wth your bathroom's ventilation system then
 
1:39 PM
@user also, that's a big yikes.
You good bro?
 
APL's monadic operators go after the primitive/function but ∘. goes before o_O
 
@cairdcoinheringaahing O.O
I mean, the post you linked is not that bad, but death threats?
wait a second Scala LYAL?
 
@PyGamer0 That's because . is a dyadic operator, in this case taking as a "nil" left operand.
 
so outer product is inner product?
 
@PyGamer0 Schrödinger's product
 
1:52 PM
i do like BQN's
@GingerIndustries õ
 
@PyGamer0 ik, just trying to find it
 
oh
 
@PyGamer0 Inner product is a reduction on each element of an outer product. Outer product was seen as doing a nil-reduction.
 
@Adám what?
 
1:57 PM
ugh, YouTube has this annoying bug whereby if the next video in a playlist is unavailable it just plays its default suggestion, exiting the playlist
 
@lyxal Oh yeah, I get to stay home from school today because my stomach's upset
 
@PyGamer0 x f.g y ←→ f/¨ (⊂[⍴⍴x]x)∘.g ⊂[1]y so ∘.f is kind of like omitting the reductions, meaning the expression has no f, and so the f.g notation was used with f replaced by a "nil";
 
oh makes sense
 
okay so the temperature applet in my taskbar just went from "-2F Wind chill" TO "35F Sunny"
 
2:20 PM
do you think that its possible to make an esolang which makes the programmer make ascii art as the programs source code, and isnt just a bunch of abstract shapes
id ask in the tarpit but famously that chat seems to be un-unfreezable
not that it really matters im just bored :P
 
Well, I'm thinking it's about time to replace my chromebook.
Its battery life is less than half of what it used to be, and it's not in the best condition due to being hit with large objects at relatively high speeds a relatively large number of times
 
this is the only light color scheme i like
 
@taRadvylfsriksushilani you hit it at relativistic speeds?
 
@taRadvylfsriksushilani may I ask what these "large objects" were?
 
@mathcat meteors
 
2:31 PM
@mathcat Basketballs, humans, and a few pieces of not-moving furniture
 
lol
 
It's got like 4000 hours of uptime, been charged and discharged twice a day for the last two years, been taken back and forth to school and back in my backpack through heavy rain, etc.
 
The only thing my laptop was hit with, is my head.
 
@mathcat does that mean your head is a meteor
2
 
This $200 chromebook has laughed at things that literally bricked my other laptop
 
2:33 PM
what are you planning to replace it with?
 
Something nice, but still an acer chromebook
 
A Gaming Console
 
@thejonymyster i suppose a 5000$ chromebook :P
 
I was thinking a Spin 713, but I've read some things about it that I don't really like
 
touch screen?
i absolutely hate touchscreen laptops and will destroy any if i get my hands on one
 
2:36 PM
my laptop has a touchscreen and it sucks, and i cant find a way to turn it off
 
I'm a big fan of touch screen
What's wrong with it?
 
smh its better to get a tablet then
 
Depends on the laptop
 
well mine is mainly cause it wont turn off
 
Why would you need it to turn off?
 
2:37 PM
i like using a physical keyboard and a mouse
 
My current laptop doesn't bend backward much and it's not as small as a Chromebook, so touching the screen actually requires some effort
 
@PyGamer0 Yeah and?
So do I
Why is that mututally exclusive with a touchscreen?!
 
On the other hand, my school Chromebook has a touchscreen and folds all the way, so I can treat it like a tablet and it's great
 
@taRadvylfsriksushilani sometimes i touch my screen by accident
 
@taRadvylfsriksushilani because it becomes similar to android
 
2:38 PM
wut
 
@PyGamer0 A touchscreen laptop should behave identically to a normal one if you have a keyboard and touchpad/mouse
 
@thejonymyster sometimes I hit my screen on purpose
 
I think touchscreens are nice but they're not super useful for big laptops that don't have some sort of "tablet mode" where they fold back
 
luckily it doesn't have a touchscreen
 
@taRadvylfsriksushilani but some laptops turn 360°
 
2:39 PM
@mathcat Oh so you are a meteor
@PyGamer0 Those are the only laptops on which touchscreens are good
 
@PyGamer0 Then...don't...turn...it...360° :p
 
It's an added feature ^
 
Mine does that and I've never done it once
 
Why not?!
 
(Except when it's hit with large heavy objects, the screen being able to fold around kept it from snapping off)
 
2:40 PM
i just wish every feature was a choice
 
Including death
 
@user Okay, you'd find out anyway, but here it is: I am a meteor.
 
You can customize your laptop, you know
 
@taRadvylfsriksushilani i would rather destroy such a laptop, i might accidentally trigger the touchscreen
 
@taRadvylfsriksushilani Death is a feature?
 
2:40 PM
@user Yeah, decomposition and stuff
 
Uhh
I would like to turn this feature off, along with the "pain" feature
 
@user in settings? or like "make a pc mod"
 
No I mean when buying it
 
oh, i didn't buy it, it was a gift
 
idk about other companies, but the HP I'm on now had a bunch of options when buying
@thejonymyster Well if it's a gift it's hit or miss
 
2:42 PM
so im not really mad, its just a peeve
yeah thats just how it is sometimes i guess
 
@user (I actually explicitly selected the no touchscreen option but they still gave me a touchscreen lol)
 
@thejonymyster can i say "peeve" without the leading "pet"? or does it no longer make any sense
 
It peeves me
 
Can't decide between a Pixelbook or a Spin 713
 
Buy both, try them both out, then return one
 
2:45 PM
Or do it the casual piracy way and steal both then buy another if you like one
 
Pirating copyrighted software is one thing; stealing physical items is another
 
yeah really :p
But you don't think the company still loses some money if you buy both then return one?
 
See it's simple maths:
 
They do lose some money, but not much
 
Company has 100 dollars
You buy two laptops for 25 dollars each
 
2:47 PM
If I steal two, they lose the full amount for both laptops. If I return a laptop, they'll just have to spend a little to get it looking new or sell it a lower price
 
Then return one.
So company gets +100
 
@mathcat Just two? For that price, I'd buy a hundred
 
@mathcat I am good at maths
 
You are good at math, not maths. That's why you're mathcat
 
@mathcat how to reply to yourself?
 
2:49 PM
TBH I'm a maths guy
 
@user Don't take your meds for a day
2
 
@mathcat and mathscat doesn't look good
 
@user ?
 
Never mind, bad joke
 
hover over message and search for the -> symbol in the left corner
 
2:51 PM
dont see it
@cairdcoinheringaahing How many days until nomination ends?
 
You need to add a userscript for it, just a second
 
one sec
 
Try installing this usercript by dzaima
 
Tomorrow I believe
 
@user not working
 
2:55 PM
Really? Try reloading the tab
 
@user now it asks me to reinstall
 
No, reload this tab
 
Okay, Best Buy has the Spin 713 for $200 off...thinking I'm gonna be buying a new laptop this afternoon
 
I'll look like this after installing the userscript
 
Then you should be able to reply to yourself just like you reply to others
 
2:56 PM
@BgilMidol woo
 
You do need to hover there to be able to see it
 
@BgilMidol its working
 
pog
 
Loool...the chromebook comes with a free subscription to a windows antivirus
 
:thonk:
 
2:58 PM
I think I have another userscript
 
@mathcat for what?
 
@mathcat um i dont like the new ui
 
ok your choice
 
whats an onebox?
 
3:03 PM
When things like questions, wikipedia pages, chat rooms, etc. render like this:
16
Q: Prime a*b+c of N

drmosleyGiven an integer \$N\$, print or return integers \$a\$, \$b\$, and \$c\$ that satisfy all of the following conditions, if such integers exist: \$a \times b + c = N\$ \$a\$, \$b\$, and \$c\$ are all prime \$a > b > c\$ If no valid combination of integers exist, you should return nothing, 0, None...

 
3:14 PM
I can't think of any good CMC's, so here's a basic one anyway: CMS: Reduce a matrix along its columns by a function. You can assume the function is associative. Type signature would be something like List[List[Int]] => ((Int, Int) => Int) => List[Int] or ((Int, Int) => Int, List[List[Int]]) => List[Int]
 
does the "s" stand for "Scala" here? edit: just asking cause i couldn't find it here
 
Yeah
 
Chat Mini queStion
 
i've seen the other lang specific ones, but i guess "CMS" just threw me off
 
Ooh, here's another CMS: At compile time, figure out if a tuple type is homogenous
+100 rep to anyone who gets that ^
 
3:20 PM
@user hmmmm
 
Template Scastie, feel free to make your own
@GingerIndustries Would you like to try for it?
 
@user I've never used Scala in my life so sadly not
 
Oh, and please don't look this up on Stack Overflow
@GingerIndustries That's fine, I can guide you to it in the Scala room (and maybe give you a 50 rep bounty)
 
CMC: Given two lists, pad the shorter one with zeros
 
And return both of them zipped together?
Or just return the shorter one, padded?
 
3:29 PM
@user yes
 
Same length but weirder (only underscores): Seq(_,_)sortBy(_.size)reduce(_.zipAll(_,0,0)map(_._1))
@user Hint (a tuple (A, B, C) is basically the same as A *: B *: C *: EmptyTuple)
 
@user Hey
 
Hey
 
CMS: Implement Bogosort
@user Can you do that?
 
@BgilMidol What if they have same length?
 
3:42 PM
@Adám then just return the list or second list
 
0
A: Sandbox for Proposed Challenges

thejonymysterOutput N for N inputs Write a program or function that takes input and outputs a positive integer N, such that there are N possible inputs for which your program will output N. Shortest code in bytes wins. open-ended-function code-golf

 
@Fmbalbuena There's an implementation here if you're interested
It's not idiomatic Scala at all but ¯\_(ツ)_/¯
 
@user No cheating
 
You didn't define "cheating"
 
@mathcat yes
 
3:51 PM
??? How's this "cheating"?
 
It's not
 
I assumed you wanted to see Bogosort samples, that site has multiple
 
@BgilMidol APL, 15: {b⊃⍨⊃⍸⍵≢¨b←↓↑⍵} Try it online!
 
@user You must make golfy.
 
@SandboxPosts this got a downvote, what can I improve?
 
3:56 PM
@thejonymyster This is a dupe of Implement ed clone
 
I think it could be quite interesting if I'm reading that right, but it needs to be better specified
A trivial example function would be nice. Are we allowed to bound the input to some range?
 
> such that there are N possible inputs
do you mean exactly N?
 
@Fmbalbuena ???
 
16
Q: Prime a*b+c of N

drmosleyGiven an integer \$N\$, print or return integers \$a\$, \$b\$, and \$c\$ that satisfy all of the following conditions, if such integers exist: \$a \times b + c = N\$ \$a\$, \$b\$, and \$c\$ are all prime \$a > b > c\$ If no valid combination of integers exist, you should return nothing, 0, None...

 
Also yeah you need to define the domains over which functions should operate
e.g. are functions allowed to assume input is always a positive integer, or whatever?
 
3:59 PM
I would recommend forcing the input to be an integer or float instead of allowing strings and arrays and stuff
Just so you can allow answerers to put bounds on the input
 
@pxeger I'm not sure how it could mean something else
 
@thejonymyster just clarifying
 
but bounding the input somewhat makes sense
 

« first day (4022 days earlier)      last day (807 days later) »