Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » PigeonScript - a Golfing Language
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
We could have one quote at the beginning, but, correct me if I'm wrong, aren't variables supposed to be only one word anyway?“log” is too long – make it “l”. And it should be implicit output so no need for the “l” at all. It could be a variable so we should have one quote atthe start I think.Ok, I envision a hello world program to look like this (if we use prefix notation)Interesting. I was more thinking it would look like thisThe “d” decompresses the next parameter.d"gsS1p
The "gsS1p does not require a closing quote because that is implicitely done at the end of the program. I just made up gsS1p but it would be a compressed version of Hello World.And in this case it assumes it's a string, since it's A) two words and B) not a number. Also, any ideas for a name?log Hello World
Saiid
Saiid
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
But what if you want two variables?We could have one quote at the beginning, but, correct me if I'm wrong, aren't variables supposed to be only one word anyway?“log” is too long – make it “l”. And it should be implicit output so no need for the “l” at all. It could be a variable so we should have one quote atthe start I think.Ok, I envision a hello world program to look like this (if we use prefix notation)Interesting. I was more thinking it would look like thisThe “d” decompresses the next parameter.d"gsS1p
The "gsS1p does not require a closing quote because that is implicitely done at the end of the program. I just made up gsS1p but it would be a compressed version of Hello World.And in this case it assumes it's a string, since it's A) two words and B) not a number. Also, any ideas for a name?log Hello World
Saiid
Saiid
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
But what if you want two variables?We could have one quote at the beginning, but, correct me if I'm wrong, aren't variables supposed to be only one word anyway?“log” is too long – make it “l”. And it should be implicit output so no need for the “l” at all. It could be a variable so we should have one quote atthe start I think.Ok, I envision a hello world program to look like this (if we use prefix notation)Interesting. I was more thinking it would look like thisThe “d” decompresses the next parameter.d"gsS1p
The "gsS1p does not require a closing quote because that is implicitely done at the end of the program. I just made up gsS1p but it would be a compressed version of Hello World.And in this case it assumes it's a string, since it's A) two words and B) not a number. Also, any ideas for a name?log Hello World
Saiid
Saiid
Hello+World
Hello World
Saiid
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Anyway, we'll want a built in compressed for the hello world
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Anyway, we'll want a built in compressed for the hello worldYou mean have the function
print "Hello world"
hw
Saiid
Last edited by Saiid (Oct. 25, 2016 16:05:12)
- Sigton
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
He means compressing the string itself into fewer bytes, so the program will still effectively readAnyway, we'll want a built in compressed for the hello worldYou mean have the functionbuilt in? something likeprint "Hello world"would print “Hello World” you mean?hw
Saiid
print "Hello world"
I like the idea of implicit output, kinda like Python shell. it means we don't need a command to print, and once everything is executed and evaluated the result will be printed (that would make it a very functional language… everything would eventually need to return something).
Sigton
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
(We still need a command to print, we just don't always need to use it)
Anyway, yes, I mean instead of “Hello World” we can put
Because “Hello” and “World” are common words they can be easily compressed. The “d” calls the “decompress” function
Anyway, yes, I mean instead of “Hello World” we can put
d"ghD15
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
I think compressing the string would be confusing. It still should be relatively easy to write in and understand. I do agree with the implicit output. So, to confirm. Is this relatively acceptable to everyone?He means compressing the string itself into fewer bytes, so the program will still effectively readAnyway, we'll want a built in compressed for the hello worldYou mean have the functionbuilt in? something likeprint "Hello world"would print “Hello World” you mean?hw
Saiidbut the string “hello world” will itself be shortened.print "Hello world"
I like the idea of implicit output, kinda like Python shell. it means we don't need a command to print, and once everything is executed and evaluated the result will be printed (that would make it a very functional language… everything would eventually need to return something).
Sigton
To print:
Hello World prints "Hello World"
var prints the value of that variable
3.1415 works the same as the first and prints "3.1415"
Also, I thought that for variables, instead of having, for example
var x = 1;
x|1

Saiid
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
But then we would still need to include something that tells it that we're assigning a variable and not printing a stringx|1
To save a byte1x
Also, is everyone fine with having the command “l” for when something needs to be specifically told to log itself? For example,
x|1
l x|1
Saiid
Last edited by Saiid (Oct. 25, 2016 18:03:18)
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Just put quotes around strings.But then we would still need to include something that tells it that we're assigning a variable and not printing a stringx|1
To save a byte1x
Also, is everyone fine with having the command “l” for when something needs to be specifically told to log itself? For example,might assign a variable, but if we wanted to print “x|1”, we could dox|1l x|1
Saiid
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
That adds unnecessary and unneeded bytes that could be savedJust put quotes around strings.But then we would still need to include something that tells it that we're assigning a variable and not printing a stringx|1
To save a byte1x
Also, is everyone fine with having the command “l” for when something needs to be specifically told to log itself? For example,might assign a variable, but if we wanted to print “x|1”, we could dox|1l x|1
Saiid
Saiid
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Variables are more commonly used than strings. It moves bytes from variables to strings.That adds unnecessary and unneeded bytes that could be savedJust put quotes around strings.But then we would still need to include something that tells it that we're assigning a variable and not printing a stringx|1
To save a byte1x
Also, is everyone fine with having the command “l” for when something needs to be specifically told to log itself? For example,might assign a variable, but if we wanted to print “x|1”, we could dox|1l x|1
Saiid
Saiid
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
It's still unnecessary. It takes less bytes to write outVariables are more commonly used than strings. It moves bytes from variables to strings.That adds unnecessary and unneeded bytes that could be savedJust put quotes around strings.But then we would still need to include something that tells it that we're assigning a variable and not printing a stringx|1
To save a byte1x
Also, is everyone fine with having the command “l” for when something needs to be specifically told to log itself? For example,might assign a variable, but if we wanted to print “x|1”, we could dox|1l x|1
Saiid
Saiid
l x|1
Hello World
012345
'x|1'
'Hello World'
012345
Saiid
- CodeLegend
-
Scratcher
500+ posts
PigeonScript - a Golfing Language
Saiid, I suggest you take a look at ATC#5. Be sure to open the shortened link, it has roughly 100 examples of golfed programs that run in Scratch languages.
If you're going for simplicity (which you've stated), variables and loops are not the way to go as a ‘first step’. Your first step should be basic math; the language doesn't need to be Turing-complete until later in development. That being said, here are some tips:
If you're going for simplicity (which you've stated), variables and loops are not the way to go as a ‘first step’. Your first step should be basic math; the language doesn't need to be Turing-complete until later in development. That being said, here are some tips:
- Use postfix notation. It makes the architecture so much simpler, which means that you're less likely to make mistakes.
- Once you've chosen an architecture, choose which data types your program will be able to manipulate. This list will probably consist of booleans, numbers, strings, possibly lists, and maybe a few more. (for instance, you could have a ‘coordinate’ data type (x,y), and corresponding commands that make geometry easier)
- Once you are sure of the data types you'll be using, start brainstorming the commands that the language will have. Obviously you'll have things like + and =, but the number of commands is unlimited. Often, more is better. Prioritize which commands will be a single character long, and which ones will be subsets of other characters. (see: “.” in pyth) Keep in mind that while some commands are useless on their own, they can be incredibly useful when other ‘useless’ commands are present. For instance, if your program won't ever need to input or output lists, it can still be useful to process first-class lists internally. List commands would be useless on their own, but useful when put together.
- CodeLegend
-
Scratcher
500+ posts
PigeonScript - a Golfing Language
Sorry, but I have to specifically call you out on this one - you're wrong. How is this:Variables are more commonly used than strings. It moves bytes from variables to strings.That adds unnecessary and unneeded bytes that could be savedJust put quotes around strings.But then we would still need to include something that tells it that we're assigning a variable and not printing a stringx|1
To save a byte1x
Also, is everyone fine with having the command “l” for when something needs to be specifically told to log itself? For example,might assign a variable, but if we wanted to print “x|1”, we could dox|1l x|1
Saiid
Saiid
l x|1
l"x|1
Plus, this:
Hello World
EDIT: I'm sorry if I'm coming across as mean; that's not my intent. But most of the people in this thread have successfully created codegolfing languages, so you should listen to their advice.
Last edited by CodeLegend (Oct. 25, 2016 22:14:16)
- Saiid
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
Saiid, I suggest you take a look at ATC#5. Be sure to open the shortened link, it has roughly 100 examples of golfed programs that run in Scratch languages.Simplicity, yes, but some simplicity can be sacrificed to aid codegolfing. In addition, I was more trying to start with an output command.
If you're going for simplicity (which you've stated), variables and loops are not the way to go as a ‘first step’. Your first step should be basic math; the language doesn't need to be Turing-complete until later in development. That being said, here are some tips:Mostly irrelevant, but back to variables and loops: you don't actually need them. You probably should have them, but a language with strong stack manipulation abilities and a simple ‘goto’ can be Turing-complete.
- Use postfix notation. It makes the architecture so much simpler, which means that you're less likely to make mistakes.
- Once you've chosen an architecture, choose which data types your program will be able to manipulate. This list will probably consist of booleans, numbers, strings, possibly lists, and maybe a few more. (for instance, you could have a ‘coordinate’ data type (x,y), and corresponding commands that make geometry easier)
- Once you are sure of the data types you'll be using, start brainstorming the commands that the language will have. Obviously you'll have things like + and =, but the number of commands is unlimited. Often, more is better. Prioritize which commands will be a single character long, and which ones will be subsets of other characters. (see: “.” in pyth) Keep in mind that while some commands are useless on their own, they can be incredibly useful when other ‘useless’ commands are present. For instance, if your program won't ever need to input or output lists, it can still be useful to process first-class lists internally. List commands would be useless on their own, but useful when put together.
Saiid
- CodeLegend
-
Scratcher
500+ posts
PigeonScript - a Golfing Language
There is no aid to using prefix notation over postfix notation. They are the exact same length.-snip-Simplicity, yes, but some simplicity can be sacrificed to aid codegolfing. In addition, I was more trying to start with an output command.
Saiid
An output command is the last thing you need. First implement a stack.
- jokebookservice1
-
Scratcher
1000+ posts
PigeonScript - a Golfing Language
I disagree, when you have implicit closing quotes at the end of the program, thenThere is no aid to using prefix notation over postfix notation. They are the exact same length.-snip-Simplicity, yes, but some simplicity can be sacrificed to aid codegolfing. In addition, I was more trying to start with an output command.
Saiid
An output command is the last thing you need. First implement a stack.
d"abc
"abc"d
- CodeLegend
-
Scratcher
500+ posts
PigeonScript - a Golfing Language
That's just one specific situation. Besides that, they are isomorphic.I disagree, when you have implicit closing quotes at the end of the program, thenThere is no aid to using prefix notation over postfix notation. They are the exact same length.-snip-Simplicity, yes, but some simplicity can be sacrificed to aid codegolfing. In addition, I was more trying to start with an output command.
Saiid
An output command is the last thing you need. First implement a stack.is shorter thand"abc"abc"d
- Discussion Forums
- » Advanced Topics
-
» PigeonScript - a Golfing Language




