Skip to main content
added 167 characters in body
Source Link
mroman
  • 1.5k
  • 8
  • 17

Burlesque, 40 bytes

ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 

Explanation:

Burlesque has advanced stack and code manipulation built-ins. In fact, you can't access the source code of the program but you can access the remaining code that is to be executed in the future. This means #Q will return all the code that follows it which is why we have to add everything up to #Q to that code which is what we're doing with ri#Q.

blsq ) #Q1 2++ 12 -- this is the result of 1 2++ {1 2 ++} -- this is the result of #Q 

++1 2 is technically illegal code since it's stack based. But we can manipulate the code to make it execute as 1 2++:

blsq ) #Q<-#q++1 2 12 

Working with these built-ins is incredibly tricky and nobody has yet used them for anything productive except for quine related things. If you reverse ++1 2 you get 2 1++ which would produce 21 and not 12. The reason the code above produces 12 is because #Q also includes the <- so in the end we end up executing a lot more than just 2 1++ :p. We end up executing 2 1++#q<- which produces 12.

We can actually replace things in our code for example this code replaces all occurences of ?+ in itself with ?*

blsq ) #Q(?+)(?*)r~5.-#q5 5?+ 25 

Usage:

$ echo "1" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' hs fi sp "-<" j +. /\ "Q#ir" -~ HS 2Q#ir $ echo "0" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 

Burlesque, 40 bytes

ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 

Explanation:

Burlesque has advanced stack and code manipulation built-ins. In fact, you can't access the source code of the program but you can access the remaining code that is to be executed in the future. This means #Q will return all the code that follows it which is why we have to add everything up to #Q to that code which is what we're doing with ri#Q.

blsq ) #Q1 2++ 12 -- this is the result of 1 2++ {1 2 ++} -- this is the result of #Q 

++1 2 is technically illegal code since it's stack based. But we can manipulate the code to make it execute as 1 2++:

blsq ) #Q<-#q++1 2 12 

Working with these built-ins is incredibly tricky and nobody has yet used them for anything productive except for quine related things. If you reverse ++1 2 you get 2 1++ which would produce 21 and not 12. The reason the code above produces 12 is because #Q also includes the <- so in the end we end up executing a lot more than just 2 1++ :p. We end up executing 2 1++#q<- which produces 12.

Usage:

$ echo "1" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' hs fi sp "-<" j +. /\ "Q#ir" -~ HS 2Q#ir $ echo "0" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 

Burlesque, 40 bytes

ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 

Explanation:

Burlesque has advanced stack and code manipulation built-ins. In fact, you can't access the source code of the program but you can access the remaining code that is to be executed in the future. This means #Q will return all the code that follows it which is why we have to add everything up to #Q to that code which is what we're doing with ri#Q.

blsq ) #Q1 2++ 12 -- this is the result of 1 2++ {1 2 ++} -- this is the result of #Q 

++1 2 is technically illegal code since it's stack based. But we can manipulate the code to make it execute as 1 2++:

blsq ) #Q<-#q++1 2 12 

Working with these built-ins is incredibly tricky and nobody has yet used them for anything productive except for quine related things. If you reverse ++1 2 you get 2 1++ which would produce 21 and not 12. The reason the code above produces 12 is because #Q also includes the <- so in the end we end up executing a lot more than just 2 1++ :p. We end up executing 2 1++#q<- which produces 12.

We can actually replace things in our code for example this code replaces all occurences of ?+ in itself with ?*

blsq ) #Q(?+)(?*)r~5.-#q5 5?+ 25 

Usage:

$ echo "1" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' hs fi sp "-<" j +. /\ "Q#ir" -~ HS 2Q#ir $ echo "0" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 
Source Link
mroman
  • 1.5k
  • 8
  • 17

Burlesque, 40 bytes

ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh 

Explanation:

Burlesque has advanced stack and code manipulation built-ins. In fact, you can't access the source code of the program but you can access the remaining code that is to be executed in the future. This means #Q will return all the code that follows it which is why we have to add everything up to #Q to that code which is what we're doing with ri#Q.

blsq ) #Q1 2++ 12 -- this is the result of 1 2++ {1 2 ++} -- this is the result of #Q 

++1 2 is technically illegal code since it's stack based. But we can manipulate the code to make it execute as 1 2++:

blsq ) #Q<-#q++1 2 12 

Working with these built-ins is incredibly tricky and nobody has yet used them for anything productive except for quine related things. If you reverse ++1 2 you get 2 1++ which would produce 21 and not 12. The reason the code above produces 12 is because #Q also includes the <- so in the end we end up executing a lot more than just 2 1++ :p. We end up executing 2 1++#q<- which produces 12.

Usage:

$ echo "1" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' hs fi sp "-<" j +. /\ "Q#ir" -~ HS 2Q#ir $ echo "0" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh' ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh