last day (85 days later) » 

11:46 AM
Okay so first things first
We need to figure out how to compress it
Like how will the probabilities be deduced
 
there would have to be two separate things: an encoder to the PPCGable program and a decoder. The reason why most of my attempts failed was because those two were too distant and one addition required multiple changes
 
Multiple changes?
 
@ASCII-only like to add an adding operator it needed an addition of its disabling logic to the encoder and decoder
 
Also IMO encoding and decoding is the easiest part lol
@dzaima Disabling logic?
 
@ASCII-only after 3 and 4 has been just pushed to the stack, it makes no sense to add those together so the disabling logic for "+" is when 2 constant things are on the stack reduce the tree so "+" has 0% chance of being next
 
11:50 AM
Right
I'd say that's not how it should work
 
Anonymous
So to make sure I understand this concept - there would be a translation where programs are represented by integers using Huffman encoding or something similar, utilizing different spellings of the same items and prediction of future terms to optimize the integer for size. There would be a many-to-one correspondence for encoding, but a one-to-one correspondence for decoding.
 
Yes
I think
I would have thought you'd just pass the optimizer a massive corpus and it would build a probability tree?
 
@Mego the way I'm thinking this is that there would be one-to-one correspondence for encoding as there is no room for changes
 
Anonymous
@dzaima Additionally, if you had a command for +1 (like u in Actually), 1+ would never appear when the TOS is a token where u works.
 
@Mego Yep, that kind of logic
 
Anonymous
11:52 AM
@dzaima I was mentally combining the encoder with an autogolfer for some reason.
 
@Mego well, it'd have to be that too somewhat
 
@dzaima Not exactly well kinda
Because any less optimized programs would probably decode to different programs
So the first step is to figure out a way to represent optimizations then?
 
Anonymous
@dzaima True, it would be helpful to not require optimally-golfed code to be input. There would need to be a way to recognize different equivalent pieces to make those optimizations.
 
btw I think I even got a running thing for the commands of pushing a number and adding
the idea I've got for how it does the logic is that it's got a pseudo-stack with the probable things on it and each item has a value of is it constant, dependent on the input or random (idk if adding random things to the language would be worth it)
 
huh?
random things?
I'd say we definitely need a corpus
To determine the probabilities
 
11:57 AM
@ASCII-only a random() function or similar
 
@dzaima I'd say every language should have one of those
But I don't see how that would affect optimization
 
oh yeah I guess input == random so that'd have to be supported
 
There should never be a constant variable right
But :/ what if e.g. squaring a number is the golfiest way to get it
 
@ASCII-only then make the disabling logic notice that and allow squaring
 
Right, so we only optimize away things that are certain to be bad for code size
 
12:00 PM
@ASCII-only that's the idea
 
Okay: step 1 is optimizer
 
the biggest problem I can think of is loops and I think the way I'd deal with them is just optimize constant-seeing as from the 1st looping trough and after it just start as with a fresh stack (or if the looping amount is constant then happily run trough it)
 
We probably need to define function return types first will the type of a variable ever affect code size
@dzaima Huh?
 
@ASCII-only my experience from the failed attempts; something smarter might be possible
 
???
Smarter?
 
12:04 PM
@ASCII-only if loops are of variable length, how would you know what they've left on the stack after they're done so further stuff can be optimized
 
@dzaima You have a pseudo interpreter
But.
Would the type of the items on the stack ever matter
 
@ASCII-only if there's a function which takes 4 inputs and the passed types are invalid (and there is nothing to overload it with) it should be disabled
 
Ah ok
Right, possible next functions depend on stack contents
 
what I wanted to achieve is that I'd have to overload functions for different types very little and the impossible ones are impossible
 
Fair enough
Right so the source language doesn't have to be very golfy
So it can be more readable
number = Tester(lambda token: token.type == Number)

