Jonathan Allan

 The Nineteenth Byte

The Nineteenth Byte: General discussion for codegolf.stackexc...
Apr 24, 2024 23:29
Let's keep it going ...you can even cast a tuple to stdout (print) (1, 2, 3)
Apr 24, 2024 23:07
I think I'm too used to using dynamically typed languages to even consider "casting" as specific to static langs :D:D (well I'll tell myself that for now...)
Apr 24, 2024 23:04
I had no idea it was a joke, now I understand Ginger :)
Apr 24, 2024 23:03
woosh
Apr 24, 2024 22:59
@lyxal I think because float is a class and that's how its constructer works, so you're calling its __init__
Apr 24, 2024 18:18
Apr 24, 2024 18:18
@lyxal It's not that the syntax is specifically for typecasting, it's just that parentheses may be used in redundant, matching pairs. Also spaces after the first character of a line may be included redundantly. This can be useful for formatting code across multiple lines. The only use actually suggested in PEP-8 is for tuples of one element (e.g. instead of x=7, one should write x=(7,)).
Apr 23, 2024 22:55
Hey, hole pickers and maths fans! Yeah, you :)
Is there anyone in here with a decent knowledge of set cover? I am not 100% sure what constitutes proof that a problem is isomorphic to a set cover problem, care to take a look at https://codegolf.stackexchange.com/a/272763/53748 ?
Oct 20, 2023 21:32
@NewPosts @Simd I suppose I could have posted: Jelly 2 bytes, ạ2. :p
Sep 14, 2022 18:58
@mathcat ^^
Sep 14, 2022 18:58
@graffe hehe, but then we ... err as Wezl' says
Sep 14, 2022 18:26
So frustrating when you take ages over a question then the first vote is down with no feedback :(
Sep 14, 2022 17:56
Not sandboxed, but I think it's clear (although Question Six itself is obviously fairly confusing). Any suggestions to make it clearer very much welcomed!
 
Oct 9, 2022 00:54
Makes sense
Oct 9, 2022 00:53
hmm
Oct 9, 2022 00:52
Ahha it must be comparing the newline characters in Windows but not Linux?
Oct 9, 2022 00:51
I think it must be the map somehow
Oct 9, 2022 00:50
This is the program in the post :)
Oct 9, 2022 00:49
Oct 9, 2022 00:48
Oct 9, 2022 00:44
consistency FTW
Oct 9, 2022 00:44
Ahha
Oct 9, 2022 00:43
I don't get it :p
Oct 9, 2022 00:43
in cmd running python test.py
Oct 9, 2022 00:43
literally adding an x to the end makes it work :/
Oct 9, 2022 00:42
@Steffan nope, that does not work, but typing \n at the end of the second line does (facepalm). EDIT or indeed an x :/
Oct 9, 2022 00:42
@Steffan Tried that but it produced no output for me, while the double use with no newline worked.
Oct 9, 2022 00:42
Windows seems to need CtrlZ <return> CtrlZ <return> - :/ :o
Oct 9, 2022 00:42
@loopywalt Oh yeah, I always wondered - how does that know when to stop taking input? Is it EOF?
Oct 9, 2022 00:42
@Neil thanks, I got there in the end :p (many edits)
 
Mar 2, 2022 20:07
929 max(m)!=min(m) -> max(m)>min(m) >.< TIO
Mar 2, 2022 20:04
934 outputting to STDERR (with exit) TIO
Mar 2, 2022 19:59
941 - TIO
Mar 2, 2022 19:51
Little better score TIO
Mar 2, 2022 19:47
Oh, might as well use m again not a :) TIO
Mar 2, 2022 19:46
This will work TIO
Mar 2, 2022 19:39
6 4 is still giving results though
Mar 2, 2022 19:38
Some of that complexity is to get the score down though :)
Mar 2, 2022 19:37
But after that, I keep columns that: (a) have more than one occurrence of their maximum; (b) have their maximum at the start; and (c) are not just a list of equal values. (Then I deduplicate each).
Mar 2, 2022 19:34
This TIO gets the same thing as my code x⁹Sḃ³Ṛḷ/)ƬR1¦
Mar 2, 2022 19:28
, costs 8, = costs 7, newline costs 1. So <>,<>=<>,<> costs 23 points while <>=<>\n<>=<> costs only 15 (where all the <> would then be added to the total for both).
Mar 2, 2022 19:28
It does not seem to work for m=6 and n=4, I believe it never exits the while. Is that because there are no non-singular cycles? Perhaps we should ask if cycles are guaranteed / we can do anything if none exist?
Mar 2, 2022 19:28
OK, there are two bugs. Here's a fix for the while loop TIO but you need to cater for "trajectories" that terminate on the same loop (e.g. when m=6 and n=4 there are no non-singular cycles - we have 1->4->4, 3->6->6, and 5->2->2 all ending in length one cycles).
Mar 2, 2022 19:28
I don't think you use your R function. You should get rid of whitespace and try to use names of IRdmv (these score only 1) for the five most common variables/functions, then AJSenw (which score 2) if you need more (don't forget you may be able to re-use a variable name in list comprehensions or after you're done with one too).
Mar 2, 2022 19:28
Also the , separated assignments cost more than newline-separated ones.
 

 Jelly Hypertraining

Practice your Jelly :) Rules and stuff are here: golfingsucces...
Mar 24, 2021 22:41
Maybe someone else will take a look and see what's up. Thanks @ChartZBelatedly
Mar 24, 2021 22:30
but not confident in that enough to post
Mar 24, 2021 22:30
Maybe I've got it right and the rest is just so inefficient it's taking 1000 times as long as JS etc...
Mar 24, 2021 22:29
yeah it's hard :p
Mar 24, 2021 22:28
...I /think/ !