Keta

From Esolang
(Redirected from Ekg)
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Keta is what happens when you mix the words "Keyboard" and "Tacit" together. The language is partially inspired by the tacit execution of Jelly, after I decided that the tutorial for Jelly was just too complicated. As I sometimes say: if you don't understand it, make your own!

It's a big ol' work in progress thus far, so I'll place some examples here:

Operators shown here are purely for design experimentation and may not reflect the final system of operators

Terminology

Nilad -> A function that doesn't take any inputs. Usually a constant
Single -> A function that only takes a single input
Infix -> A function that takes two arguments: left and right

Left argument -> the expression to the left of a function
Right argument -> the expression to the right of a function

Flow -> A complete line of blocks
Block -> A series of Nilads, Singles and Infixes

Examples

Make me a square!

Keg got 11 bytes on this challenge.

P[DD+s]S3

Expands to:

Shape(Palindromise(Add(Double(Double(input)), Space)), 3)

9 bytes (Keta) vs 11 bytes (Keg) .

Output Distinct Factor Cubiods

Keg didn't participate in this challenge

*R=
F?f^

Pseudo:

function f
    reduce the input via multiplication
    return that result equal to the input
function main
    generate factors of input
    filter list by above flow (f)

Swap good and bad

Keg got 7 bytes on this challenge (first place btw)

-"....

Note that this uses a reverse token flag. But that's what the keg answer does.

6 bytes (Keta) vs 7 bytes (Keg).

N(e(s(t))) a string

Keg got 12 bytes

M\(+\)*!

ININIM
Add(Map(input, "("), Times(")", length(input)))
   

`--mapoffbyone` 8 bytes (Keta) vs 12 bytes (Keg)

DDoouubbllee SSppeeaakk

Keg got 3 bytes

i

Expands to:

interleave(input, input)

1 byte (Keta) vs 3 bytes (Keg)

Chain Rules

This is a list of how patterns are evaluated within Keta (ekg)

Nilads: N n Ñ –> Nilads

Singles: S s Š –> Monads


Infixes: I i Ī –> Dyads

L L* L& –> Left argument – implicit/whatever is to the left

R R* R& –> Right argument – implicit/whatever is to the right

{...} means that the expressions are blocked together

  • ND -> N I R
  • SN -> S(N)
  • Ss -> S(s(R))
  • SI -> S(R) I R*
  • IN -> L I S
  • IS -> L I S(R*)
  • Ii -> {L I R} i R*
  • SNI -> S(N) I R
  • SsN -> S(s(N))
  • SsŠ -> S(s(Š(R)))
  • SsI -> S(s(R)) I R*
  • SIN -> S(R) I N
  • SIs -> S(R) I s(R*)
  • SIi -> S(R) I {L* i R*}
  • INi -> {L I N} i R*
  • ISN -> L I S(N)
  • ISs -> L I S(s(R*))
  • ISi -> {L D S(R*)} i R&
  • IiN -> {L I R} i N
  • IiS -> {L I R} i S(R*)
  • IiĪ -> {{L I R} i R*} Ī R&

Blocks are evaluated using the triplet rules if possible, otherwise the pair rules are used, otherwise things are evaluated as is

External References

Github Repo

Very WIP Reference List

Command | Description | Arity | Left | Right | Pythonish Representation
( ): NOP | NA | NA | NA
(!): Length of right argument | 1 | NA | Iterable | length(right)
   : Factorial of right argument | 1 | NA | Number | factorial(right)
