last day (14 days later) » 

4:19 AM
@isaacg I have the exact answer you posted in a file, but it only parses the first line: gist.github.com/orlp/471eb2cdb256b3f75460
In particular, this line leads me to believe pyth only ever looks at the first line without multi-line mode: github.com/isaacg1/pyth/blob/master/pyth.py#L390
 
OK, I think I know the problem. Try running -c '-
"Hello
,
Wor
l
d
!"b'
Pyth only looks at first line from file, but all lines from command line.
The latter is the intended behavior.
 
ah
could we make multi-line mode default behaviour though?
the current status quo is confusing
in fact, if anything I'd expect it to be the other way around - only one line from command line, all lines from file
 
I'd rather not, because multiline mode can't make strings with newlines in them.
 
We can change that
 
I'd rather change files to work the way command line does
Unless -m is given
 
4:24 AM
I don't think multiline strings and multiline mode with comments are mutually exclusive
we can simply not strip comments and indentation while inside a string token
it might just be that you don't like the idea of multiline mode - I have no clue what your thoughts on it are, as I only just proposed it :)
 
I like it, but from a development perspective, not a golfing perspective. That leaves me to believe that multiline mode should be the option, not the default. I might change my mind on this later, once I've used it more.
Also, there are other uses for the newline.
The newline is the non-print-suppressing version of the space.
 
ah
I never used it because I always worked from files
however I would not like the default behaviour from the command line without multiline mode, because I often use the rest of the file as a scratchpad to quickly compare solutions and store subsolutions
At the very least I'd need ; end to be implemented
@isaacg However, I think if we properly design and tweak the details of multiline mode I think we can make sure that it never negatively impacts a golfed solution
 
That's possible, but for now I'm going to use the ; end method, and allow newlines in files.
I could also add a flag for one-liner mode, if you'd prefer that?
 
I'd prefer if ; end always works
It's never used in optimal golfs anyway
@isaacg Isn't the one-liner mode always available as -l 0 anyway?
 
Fair enough, will implement.
 
4:36 AM
@isaacg by the way, what's the reason that -l specifies " Fails on Windows."?
I don't see why
 
It's the '\r\n' line endings.
I didn't care enough, since -l is rarely used anyways.
 
Unless you open files as binary
Python automatically translates \r\n -> \n
(in Python 3, in Python 2 you needed to use "rU")
 
Hm, then I don't know why it was failing.
Alright, multiline files and ; end are implemented.
I'm pushing it all to heroku.
 
Is using newlines the only thing stopping multiline mode from default?
actually no wait nvm
as soon as you make multiline mode default that becomes the behaviour of the language, so you can't call anything that it generates "input" anymore
(I was considering actively encoding newlines in multiline mode, but that would increase the length of the golf since the behaviour of the language changes)
Nope, I can't see a way to make multiline mode default without giving up the behaviour that newlines currently have
That didn't occur to me before, because I had never used newlines :)
@isaacg now that multiline behaviour is default for both command line and file maybe we should rename multiline mode to something better, like 'augmented mode', 'pretty mode', etc
 
Yeah, they come up quite rarely, except with layout challenges I suppose. However, since we want Pyth to well in layout challenges too, I think the default should stay the way it is. Multiline
How does "Formatting mode" sound?
 
4:49 AM
=/
not a fan
 
Or 'beautified mode'?
 
better, I think pretty mode is even better though
 
Yeah, I like it too.
 
-p --pretty it is then?
 
All right, pretty mode it is.
Shall I make the change?
 
4:50 AM
sure
do you like the changes I've made to Pyth overall btw?
it's been rather drastic in some ways :P
 
Yeah, I do. . is something I've had in mind since the beginning - 2 character functions, not this specific implementation necessarily. It's really nice having someone else who cares about Pyth.
 
I hope my code also fits in
I just sort of looked around to see how stuff was implemented, and tried to fit in the parts
I was mostly unsure of getting ._ to work just like any operator
 
I think the way you did it will work, but strange bugs might pop up.
 
I'd suggest looping over all lines, splitting on whitespace and checking if parts[0] == ';' and parts[1] == 'end'
otherwise stuff that won't work is ` ;end` or ; end, etc
 
Well, ;end still won't work your way
 
5:00 AM
damn
true
 
I can just remove all whitespace, and see if it starts with ;end
 
how I did it in multiline mode was this:
loop over every line, check if line.lstrip()[0] == ';', if yes then check if line.lstrip()[1:].lstrip().startswith('end')
 
So '^\s*;\s*end' is the appropriate regex?
 
if you want to use regex, sure
(and \s is set to not match newlines)
 
It'll be within a single line, so that won't be a problem
 
5:04 AM
by the way, I had a rather radical idea that I would like if implemented, but is really breaking towards old programs, so it probably shouldn't be implemented
p should be print(_, end="") and .p should be what print is now
 
Why?
 
because usually the only time I look to use p is when I want to print things without a newline and end up doing p_k
 
Ah
 
and actually, .p wouldn't even be necessary
.p is just as long as p+
@isaacg basically my argument is that I much more often want to do "print without newline" rather than "concatenate and print"
 
I guess the real think is, when we are concetanating and printing, we're fine with reordering.
thing*
 
5:10 AM
what do you mean?
you're only fine with reordering if you concatenate with ""
I definitely think that my proposed behaviour for p is superior, I just don't know if it's worth breaking every single old Pyth program written that uses p (an arity change will pretty much guarantee no program will work afterwards)
 
What I mean is, I often golf ++abc to `pbac'. This would make that impossible.
I'd guess I've used that golf much more than p_k has cost me a character.
 
++abc would indeed be one character longer
maybe it's interesting to do a case study and look through all answers on PPCG that use p
 
I wish there was a way to easily collect all the Pyth answers.
 
There is
if your torrent client supports it you can choose to only download PPCG dump
published march 16, so should be reasonably updated
 
5:42 AM
@isaacg ok I looped over all answers, extracted all <pre><code> sections that consisted of only one line, and disqualified everything larger than 250 characters
doesn't seem to be all Pyth, but a decent filter
 
Cool!
 
After more manual filtering I've got it down to 14 answers
and even those are not all Pyth I think
 
5:59 AM
9, 11, 12, 13 are not Pyth, the rest are, I think.
 
> Edits must be at least 6 characters; is there something else to improve in this post?
fuck you stackexchange
 
8's not pyth either
 
autocmd! FileType pyth setlocal shiftwidth=2 tabstop=2
:D
 
6:53 AM
@isaacg how do you usually go from int -> str
nvm `
 

last day (14 days later) »