#dev-general
1 messages ยท Page 423 of 1
https://paste.helpch.at/xejoyecuxi.java 1 vs 2, thoughts?
So I have these
RED((color -> Integer.toString(color.getRed()))),
GREEN((color -> Integer.toString(color.getGreen()))),
BLUE((color -> Integer.toString(color.getBlue()))),
HEX((color -> String.format("%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue()))),
UNKNOWN((color -> ""));
private final Function<Color, String> function;```
Is possible to have a `Function<Color, Integer>` for the first 3 and somehow call `Integer#toString` with the result of `function#apply()`?
what
This is cool Kotlin, but it's kinda ugly lol
cursed
what the
Ikr
why
Someone in the comments said this path { "Dir" / "SubDir" / "file.txt" } which is slightly better, but who thought that was a good idea lol
clash?
sure
also apologies Gaby i took attention away from your question
color::getRed?
oh yeah they just added that right matt?
java.util.function.Function#identity
java.util.function.Function#andThen
java.util.function.Function#compose
java.util.function.Function#apply```
๐
ColorType(Function<Color, Integer> function) {
this.function = (color) -> Integer.toString(function.apply(color));
}```
This works but it says that both functions have the same erasure
d; Functions#compose
default <V> Function<V,โR> compose(Functionย before)
throws NullPointerException```
Returns a composed function that first applies the before function to its input, and then applies this function to the result. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
a composed function that first applies the before function and then applies this function
NullPointerException - if before is null
before - the function to apply before this function is applied
send full code
RED((color -> Integer.toString(color.getRed()))),
GREEN((color -> Integer.toString(color.getGreen()))),
BLUE((color -> Integer.toString(color.getBlue()))),
HEX((color -> String.format("%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue()))),
UNKNOWN((color -> ""));
private final Function<Color, String> function;
ColorType(Function<Color, String> function) {
this.function = function;
}
ColorType(Function<Color, Integer> function) {
this.function = (color) -> Integer.toString(function.apply(color));
}```
Was trying to replace the first three with `Color::getX`
;(
welp
the heck is this
Ah yeah I don't think that's possible cuz of type erasure
Stupid java
F
@distant sun
ColorType(final Function<Color, String> function) {
this.function = function;
}
ColorType(final ToIntFunction<Color> function) {
this.function = color -> String.valueOf(function.applyAsInt(color));
}
Ridiculous
too bad primitive-specific functional interfaces don't have andThen/compose :(
this.function = function.andThen(String::valueOf) ๐
non
yeah I did think of that lol
who designed this shit and genuinely thought it was good
lmfao
Gosling
I hate him
I don't like Haskell at all, especially after reading that
referencing that
oh right
lol
can you send it here
Dont think you should reference your opinion on code from clash
Mobile bad
import System.IO
import Control.Monad
import Data.List
main :: IO ()
main = do
hSetBuffering stdout NoBuffering -- DO NOT REMOVE
-- Auto-generated code below aims at helping you parse
-- the standard input according to the problem statement.
input_line <- getLine
let l = read input_line :: Int
input_line <- getLine
let m = read input_line :: Int
input_line <- getLine
let n = read input_line :: Int
putStrLn $ intercalate " " $ map show $ solna (l - m) m n
putStrLn $ intercalate " " $ map show $ solnb (l * m) m n
return ()
solna :: Int -> Int -> Int -> [Int]
solna n d i
| i <= 0 = []
| otherwise = (n + d) : solna (n + d) d (i - 1)
solnb :: Int -> Int -> Int -> [Int]
solnb n d i
| i <= 0 = []
| otherwise = (n `div` d) : solnb (n `div` d) d (i - 1)
oh I'm not judging your code I'm judging the entire language
๐คค
Even in case of the language I mean
Finding a fast solution is ussually not the cleanest possible
that is not what I would call "clean Haskell code" lol
mhm
yeah fair enough
This just "works"
lol
I sat there for a solid 3 minutes just trying to figure it out before realising
trying his best
The game is over tho
@obtuse gale that doesn't work
not sure why it still shows him as clashing
what about it doesn't work
pc hasn't loaded onto the next page yet probably ๐ฅฒ
lmao
coc??
works if I remove the Function<> but then it only accept int as result
I assume it doesn't know which constructor to call since both have one Color param
weren't you wanting to use Color::getRed etc?
I cant build lol
why not
both constructor ColorType(Function<Color,String>) in ColorType and constructor ColorType(ToIntFunction<Color>) in ColorType match
.
Just do Red(Color::getRed) no?
no ambiguity there
Cast the last two to (Function<Color,String>) idk
Wait how do both match
Isnt that afterwards
lmao
both are basically a lambda with Color, only the result is different
Wait
ik your issue
Neither of your constructors take in a String
๐
oh wait
no
im dumb
๐ฅฒ
ignore that
I know.
xD
๐
why have many type when one type do trick
ah yes the dynamic type
the type where the compiler just blindly trusts that you're doing everything right
xD
class Any where
how to have "java.lang.Object" in haskell
Why use polymorphism when you could write a 10000 line case expression
๐
why live when you will die eventually
update the deluxe tags for a rgb support?
Good point
Please delete yourself
fair
I was going to complain about the files but then noticed they too, are all E
this opened up this
Oh shit I'm haskell.org??? ๐ณ ๐ณ
you got me
Is it true???!!
yes
Scroll down at the right speed on mobile and if goes zig zag.
Brister Peyton Jones
I have been sent to spread the word of haskell
You have been a brave warrior
Thank you sir!!
๐
Ivory Tower?
YES!
?
An ivory tower is a metaphorical placeโor an atmosphereโwhere people are happily cut off from the rest of the world in favor of their own pursuits, usually mental and esoteric ones. From the 19th century, it has been used to designate an environment of intellectual pursuit disconnected from the practical concerns of everyday life. Most contemp...
it is where haskell users go when they die
To theorise about functional CPU architectures in peace
๐
Java users too.
No
Away from the imperative prosecution
Java users go straight down
Absolutely not
down to hell
If I carry on doing java I might see vk2gpz then
I can't type on mobile
These devices are so small.
@old wyvern Did you do any work on the Kotlin DSL stuff?
Imma do a bit of that in a bit if you haven't ;p
oh not yet
yea sure
Bm, when you need payment btw
Ill pull from upstream and add stuff later on
Nice color theme matt
I was thinking of a more dsl-ish way
all are optional, but those are specially optional
Is that kotlin?
That's just the default one, haven't done anything for kotlin yet
ah
Yeah, and ikr love the colors ;p
now
uhh i enabled it but it still is disabled
idk why it automatically disabled :c
val menu = gui {
row { item + space(3) + item2 + space(3) + item3 }
row { item + space(3) + item2 + space(3) + item3 }
}
why ask then lol
So I know in the future?
Hmm I like that yeah ;o
tomorrow then
Alrighty
I was expecting you to say after each sold copy or something
only on den rn
gei
cube hasnt added it yet
shame
start ivan
alright
that very much did not turn into an embed
o
this seems really familiar to a previous challenge
where you had to tell if a number was perfect or not
Peasants without dev role
u guys playing COC without me? ๐ข
I always ping you guys
you don't even bother saying my name
No, according to pulse i'm toxic, so I have to behave like it!
๐
๐
yugi it was shortest
xd
f
Two numbers are amicable if the sum of divisors of one number are equal to the other number.
Therefore numbers 220 and 284 are amicable numbers
test 4 is not amicable tho
I KNOW
factors :: Integer -> [Integer]
factors n = [i | i <- [1..(n-1)], n `mod` i == 0]
Gotta love haskell
๐ซ
String nextLogEvent;
while ((nextLogEvent = QueueLogAppender.getNextLogEvent("ServerGuiConsole")) != null) {
print(textArea, scrollPane, nextLogEvent);
}
```anyone know how you're meant to do stuff like this in Kotlin? since Kotlin doesn't allow assignments in conditions since they're not expressions
wtf is going on with test 4 tho?
therefore
kotlin bad
you don't know me I don't know you
import java.util.*
fun main(){
val i=Scanner(System.`in`);
print(if (d(i.nextInt()) == d(i.nextInt())) "Amicable" else "Not amicable")
}
fun d(n: Int): Int = (1..n).filter{ n % it == 0 }.sum()```
why not just ```kt
var nextLogEvent: String? = QueueLogAppender.getNextLogEvent("ServerGuiConsole")
while (nextLogEvent != null) {
print(textArea, scrollPane, nextLogEvent);
nextLogEvent = QueueLogAppender.getNextLogEvent("ServerGuiConsole")
}
Does that work gab?
It shouldnt
it does
no
huh
oh you said inclusive
ya
yes, it is
So your d function would include n itself as a factor right?
theres a filter
yes
.filter{ n % it == 0 }.sum()
n itself always passes the filter dkim
wdym
Whats n % n
๐คทโโ๏ธ
1
...
I know yugi
okay im dumb
but idm xd
xD
tfydgkjsad
0
nope
what
0 isnt correct either
its 0
lol
look at that pristine quality javascript
how do I pass getline into words in one line
using the bind operator
gftuywjhbadskdiuwashdjnsad
getLine >>= return . words
Might have to add brackets there tbh
The test cases on that one ran extremely fast compared to everything else
rip
also no idea why it's taking so long ๐ข
ahh
beautiful
ez peasy
or words <$> getLine
who's esophose
me
share code ;o
I'm amazed at how fast you did that
it's reverse, the inputs are something like
ab12ye -> ba21ey
alabama -> labamaa
flip every other character with each other
can somebody explain to me how Ivan's solution actually works
because I can't read haskell to save my life
what's the code
import System.IO
import Control.Monad
main :: IO ()
main = do
hSetBuffering stdout NoBuffering -- DO NOT REMOVE
-- Auto-generated code below aims at helping you parse
-- the standard input according to the problem statement.
t <- getLine
-- hPutStrLn stderr "Debug messages..."
-- Write answer to stdout
putStrLn $ inv $ t
return ()
inv [] = []
inv (x:[]) = [x]
inv (x:y:xs) = y:x:inv xs```
it's a recursive function
that is beautiful
that takes a list of chars / string as a parameter
It looks really nice but I can't understand a single line of it
if the list has more than two characters, it flips the first two and returns a recursive call to the rest of the list
otherwise it returns the list
ah
that 2nd pattern is a bit weird, can't you just do (x)?
yeah xd
yes lol
I gottttttttta question
I overcomplicated this
probably but i just set my mind on doin it this way
whats the best anti-cheat that y'all know of?
let grouped = groupBy (\a b -> (isDigit a && isDigit b) || (isUpper a && isUpper b) || (isLower a && isLower b)) t
putStrLn $ intercalate "" $ map reverse grouped
what with it being time to complete and all
๐ฅฒ
yeah idk the answer so
oh no poor yugi
String#chunked#reverse ftw
actually wait i don't think you can just do (x)
since it's a list parameter, right?
I just learned you can cast a javascript string to an int by just doing ~~value
I hate this information
yikes
:whatthefuck:
that is also real clean
man the standard library has a function for everything
ikr
take that kotlin!
๐ข
kotlin bad
Whats wrong?
ah yep [x] did the trick
can the 2nd pattern for inv be simplified at all?
ahh yeah that'll be it
super clean
what is hSetBuffering stdout NoBuffering?
sets the buffering of stdout to NoBuffering
I imagine it removes buffering from stdout
probably makes it so it always flushes the contents of stdout immediately
yeah
Ah yeah probably
i imagine it's similar to socket streams needing to be flushed
You still need the no element pattern right?
yes
'h':'e':'l':'l':'o':[]
pulse is really taking his time getting a super efficient and awesome and shiny solution
or he left
how dare he
nah surely we will see the best code in about 35 seconds
lol
maybe he was also confused by the prompt
what did you think the prompt actually was Yugi?
oh btw bm, had windows update today, had a minor heart attack but everything went fine
That's good
Group into upper, lower and digits, and reverse each
o
Like I said 99 times out of 100 it works perfectly
probably a good idea
pulse had the best code
just in case
the code was so good the game couldn't register it
damn
Would I lose any files from windows?
new one?
like while fixing I mean
Don't think so, but I guess it would depend on what you were fixing
ah
Seems unlikely
windows updates don't generally mess with partition tables, right?
so it should be fine
maybe
So is the linux live image better than a windows recovery drive?
I can't see why they would
probably
Could I keep both in a usb?
linux live image can do anything
here do you want an embed
oh wait I think no
Not on the same usb
yea
oho nice
without some fancy tool
I have fast boot still on
fast boot is fine I think
linux cant mount windows files with it I think
yugi are you gonna join the coc
atleast not in write mode
one sec
oki
you got 2 1/2 minutes
joined
i'm starting
aight
wow apparently list comprehension is also syntax sugar for monad stuff
xD
lmao
i done goof
rip
wtf was this
square?
75% lmfao
oh seriously? there were some special cases
I did n*n and I got 75%
putStrLn $ show $ n*n
you know, probably had to use a long
Overflow?
oh BigInt @tranquil crane
and not an int
"number of odd integers" is a comment
Yea
so something to do with odds
haskell's Integer wont overflow
Perfect ๐
๐
which?
๐ฅฒ
look at the default comments in the code
that's not even the right hint
;o
lol
well anyways
well that one sucked
bye yugi
we go again
yis
learn to make embeds properly :(
it's probably just gonna be us 3
alright
_ _||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||https://www.codingame.com/clashofcode/clash/16982147c6ed1345fc766d487f2861ed307b093
need the embed ๐
hehe
why tf isn't this solution working
oof
???
๐
huh
alright
gtg. going to play some Assassin's creed and get some sleep. Tired AF
I did < instead of <= otherwise I would have submitted that in 20 seconds
says that one is cancelled
try this one
there we go
bye ;o
dkim are you playing
@half harness
cya
ok
guess it's just us two then ๐ข
it's a 1 v 1 then ๐คทโโ๏ธ
join fast
oh
dewit
shortest kek
Fuck you too ๐
they already told me that. I just replied
Ah
not quite
lol
yeah got it
this is ez
57 is the best I can do
Kotlin
i have 44
yeah can't get it any more smaller ๐ข
howww
wows
lol
is python allowed
all languages are so maybe
its enabled so yeah
look at that god awful string cast to int in the javascript one
how tf did u get 44
yeah I got no idea how to make this shorter
i have 200
lmao
down to 42
kek
yeah my kotlin is not that good I guess
javascript doesn't have a power operator that I know of
could have saved a couple chars
pretty sure I could do something to make this shorter
LMAO I GOT 33
but can't figure out what
ima see if i can shorten it
yeah same for kotlin
okay i have 32
omg the ~~ casty
oh wait apparently ** is the power operator in javascript wth
The ~~ cast is disgusting
also I have to use main
pog 30
well yeah but its short
haha
what language are you using dkim
what language are you using that you can get down to 30 wtf
lol
ok
lmao
share plz
ah
Blitz what is your pfp btw
hmm
Handsome Pepe Squidward
Ivan, your pfp looks like it has lip filler.
lol
I used to be just Pepe Squidward
btw i have no idea how to code in ruby
that could have been simplified
i'll take that as a compliment
by just removing the first set of paranthesis
i just needed a lang that used +, *, and ()

Throwing premium plugins out be like 
why no cool embeds from you?
my fav is shortest
p.s. Please buy mg new plugin so bm gets paid :)
no idea
the only 2 times ive won is from shortest
need developer role
i think
lmao
is that everyone
oh really? I didn't know that. Perks of being support I guess
Shortest is the best, but these noobs don't like it
well I'm going to go get some food I did this terribly wrong lmfao
be back in a few minutes
oh wow
share codeeee ๐
ok
i cri
๐ฅฒ
I didn't even read the prompt correctly
I almost submited it wrongly as well
I just ran the first test case, passed, submitted
I was repeating N times instead of i times
but realised right as I was about to click submit
bcz I didn't even test
that's what pros do
๐ข
typescript takes like 10 seconds just to run one test case
going just stick to javascript idc about strict typing anymore
javascript test cases run instantly
that was painful
same link btw
there
why do neither of you have the developer role
who is 'neither of you'
bcz I don't have 2 active projects smh
is it me ๐ค
working on deluxemenus instead of working on my own shit
dkim and ivan mostly
i don't have any good public repos
oh
oh ok nvm
fair enough I guess
I'm not that important
im too scared to apply
Ivan we have a different lobby
ah
YES
is this black and yellow for anyone else
yes
yes
weird
how do I keep getting 39
go to bed blitz
Touchรฉ
i'm uh.. at 25
At this point I'm just asking to get banned lmao
not haskell though
what
I mean cube already opened applications in anticipation of me getting banned
no thank you just fuck you
21
lmao
well not yet 20
but almost
xD
Even COC is telling me to https://i.imgur.com/62HnRP5.png
๐ฅฒ
๐ฅฒ
and of course also to ... https://i.imgur.com/InhrFKK.png
oh wait glare has a repository
he could put EpicHeads api on there
the what
18?!?!?!?!
yes 18
Ruby ๐ข
sneaky
from what I could tell ruby has the fastest way to both read and write a string
i think bash is faster
hmm how does jitpack work?
I looked into bash but couldn't get it to run lol
bash is super weird with syntax though
puts gets.to_i(16)
oh wait what? https://i.imgur.com/Agfhx8p.png
but the read is 4 characters + 1 space + the variable, and write is the same
wait how have I never searched this before
You just
git: 'gud' is not a git command. See 'git --help'.
haha funny

so apparently I can just make a repository out of any github project with jitpack for free
lol we have the same thing @tranquil crane
no new link?
very nice dkim
xD
it's almost like I posted my solution in here
bam
yes lmfao
where
just scroll up a bit
dkim trying to play it off like he didnt copy and paste ๐ฅฒ
Classic ๐
well that was silly
I don't really process information fast enough to realize the shorthand for that
but foldl takes a lot of brainpower and i'm weak
fuck yeah https://i.imgur.com/WMJfZ5b.png
bonjour
wait a minute
bojour
bosoir
Lmao
pryvet
0%?!
wrong language yugi ๐ฅฒ
blitz
!skip
look
ah yes
lmao
embarrassing
unnecessary main params :kekw:
give us a recursive question, oh mighty coc gods

wlc
start
thank you
@tranquil crane show code
took me longer to read the prompt
๐ฎ ivan
sigh
lol
๐
dkim you can kindly fuck right off
imagine having capital variable names smh
you playing coc?
if i kept it default i probably would have finished a lot faster
he dares question me but he doesn't know how to use += You fool
how dare you question the all mighty
how is this too much for haskell but you were easily able to flip every other character in a string
lmao
nevermind
no thank you just fuck you
its just sum / amount ivan. sounds pretty easy. is haskell that bad?
the input is
yes, they are
i don't know enough about monads to do that at any reasonable speed
wanna do code golf?
what is code golf again?
^
nothing
...

uh
they both mean the least number of characters
then sure
1698277291d2c66eb6f394d221ae90295d9f1b5
yes, that, thank you
shortest
when do I start?
now
late
ear rape, ouch
this is an actual proper shortest prompt
this is stdin, right?
stdin or argv?
Isnt too much
Just a bit diff
Haskell has a separate Fractional type
lmao
To my knowledge javascript doesn't have a way to log to console without a newline
just replace the newline 4head ๐ฅฒ
Tesla
I'm at 39
wow
The template says to use console.log
you need to output
22
1
Try process.stdout.write("")
oh sorry yeah
well 103 is good enough
22
2
I know of that but it's just so looonngg
make sure you don't have a trailing whitespace or something
trailing newlines are fine afaik
you can actually use print in js on the site
so there you go, saved you 6 chars
Lol
it's marked as deprecated lmao
I think stderr is fine
didn't know that though, thanks
don't worry about editor warnings
I'm at 35
103 ๐
no. 301
@arctic juniper print actually still puts a newline
your vision is just blury
then what's the problem?
but it keeps adding a newline to the console.log
the test cases don't allow newlines at the end
for some wild reason
since when