("): Start/close string | 0 | NA | NA | NA
(#): Comment | NA | NA | NA | NA
($): Sort the right argument | 1 | NA | Iterable | sorted(right)
(%): Moduluo of left and right | 2 | Number | Number | left % right
   : Formats a string | 2 | String | String | left.format(right)
(&): Logical and | 2 | Any | Any | left && right
('): Delimit a variable name
((): Start a list | NA | NA | NA | NA
()): End a list | NA | NA | NA | NA
(*): Multiply left and right | 2 | Number | Number | left * right
   : Repeat left by right times | 2 | Iterable | Number | left * right
   : Product of iterables | 2 | Iterable | Iterable | list(itertools.product(left, right))
(+): Add left and right | 2 | Number | Number | left + right
   : Add left and right | 2 | String | String | left + right
   : Append right to left | 2 | List | Any | left.append(right)
(,): Separate list items | 0 | NA | NA | NA
(-): Subtraction | 2 | Number | Number | left - right
(.): Special constants | 0 | NA | NA | NA
(/): Divison | 2 | Number | Number | left / right
(0): Number
(1): Number
(2): Number
(3): Number
(4): Number
(5): Number
(6): Number
(7): Number
(8): Number
(9): Number
(:): Double the input | 1 | NA | Any | [right, right]
(;): Decrement | 1 | NA | Any | right - 1
(<): Less than | 2 | Any | Any | left < right
(=): Equality | 2 | Any | Any | left == right
(>): Greater than | 2 | Any | Any | left > right
(?): Input, eval'd | 0 | NA | NA | keta_eval(input())
(@): String ender
(A): Absolute value | 1 | NA | Number | abs(right)
(B): Binary to base 10 | 1 | NA | Number | int(2, right)
(C): Ceiling | 1 | NA | Number | math.ceil(right)
(D): Double | 1 | NA | Number | right * 2
(E): Eval | 1 | NA | String | keta_eval(right)
(F): Factorise | 1 | NA | Number | find_factors(right)
(G): Genrate range from 0 to right (inclusive) | 1 | NA | Number | range(0, right + 1)
(H): Halve | 1 | NA | Number | right / 2
(I): If statement | 2* | Expression | Block | if(expression, blocks)
(J): Join x by y | 2 | Iterable | String | right.join(left)
(K): Constant library | 1 | NA | Character | constants[right]
(L): List range | 2 | Number | Number | range(left, right + 1)
(M): Map function to iterable | 2 | Iterable | Block | map(right, left)
(N): Negate | 1 | NA | Number | right * -1
(O): One-dimensionify a list (flatten) | 1 | NA | Iterable | [item for sublist in l for item in sublist]
(P): Permutation | 2 | Iterable | Number | itertools.permutations(left, right)
(Q): Quit/terminate program | 0 | NA | NA | exit()
(R): Reduce by block | 2 | Iterable | Block | functools.reduce(right, left)
(S): Square | 2 | Iterable | Number | textwrap.wrap(left, right)
(T): Top of stack | 1 | NA | Iterable | right[0]
(U): Uniquify | 1 | NA | Iterable | unique(right)
(V): Variable set | 2 | String | Any | left = right
(W): While loop | 2 | Expression | Block | While(left, right)
(X): Exclude/remove items | 2 | Iterable | Any | list(filter((right).__ne__, left))
(Y): Loop variable
(Z): Zip | 2 | Iterable | Iterable | zip(left, right)
([): Start a block
(\): Escape the next character
(]): End a block
(^): Exponate
(_): Truthify
(`): String ender
(a): all | 1 | NA | Iterable | all(right)
(b): binary representation | 1 | NA | Any | bin(right)
(c): contains | 2 | Iterable | Any | right in left
(d): divmod | 2 | Number | Number | divmod(left, right)
(e): exec | 1 | NA | String | keta_exec(right)
(f): filter | 2 | Iterable | Block | keta_fitler(left, right)
(g): generate exclusive range | 1 | NA | Number | range(0, right)
(h): hack/stride | 2 | Iterable | Iterable(Number, Number) | left[right[0]:right[1]]
(i): loop variable 
(j): loop variable
(k): loop variable
(l): Lookup/index | 2 | Iterable | Any | left.index(right)
(m): maximum | 2 | Any | Any | max(left, right)
(n): newline | 0 | NA | NA | NA
(o): or | 2 | Any | Any | left or right
(p): print | 1 | NA | Any | print(right)
(q): quoted | 1 | NA | Any | str(right)
(r): repeat | 2 | Number | Block | repeat(right, left)
(s): shape | 2 | Iterable | Number | shape(left, right)
(t): tail of stack | 1 | NA | Iterable | right[-1]
(u): uniquified sorted | 1 | NA | Iterable | sorted(uniquified(right))
(v): variable get | 1 | NA | String | variable_name
(w): wrap | 2 | Iterable | Number | left[::right]
(x): index | 2 | Iterable | Number | left[right]
(y): loop variable
(z): z(s)leep | 1 | NA | Number | time.sleep(right)
({): Start a block
(|): Seperate items
(}): End a block
(~): Random number