J-why

From Esolang
Jump to navigation Jump to search

J-why, orginated from sentence Just why, is an esoteric functional program idea which is meant to be as stupid, hard and annoying to program as possible, yet still keeping possibility of actually doing programs with it, first concepted by user:Jabutosama. Due to many stupid rules and limitations, it is pleasant to finish actual working code.

Core Idea

J-why has strict rules, and script not following them will cause rule error, which cannot be avoided with exceptions. There is two kinds of rules, Primary and Secondary rules. It also sometimes quite unusual syntax.

Primary rules are always used with all programs all times. User must define secondary rules, from one of the three different possibilities. Not selecting secondary rule will cause also rule error, also if selecting non-existing rule will do. This is one of the most pleasant features in J-why, due you can choose to 'what' are you 'fighting against.'

It also uses lot of unusual characters within keywords, such as CÖRÉ <> function, for example. Also unsual bracets are used, such as <>, 69, ;;, and !?. These all are used in specific functions, some share their bracets, some are unique.

Primary Rules

Primary rules are shared with all programs.

  • Integer variable which is not even is set into -1.
  • You can't do plus nor minus calculations, but multiply/divide is supported.
  • There are 3 slots for variables to be created. Some functions can however create their own read-only ones.

Secondary Rules

Secondary rules are selected with function CÖRÉ <>.

  • Yellow Rules

usually used for non-mathematical programs

    • Disables integer variables from less than 10, causing any value below this to become 10.
    • Numbers above 1000 are divided 99.
  • Tasty Rules

usually used for more complex mathematical functions, increases code needed

    • Removes multiply and power functions.
    • Adds an increment (add 1) function.
  • Foot Rules

for shorter codes, but coder needs sharp intuition

    • After variable is modified, it becomes read-only.
  • Vodka Rules

for Russian hardcore coders which can turn an old Nokia into an iPod during breakfast break

    • limitless variable slots
    • supports plus, minus, multiply and divide calculations
    • newlines are illegal
    • instead of space you use Д (Cyrillic letter D)
    • each third letter is removed in executing process

Programming with J-why

As J-why is functional language, it always starts with main-function, which is formed by:

>mäin(){};-

Function to make function is so made with >. Syntax is

> name(args){code}

Yes, J-why does care about spaces and tabs. They may cause syntax error. Newlines are still supported (except in the infamous Vodka Rules). The ;- are always used to separate functions and code. Important thing to remember is that you must define that so-called secondary rules.

>mäin(){CÖRÉ<yellow>;-};-

Next we print that classic hello world. As pSCR function does only print variable values, we must also define a variable whose value is string "Hello world!".

>mäin(){
CÖRÉ<yellow>;-
mEmbAr/variable/str/hello world;-
pSCR(variable);-
}

Now we have a program which prints "Hello World!".

There is also example cat.

>mäin(){
CÖRÉ<yellow>;-
mEmbAr/variable/str/ ;-
INs3:variable::type text here:;-
pSCR(variable);-
}

Light 99 beers in the wall wich only says <number of beers> and "beer"

>mäin(){
CÖRÉ<yellow>;-
0 AAND 1 AAND 2 AAND 3 AAND 4 AAND 5 AAND 6 AAND 7 AAND 8 AAND 9 AAND 10 AAND 11 AAND 12 AAND 13 AAND 14 AAND 15 AAND 16 AAND 17 AAND 18 AAND 19 AAND 20 AAND 21 AAND 22 AAND 23 AAND 24 AAND 25 AAND 26 AAND 27 AAND 28 AAND 29 AAND 30 AAND 31 AAND 32 AAND 33 AAND 34 AAND 35 AAND 36 AAND 37 AAND 38 AAND 39 AAND 40 AAND 41 AAND 42 AAND 43 AAND 44 AAND 45 AAND 46 AAND 47 AAND 48 AAND 49 AAND 50 AAND 51 AAND 52 AAND 53 AAND 54 AAND 55 AAND 56 AAND 57 AAND 58 AAND 59 AAND 60 AAND 61 AAND 62 AAND 63 AAND 64 AAND 65 AAND 66 AAND 67 AAND 68 AAND 69 AAND 70 AAND 71 AAND 72 AAND 73 AAND 74 AAND 75 AAND 76 AAND 77 AAND 78 AAND 79 AAND 80 AAND 81 AAND 82 AAND 83 AAND 84 AAND 85 AAND 86 AAND 87 AAND 88 AAND 89 AAND 90 AAND 91 AAND 92 AAND 93 AAND 94 AAND 95 AAND 96 AAND 97 AAND 98 AAND 99 <- naturenwissenshaftenfunction;-
mEmbAr/beer/str/beer;-
ureally]do
}
>do(){
prSCR(RWA)
prSCR(beer)
}

If you think you can do something out of J-why, here is some functions.

Command Action Notes
>name(args){code} creates a base function. Main function is called at beginning of program. if there is no main program, no error is shown, but nothing will happen too.
mEmbAr/name/type/value creates variable named name, with type being either boolean, string or integer and value being stored value. All variables are global. Remember rule of only three at time can be created.
c&variable(math) changes named variable by mathematical function, in form of *2, /7 or +1. c&variable(*2) doubles variable value. Follows primary and secondary rules.
whìstlé~variable!variable2{code} tests if variable z variable2 where z is either >, <, !=, =. Repeats if true in the end. Note that > and < are reversed.
prSCR(variable) Prints value of variable. -
INS3>variable< Takes input from user input into variable. Always string.
variableis PÜRÅ type switches data type of var. String number can be changed into int, and string True and False into boolean. Anything can be turned into string. -
.function calls named function. calling function with not e and i both on it will crash program with lol error.
list <- naturenwissenshaftenfunction creates list named ureally. list objects are strings, divided with AAND's.
; comment; comment. notice the empty space after first ;
g҉!!index><>list object<><target var takes value from list object's index and sends it to target var. index error mistakenly says "syntax error".
ek͜a̷t̕ (index)<object removes index value from list object. index starts from -3 instead of 0.
ÖÖÖ/[variable/list object] appends var into list. Value is changed into string.
/ep̷ä̕y̛҉ht̀l̛//[>.<((9:: name è̵̷̢͞ ><:- creates empty list named by name. -
list object]function creates for loop which goes trough list object. Current index is stored in variable RWÅ. After each variable change function is launched. -