?Q?
?Q?(pronounced Qustjeon or /ˈkwɛstʎən/) is a esolang created in a afternoon by User:Yayimhere.
name
the name comes from the file format .?Q?
which is a file thats compressed, typically by the SQ program
memory
memory is stored in a string initially set to the empty string
syntax
~
add a ) to the string if the start of the string is (. to make it add a ( instead a & is placed before it.
delete all brackets that does not have a matching bracket(so for example the string (() becomes ())[…]
set the string to …?
add a space to the code if the start of the string is (!
delete the end of the string,
set string to user input$
output the string*
go back to the start of the code if the string is not empty{…}
append … to the string`
append the string to itself#
if the following command has already been ran skip it:
run the string as code@
reverse the string
tips
- if you want to only loop a specific part of the program add
#
to the part thhats before the loop. :
makes it a little bit possible to create functions
examples
hello, world!:
[hello, world!]$
Cat:
,$
{*\n}$!!*
unary exponent:
#{*}`*
Truth-machine with 0 as ) and 1 as 1:
#,$.*
computational class
?Q? is Turing complete since it can simulate a Bitwise Cyclic Tag with a ( as 1 and a space as 0. this is a substitution to do so:
11 : &~ 10 : ? 0 : @!@
the program must end with a *
. and to set up the datastring:
#{data} the data must be in ?Q? format
so the Collatz sequence provided on the BCT page is:
BCT program: 10 11 10 10 10 11 0 11 10 10 0 11 10 10 11 10 10 11 10 10 0 0 0 0 ⇅ ?Q? program: #{( }?&~???&~@!@&~??@!@&~??&~??&~??@!@@!@@!@@!@*
note that the number of times (
is repeated in the append, is how many times 100
is added to the string. if you want to print the string every iteration $
can be added before the *
. so the collatz sequence would become:
#{( }?&~???&~@!@&~??@!@&~??&~??&~??@!@@!@@!@@!@$*
on the first 7 relevant iterations it prints(not including the semicolons) for the number 3:
?Q? step# Collatz term ?Q? data-string ----- ------------ ------------------------ 0000 3 ( ( ( ; 0096 5 ( ( ( ( ( ; 0240 8 ( ( ( ( ( ( ( ( ; 0432 4 ( ( ( ( ; 0528 2 ( ( ; 0576 1 ( ; 0624 2 ( ( ;
and the script for number the number 3:
#{( ( ( }?&~???&~@!@&~??@!@&~??&~??&~??@!@@!@@!@@!@$*