We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Proce

From Esolang
Jump to navigation Jump to search

Proce (pronounced like the first syllable of the verb "process"—Brit. /prəʊs/, U.S. /prɑs/) is an esoteric programming language by Tanner Swett.

A program consists of a series of statements, delimited by line breaks. If a number sign appears anywhere within a line, the remainder of the line is ignored. The syntax for a statement is:

<line> ::= name "=" <signal>
<signal> ::= name | number | "(" <signal> ")"
    | (number "*" | "d!" | "i!" | "r!") <signal>
    | <signal> ("+" | "-") <signal>

A "name" is a sequence of letters and underscores. A "number" is a decimal literal, consisting of digits and optionally a period and/or a hyphen. Whitespace between tokens is ignored; note that the strings "d!", "i!", and "r!" are each a single token. Unary operations (including multiplication) take precedence over binary operations.

There exists a positive real number δ called the resolution. This real number is defined by the interpreter, and must be no larger than 1/44100. Each signal consists of a function taking the time t, a non-negative integer multiple of δ, and returning a real number. Executing a program consists of evaluating all signals mentioned in the program at 0, then at δ, then at 2δ, and so on.

The signals are defined as follows:

  • (x * f)(t) = x * f(t)
  • (d!f)(t) = (f(t) - f(t-δ))/δ
  • (i!f)(t) = (i!f)(t-δ) + f(t)*δ
  • (r!f)(t) = f(t) (if f(t) > 0), 0 (otherwise)
  • (f+g)(t) = f(t) + g(t)
  • (f-g)(t) = f(t) - g(t)

A numeric literal represents a constant signal. A named signal is equal to 0 at all non-positive values of t, and for all positive integers n, the signal at t = is equal to the right-hand side of its definition, evaluated at t = (n-1)δ. However, slew rate is limited to 44100: the difference between a signal's value at time and its value at time (n-1)δ is clamped to the interval [-44100δ, 44100δ].

The following program defines sin as an approximation of the sine function. The approximation can be made arbitrarily good by decreasing δ:

sin = i!(1 - i!sin)

Computation in Proce may be possible, but it is not obvious how to implement it.