Skip to content

Instantly share code, notes, and snippets.

@tmathmeyer
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmathmeyer/8ffb08a6cd95d8915ad1 to your computer and use it in GitHub Desktop.
Save tmathmeyer/8ffb08a6cd95d8915ad1 to your computer and use it in GitHub Desktop.

#Language

/* declaring a value */
single = (1)
double = (2, 17)
triple = (10, 33, 2)


/* doing some math */
sum = (1 + 2) /* same as 'sum = (3)' */
prod = (1 * 2 * 3)
mixed = (1 * 2 + 3 * 4 + 5) /* ^ evaluated in reverse order, same as 'sum = (29)' */
parens = ((2 * 3) + (4 * 5)) /* evaluates as (26)


/* declaring a function */
func:add(a, b)(a + b)
func:split(a, b)((a * b), (a + b))
/* you can also have newlines */
func:stt(a, b, c, d, e, f)
     ((a + b), (c + d), (e + f))
/* there are regretably no anonymouse functions */


/* calling functions */
A = @add(1, 1) /* 2 */
B = @add(2, 2) /* 4 */
C = @add(3, 3) /* 6 */
D = @add(4, 4) /* 8 */
E = @add(5, 5) /* 10 */
F = @add(6, 6) /* 12 */
/* (6, 14, 22) */
result = @stt(A, B, C, D, E, F, G)

#todo

  • conditionals
  • operations on tuples

#Use In Minecraft #####may use non-implemented language constructs

/* define the on-update function (no params) */

func:update()
    (@if(@anyside, (@write(5, 15)), (@write(5 0))))

func:anyside()
    (@read(1) | @read(2) | @read(3) | @read(4))

/*
 * read(x) reads from side x:
 *     north = 1, east = 2, south = 3, west = 4, top = 5, bottom = 0
 *
 * write(x, y) writes powerlevel y to side x
 *
 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment