Geharrewar

From Esolang
Jump to navigation Jump to search

Stub for new language by User:Whtspc (everything will be different prob)

Exploring possibilities with no or one level nesting/ is an element a function? / stack storing of these 'functions'

 # replace all occurrences of the next element with the element thereafter  # a b a ca a -> b ca b
 > move next element to the end of the program  > a b c d -> b c d a 
 < insert latest element of program as first after this element  < a b c d -> d a b c
 : duplicate next element : a -> a a
 @ swap next element @ a b -> b a
 & stick next 2 elements to each other & a b c -> ab c
 " print next element  " hello_world!
 ! discard next element ! a b c -> b c
 ? input as next element ? a b c -> G a b c (if user presses SHIFT-g that is) 
 * unbind all commands in this element *abc def -> a b c def
 | if else   | a b c d -> (if a==b) c d (if a!==b) d
 \ unbind head of next element \ abcde fgh -> a bcde fgh
 / unbind tail of next element / abcde fgh -> abcd e fgh (not quite sure if these 2 are necessary/handy)
 
 % discard one of the two next elements random 

elements are separated by space or newline

commands are read left to right, discarding them as they are executed

commands have influence on the next element, not on the next command (except the * command)

program self acts as stack by possibility to 'store' and 'retrieve' elements at the end of the program


sample: fibonacci sequence (in asterisks seperated by slashes)

 " * " * # b >:<@>:<@ b <<@:>&:>"*"/ b * *


Next program asks for user input,

when input is 0 it prints the word Zero

when input is 1 it prints the word One

when input is different it prints the word Error

" Please_ " type_ " 0_ " or " 1_
?:>| 1 << <<@<@> !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e

By the lack of an interpreter I wrote the possible scenarios out:

When user inputs 0

:>| 0 1 << <<@<@> !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e
>| 0 0 1 << <<@<@> !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e
| 0 1 << <<@<@> !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e 0
<<@<@> !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e 0
<@<@> 0 !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e
@<@> !!!!!*"O"n"e 0 !*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2
<@<@> 2 !*"Z"e"r"o *"E"r"r"o"r !<*|0 !!!!!*"O"n"e
@<@> !!!!!*"O"n"e 2 !*"Z"e"r"o *"E"r"r"o"r !<*|0
<@> 2 !!!!!*"O"n"e !*"Z"e"r"o *"E"r"r"o"r !<*|0
@> !<*|0 2 !!!!!*"O"n"e !*"Z"e"r"o *"E"r"r"o"r 
> 2 !<*|0 !!!!!*"O"n"e !*"Z"e"r"o *"E"r"r"o"r 
!<*|0 !!!!!*"O"n"e !*"Z"e"r"o *"E"r"r"o"r 2
<*|0 !*"Z"e"r"o *"E"r"r"o"r 2
*|0 2 !*"Z"e"r"o *"E"r"r"o"r
| 0 2 !*"Z"e"r"o *"E"r"r"o"r
*"E"r"r"o"r
" E " r " r " o " r
 

displays powers of 2 in asterisks (forever)

 # b >:<@>:<@ b <:&:>"*"/ b *


Step by step (every line a new step of program above)

# b >:<@>:<@ b <:&:>" b *
>:<@>:<@ <:&:>" >:<@>:<@ *
:<@>:<@ >:<@>:<@ * <:&:>"
<@>:<@ >:<@>:<@ >:<@>:<@ * <:&:>"
@>:<@ <:&:>" >:<@>:<@ >:<@>:<@ *
>:<@ >:<@>:<@ <:&:>" >:<@>:<@ *
:<@ <:&:>" >:<@>:<@ * >:<@>:<@
<@ <:&:>" <:&:>" >:<@>:<@ * >:<@>:<@
@ >:<@>:<@ <:&:>" <:&:>" >:<@>:<@ *
<:&:>" >:<@>:<@ <:&:>" >:<@>:<@ *
:&:>" * >:<@>:<@ <:&:>" >:<@>:<@
&:>" * * >:<@>:<@ <:&:>" >:<@>:<@
:>" ** >:<@>:<@ <:&:>" >:<@>:<@
>" ** ** >:<@>:<@ <:&:>" >:<@>:<@
" ** >:<@>:<@ <:&:>" >:<@>:<@ **        --PRINT **
>:<@>:<@ <:&:>" >:<@>:<@ **        
:<@>:<@ >:<@>:<@ ** <:&:>"
<@>:<@ >:<@>:<@ >:<@>:<@ ** <:&:>"
@>:<@ <:&:>" >:<@>:<@ >:<@>:<@ **
>:<@ >:<@>:<@ <:&:>" >:<@>:<@ **
:<@ <:&:>" >:<@>:<@ ** >:<@>:<@
<@ <:&:>" <:&:>" >:<@>:<@ ** >:<@>:<@
@ >:<@>:<@ <:&:>" <:&:>" >:<@>:<@ **
<:&:>" >:<@>:<@ <:&:>" >:<@>:<@ **
:&:>" ** >:<@>:<@ <:&:>" >:<@>:<@
&:>" ** ** >:<@>:<@ <:&:>" >:<@>:<@
:>" **** >:<@>:<@ <:&:>" >:<@>:<@
>" **** **** >:<@>:<@ <:&:>" >:<@>:<@
" **** >:<@>:<@ <:&:>" >:<@>:<@ ****      --PRINT ****