pyth icon indicating copy to clipboard operation
pyth copied to clipboard

Ideas for improvement

Open isaacg1 opened this issue 9 years ago • 17 comments

This will be a thread for ideas for improvement of pyth:

Pyth eval/exec (not in safe mode) Remove sets, make operations explicit. bitwise operations setwise operations bagwise operations operation on one location in a list. Like X, but an arbitrary operation.

isaacg1 avatar Oct 07 '15 18:10 isaacg1

Why not pyth eval in safe mode? Also, what are bags?

Maltysen avatar Oct 08 '15 17:10 Maltysen

@Maltysen bags are like sets with multiplicity. .- uses them. Pyth eval in safe mode should work, now that I think of it.

isaacg1 avatar Oct 08 '15 17:10 isaacg1

so like collections.Counter?

Maltysen avatar Oct 08 '15 17:10 Maltysen

I haven't used that one, but it sounds about right. One difference is that bags usually don't allow negative counts, however.

isaacg1 avatar Oct 08 '15 18:10 isaacg1

Could .e be made to work with a pfn? a simple example j+.eG

vendethiel avatar Feb 18 '16 12:02 vendethiel

http://codegolf.stackexchange.com/questions/75335

It's really hard to split a sequence into pieces by a specific criterion. Not really sure how a good solution should look like. But a "split list by indices" function would be a good start. Like xG[1 5 should give ["a", "bcde", "fgh..."]

jakobkogler avatar Mar 11 '16 07:03 jakobkogler

@jakobkogler That is the existing functionality of c. See here: https://pyth.herokuapp.com/?code=cG%5B1+5&debug=0

isaacg1 avatar Mar 11 '16 08:03 isaacg1

Oh, right.

2016-03-11 9:02 GMT+01:00 isaacg1 [email protected]:

@jakobkogler https://github.com/jakobkogler That is the existing functionality of c. See here: https://pyth.herokuapp.com/?code=cG%5B1+5&debug=0

— Reply to this email directly or view it on GitHub https://github.com/isaacg1/pyth/issues/156#issuecomment-195243473.

jakobkogler avatar Mar 11 '16 08:03 jakobkogler

Maybe a string compression algorithm for short strings (.Z actually outputs something longer for short strings. For example, it outputs a 23 byte long string for a 11 bytes long string). I'm thinking about something like smaz (see this). Could be the same way of working, but with a new token (§n , ...)

FliiFe avatar Apr 06 '16 12:04 FliiFe

@FliiFe Yeah, .Z is pretty bad. Don't think anybody ever used it. But there is .", which compresses strings quite well.

jakobkogler avatar Apr 06 '16 13:04 jakobkogler

Also, An issue I often come across, is that I can't find the list() constructor. And even cQk throws an error. The shortest I have found is :Q"."1

FliiFe avatar Apr 08 '16 13:04 FliiFe

It looks like you're trying to convert a string to a list of characters. A couple of ways to do this are cQ1, which chops the string into pieces of length 1, and mdQ.

isaacg1 avatar Apr 08 '16 14:04 isaacg1

Oh, didn't think about them. Thanks! Another thing I've been thinking of, is a variable with default value 1

FliiFe avatar Apr 08 '16 14:04 FliiFe

Perhaps a way to write in Python and then have it converted to Pyth?

jackHedaya avatar Jul 19 '17 01:07 jackHedaya

@jackHedaya That's very unlikely to ever be possible - the two languages are too different.

isaacg1 avatar Jul 19 '17 22:07 isaacg1

I see... Perhaps better error displaying? For example showing at what point there is an error in terms of Pyth code.

jackHedaya avatar Jul 20 '17 16:07 jackHedaya

@jackHedaya Could you give an example of the sort of thing you're thinking of?

isaacg1 avatar Jul 20 '17 20:07 isaacg1