# in optimization list
[[number & constant, number & constant, "+"], lambda tokens: [Token(tokens[0].value + tokens[1].value)]
How does this look
number = Tester(lambda token, value=None: token.type == Number if value is None else (token.type == Number and token.value = value))

# in optimization list
[[number & constant, number & constant, "+"], lambda tokens: [Token(tokens[0].value + tokens[1].value)]]
[[number, number(1), "+"], lambda tokens: [tokens[0], "u"]]
 
12:12 PM
?
 
optimizations
Like how would this look as a theoretical format for optimizations
 
@ASCII-only oh you mean like the logic for what should be impossible?
 
Nah, more for golfing the program
 
@ASCII-only oh that makes more sense
I think that auto-golfing should be one of the last things done as it can be lived without
 
So we just feed it optimized programs at the start?
Right
 
12:19 PM
it should just be unable to to process ungolfed programs
but making it able to golf it from there should be easier as it'd know what is ungolfy and just execute it and replace the expression with the result
 
@dzaima Hmm
But how would it be unable
Anyway. So really all there is to do is pseudocode for the huffman tree generator?
 
@ASCII-only let's say there are 3 commands: push 2, push 4, add. So the program starts out by pushing 2, then pushing 3, then it disables the possibility of add (if the tree was a simple 1:1:1 then it'd be like reading a base 2 number instead of base 3)
 
Right
So basically add isn't in the possibility tree at all
Time to make a HackMD
 
@ASCII-only exactly
 
hackmd.io/KYZgxgZgLAJgRgJgLTAKxTkqxJIIYCcAjAGxLokxqioAcUJQA===?both
 
12:26 PM
{"+": get(0).constant && get(1).constant && get(0).type==get(1).type//const+const = optimisable
   || get(0).type==number && get(0).value==1//incr replaces this
   || get(1).type==number && get(1).value==1//decr replaces this
}
 
pseudo-logic for an adding command
 
