Rockstar Language Specification

- Replace
`is`

with`'s`

(removing the leading whitespace) `n's-`

is the shortest way to initialize a variable to one.- similarly, a string starting with any of
`,+-*/&`

can be initialized with`say`

to save one byte (`n say*`

instead of`n = "*"`

)

- similarly, a string starting with any of
- Some operators like
`+`

take multiple arguments, so you can abuse it like`s+" "i`

instead of`s+" "+i`

`turn up`

/`turn down`

to round- To get x remainder y:
`t = x/y`

,`turn down t`

,`x-t*y`

is the remainder - Where possible, using
`turn up`

to get the remainder saves 2 bytes:`t =-x/y`

,`turn up t`

,`x+t*y`

is the remainder - Or to just check for divisibility, you can use
`turn up`

instead

- To get x remainder y:
- In
`rock x with y`

, the with is unneeded,`rock x y`

works `cut`

can split by an int, like`cut "a0b0c"with 0into x`

- Steal stuff from Java:
`off java,math play BigDecimal`

`means`

to alias: e.g. you use`taking`

a lot to call a function, use`t means taking`

and then use`t`

### Rounding

`x+8e15-8e15`

to round to the nearest integer`x+8e15-8e15is x`

to check if`x`

is an integer`x/y+8e15-8e15is x/y`

to check if`x`

is divisible by`y`

(see another way in the next section)

### String operators

`s/1`

or`s-0`

to cast the string`s`

to a number`s--n`

to cast`s`

and add`n`

`s*n`

rounds`n`

down before multiplying, i.e.`"a"*2.7`

is equal to`"aa"`

`x/y*"a"`

is truthy if`x`

≥`y`

`x/y*"a"y's x*"a"`

to check if`x`

is divisible by`y`

(might be slow)

`x+"."is x`

is another way to check if`x`

is an integer, but is signficantly slower than using rounding`0is "0e"+x`

to check if`x`

is an integer (might be useful if`x`

is a string or if you don't want to repeat`x`

twice)`x+"0"is x`

to check if`x`

is a non-integer number (or 0)`x+"0"-x`

is truthy if`x`

is an integer number (except for 0)

`""*""`

(or`s*s`

if`s`

is a string) can be used to get the value`mysterious`

.

### Array operators

```
push x 2,3,4,5
t = x+6 (t = 2,3,4,5,6)
t = 1+x (t = 1,2,3,4,5)
t = x+x (t = 2,3,4,5,2,3,4,5)
t = x-2 (removes 2nd element: t = 2,3,5)
```

Any other arithmetic operation converts the array to its length:

```
t = 0-x (t = -4)
```

`void`

returns an empty array, you can use it to generate an array on the fly:

```
while void+2+3+5+7+11as x
say x
```

### For each

```
while v
say pop v
```

is one byte shorter than

```
while v as x
say x
```

### Into

```
t = x
cut t
```

is one byte shorter than

```
cut x into t
```

`it`

`it`

is kinda hard to use. It takes the value of the variable that was most recently assigned to. This can be used in a couple ways, most notably to take the value of `args`

at the start of the program (after the hidden boilerplate assigns it).

```
while args as r
while it as r
```

`it`

can also be used as a condition in general, even in holes with no input. `it`

will just be equivalent to an empty array at the start of the program.

```
until it
...
_ = cond
```

Try reusing your existing assignments as the condition, or doing some operation that errors out. This can be combined with using an array as a counter to avoid initialising variables altogether.

```
while 10-it
rock i 0
say i
```

A final use is checking whether an if statement or while statement executed at all, though this is harder to pull off.

```
i = 0
while cond
k = ...
say it
```