Hang on
Ideally I'd have no logic at all
Just a bunch of lookups
So all the encoder/decoder do is use the Huffman tree (there'll be a different one depending on the items on stack)
 
it'd have to somehow know that +1 == incr though, and just testing different numbers to see that is ugly
 
Anonymous
12:29 PM
@ASCII-only So doing all of the logic ahead-of-time so that the Huffman trees only need to be built once, rather than once per program
 
@ASCII-only yeah, but making the huffman tree is not easy
 
Yes
@dzaima Yes, so that will be like 99% of the code
 
what's the Tester there supposed to be?
 
it's a type the generator can then call on values to test if they're 1 (or a number etc.)
But I probably need to rethink
Hang on, it would be better to just create a token from the value right? e.g.
ConstantNumber(1), which is ConstantNumber, which inherits from Number, then Value?
And then the generator would travel up the inheritance tree (repeatedly get superclass) and collect all the disables (idk what to call them)?
@dzaima How does the first codeblock look
 
12:45 PM
I'd rather have constant be a property of the Number/String class than an extension
 
example pls
Hang on, I think I've got it
so like an is_constant property?
 
so to test if an object is constant it's be myObj.constant not myObj instanceof ConstantNumber
 
Maybe.
But the way I'd do it is climb up the inheritance chain
 
so testing for constantness is independent of the type
 
@dzaima But I don't think that would be very useful?
 
Anonymous
12:48 PM
You can have it both ways, sort of
 
I think?
Or use Python's weird multiple inheritance maybe
 
@ASCII-only calling a function that pops without doing anything should never be after any constant
 
@dzaima Right.
 
Anonymous
You can have a property that defaults to False, and then override that property further down the inheritance chain to be True
 
:/ I'm not sure
We need a way to gradually make the filter (?) more general
 
Anonymous
12:49 PM
So class Number: constant = False, class Constant(Number): constant = True
 
when would it being a subblass be useful?
 
So we have a filter for ConstantNumber(1) -> I'd just call type to get ConstantNumber -> somehow get Number (superclass) -> get Value
And while you're doing it, look it up in the dictionary if that's possible
 
@ASCII-only that's another reason why I stopped trying so many times - the filter was very non-general
 
Anonymous
@dzaima With a longer inheritance chain and an object that you only care about being an instance of a class midway through the chain
 
Anonymous
So like you have A -> B -> C -> ... -> Z, and you're dealing with objects of type Z. One filter would concern foo.some_Z_property, and another filter would concern foo.some_K_property, and you could do that without having to do casting with inheritance and polymorphism.
 
12:55 PM
@mego oh, with that I meant "why not have it be the same class but simply with a variable saying if it's a constant or not" not "shouldn't it be a class of its own"
 
Anonymous
Hmm... You've got a point
 
Anonymous
I also think we might be overengineering it a bit
 
:/ Maybe
 
I guess making a subclass makes it easier to create
 
But
Can't we just repeatedly find superclasses if it's completely class-based
And the disabling thing will not need to have any knowledge of the properties at all
 
12:58 PM
@ASCII-only don't see how that would be useful
 
7 mins ago, by ASCII-only
So we have a filter for ConstantNumber(1) -> I'd just call type to get ConstantNumber -> somehow get Number (superclass) -> get Value
And then look them up so see what's disabled
 
Anonymous
@ASCII-only RTTI is expensive in any language. A property-based approach instead of doing inheritance checks would be preferable.
 
my idea was that the disabling checker would operate on the types not be a part of them
 
True
@dzaima It would operate on the types still
But to me it seems like an approach like inheritance would work best?
 
@ASCII-only yeah, but I don't see a reason why it would be a part of the types
 
1:00 PM
Hang on, redoing a bit
 
I feel like I'm not understanding a major thing about your idea of how this should be
 
Yeah :/ IDK how to explain brb will try to pseudocode
 
also note I mostly don't know python
 
but.. python is meant to be pseudocode-like :(
 
This looks both incredibly complicated and incredibly awesome...
 
1:05 PM
once you've defined all the types hopefully I'll start understanding your idea
@SocraticPhoenix exactly
 
@dzaima Yeah hopefully lol
 
So.. the idea is that the encoding is a tree which intelligently chooses the right path?
 
so if I understand your 1st disable definition then it means that a constant 1 can never take part of any of +-/*^?
 
Not exactly
@dzaima Can never be the second operand, yes
I didn't include the ones for 1 <value>+ etc.
 
@ASCII-only how about never can be the 1st operand?
 
1:08 PM
Hang on will add
 
@SocraticPhoenix intelligently generates best options for the probable best options and intelligently disables ones that can be golfed or something like that
 
Um :/
My idea was: the trees are pregenerated, the encoder/decoder just perform lookups to find the values
@dzaima Line 56 should be right I think
 
@ASCII-only the tree structure generation could be improved later, as it can be constant or not, it doesn't change how disabling works on it
@ASCII-only how would you define it to disable exactly Number + ConstantNumber(1)?
 
@dzaima ?
 
(as "abc" + 1 makes sense to be used)
 
1:14 PM
Wait why would that make sense
@dzaima Are you asking how it does it
 
@ASCII-only how would it
@ASCII-only "abc" + 1 = "abc1"
 
Yeah wouldn't that always be optimized
 
@ASCII-only with my idea no
 
Yeah but like won't it always make sense to combine the literals here
To save 1 char for the plus
 
Anonymous
@dzaima It depends on the definition of +. It's probably best to just stick with integers while we figure out the details of what we're doing, and then work on adding different types and the interactions between them.
 
1:17 PM
@ASCII-only then how would it concatenate 1 to the input?
 
@dzaima By running it?
Wait that's for the optimizer
Disabler can just ignore it
 
if String + ConstantNumber(1) is forbidden then concatenating string input with 1 is impossible without making the 1 a string
@Mego I'd say that making it handle types early on is good as disabling specific typed functions should be a thing
 
@dzaima Oh then ConstantString
Pls check HackMD again
also gtg for a while
 
@ASCII-only ? the input isn't constant
 
@dzaima Yeah I meant it would only apply to ConstantString
 
1:22 PM
@ASCII-only yeah, that makes sence, but not string+ConstantNumber
 
@dzaima yep definitely
 
@ASCII-only so my question is how would you add that as a rule to the disabler
 
ConstantString and ConstantNumber?
 
@ASCII-only yeah
 
Similar to the ConstantNumber and ConstantNumber one there I think
 
1:25 PM
oh that. how does that even work
 
Haven't written pseudocode for the actual tree gen yet
 
I still like my simple method better
 
But basically take two tokens, apply the second codeblock to get parents, then lookup every combination
@dzaima yeah sure but I think it might be a bit of a pain to add all the exceptions
Maybe
 
well as the definitions are more codey and not limited to Disables and you could make helper functions like typesEqual and bothConstants it should be shorter
 
@dzaima but both constant can be done that way too
Plus you can make helper functions to that as well
I might need to think of an example
@dzaima ok maybe
Depends on how many value to value disables you have I guess
If you have any of those then you'd need to write the condition every single time
 
1:36 PM
give me an example where you think your method is superior to mine
 
Idk
How would you disable a function that only works on strings
 
@ASCII-only so it should be disabled unless both arguments are strings?
 
Yes
Wait hang on
Lol I think I did overthink it
 
{"func": args[0].is("string") && args[1].is("string")}
 
So instead you just have a function for validity for each command right
 
1:40 PM
or {"func": allAre(args, "string")}
@ASCII-only yeah
 
Yay what is new golflang :P
 
Ok lol that's probably a better idea
 
@Downgoat a language that I wanted to make for a while but never did
oh yeah
as the huffman tree will change a lot between updates TIO isn't exactly gonna work as old answers won't work :/
 
Why would it change a lot
But yes
 
Have u decide on a paradigm
 
1:42 PM
new function = new node in the tree = balanced off everything
 
@dzaima true
@Downgoat whatever paradigm stack based langs are
 
@Downgoat paradigm decision will come after something works. So far it's mostly stack-ideaish but at least half of the idea could work on other paradigms.
 
Yes
Stack just seems easy to implement
 
what I'd really like with this language is that after some answers to PPCG we could train the language to optimize itself from the answers
 
@ASCII-only ono stack base mean non golfy
 
1:45 PM
@dzaima well yes
@Downgoat no it should be the golfiest
@dzaima that's the idea kinda
We generate the initial tree from a corpus of programs
 
Then u should do functional + Vector compose
 
@Downgoat it might be generally but this idea would be able to optimize stack-based a lot better than other paradigns
 
Ideally answers for past changes
 
@dzaima Wait is speed priority or smallness?
 
@Downgoat smallness
 
1:47 PM
Then why do longer paradigm for optimize porpoise
 
@Downgoat well the whole language is compressed multiple times so golf :p
 
@dzaima multiple times?
 
@ASCII-only well not really but somewhat
@Downgoat stack-based feels easier to optimize well with the strategy of the language which should hopefully equal out with stack-based ungolfiness
 
@Downgoat because after Huffman it should beat jelly
 
@dzaima eh, if your progs have high enough entropy compression won't do anything
 
1:49 PM
@Downgoat yes
But PPCG challenges are usually low entropy
 
@ASCII-only I am talking abiut programs not ppcg challenge?
 
But only place we need to golf is PPCG
 
idk if huffman like othee compress algos and result in longer string for shorter input? Or is it entropy encoding?
@ASCII-only entropy of challenge dhoul have nothing to do with entropy of program
 
well its not really compression, it's more complicated
 
@Downgoat what do you mean
 
1:52 PM
Entropy = cary most amnt of info per bit
 
@dzaima btw pls wipe code blocks I'll redo them tomorrow unless you want to
 
Ono battery's flat
 
@ASCII-only eh, I can't really write python :p
 
brb refilling
 
@Downgoat idk but we'll ideally be getting close to the enumerate all valid programs limit
 
1:54 PM
That should be infinity?
 
@dzaima just write it in any language
 
^ I reccomend VSL or JS
 
@Downgoat like a language that enumerated all valid programs
It would be close to the size of that
 
@Downgoat I'd personally go with JS or something that transpiles to JS so an online interpreter would be easy to do
 
@ASCII-only U mean Unary?
 
1:56 PM
@Downgoat wat no
 
@Downgoat unary has invalid programs
and also has stupid programs like [-][-]-+-+-+
 
@dzaima yea but you can just do I++.toString(2) and you likely have new porgrna
 
@Downgoat but not all valid
 
@ASCII-only yea but wouldn't be very verbose?
 
@Downgoat why
 
2:00 PM
@dzaima if u do that you can use nearley :D
abd that would make it easy to generate random valid program
 
@Downgoat stack based doesn't need nearley
@Downgoat no it wouldn't
We explicitly disable all invalid programs
 
@ASCII-only *as much as we can
 
I.e. They can never be written in conventional form
 
@ASCII-only wat?????????
 
@dzaima shouldn't everything left be valid though
Wait hang on
Yeah random and input can mess things up :/
 
2:03 PM
@ASCII-only yeah, that's one of the problems
 
2:20 PM
I think we should start simple
Like split on spaces language simple
@dzaima thoughts?
 
like for what? as a base for the actual language? as the verbose mode?
 
@dzaima yeah
Like the underlying stack based Lang
 
@ASCII-only ah ok
 
And yeah verbose sounds good
Easy to type, easy to understand
 
@ASCII-only the question is how golfy would it be
 
2:26 PM
Not very
It doesn't need to be
 
I meant how golfy would the unverbosified output be
 
I wonder lol
Do you have a target
 
I have no idea how would I even start with making a verbose mode for a stack-based language that results in a golfy program
 
Wait what
Golfy verbose node doesn't make sense
Well the basic one is literally split by spaces
Well except for strings
 
how should the non-verbose version be stored in the temporary lang?
 
2:31 PM
???
Hexdump probably?
For TIO at least
Raw bytes for every thing else
 
I meant for the time being while we don't have the huffman encoding
 
Then not at all?
 
and while running and it's decoded
oh yeah it could be the verbose mode
 
Just decode to verbose mode
 
ninja'd
okay so where to start
first of all what language to make this in
 
2:34 PM
Only because bad internet lol
@dzaima whatever you want
Maybe discuss with Mego though
 
@ASCII-only I want something that is/transpiles to JS because online but it's JS..
 
Then JS is fine
 
JS has horrible OOP though
 
No wat
What does it lack
@dzaima
 
@ASCII-only idk I just hate it :p
 
2:38 PM
Then coffeescript?
C transpiled to wasm?
ClojureScript?
Cheddar? :P
@dzaima Dart then?
 
so many languages..
which would you choose?
 
JS lol
 
k so JS
 
Maybe Opal but it's Ruby based
 
@ASCII-only I know neither of those
 
2:45 PM
I mean I'd choose JS because no overhead
And it should be fine
 
yeah
 
So you can start on it if you want I guess
You don't even have to do that much actually
Just enough to do some basic programs
 
so the verbose mode will be just tokens separated by spaces right?
 
Also that way if I have any problems with whatever you write I can bring it up before to do too much
@dzaima except for strings
Unless you escape the strings
Somehow
 
strings shouldn't be too hard to handle
 
2:49 PM
I'd just have a regex to match the next token
Wait
 
@ASCII-only oh yeah it's that simple
 
You can just check if a token starts with quote
and join with spaces until it ends in quote too
I have a string unescaper I can use, it's in the vsl repo under vsltokenizer.js if you want to have a look
Okay gtg sleep for now
 
@ASCII-only rip what time is is for you?
 
1 am
Don't normally sleep this early but I'm sick
Don't want to cough to death lol
 

  last day (85 days later) »