Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: Conlang Proglangs

From:Nokta Kanto <red5_2@...>
Date:Friday, April 11, 2003, 21:24
I think that a programming language in Harpelan would be distinguished by
the unusual way it doesn't deal with time, combined with the way Harpelan
readers are not used to reading sequentially. It's hard to understand how
many times and in what order their code executes.

Their mathematical operators are a little different from ours. They don't
have separate addition/subtraction and multiplication/division operators.

They would write 3 * 5 * 7 / 2 * 4 * 8 like this:
   <3 5 7>/<2 4 8>

And one-tenth like this:
   /10

Assignment would be undertaken by the update operator. For numbers, its
function is understandable (except maybe for the ! operator, which I will
explain):

!3 -> x;

The operator also works on functions. This sends the input straight to the
output, until there's no input left:

read<> -> write;

This reads from the input and appends to a list named "list", until
there's no input left:

read<> -> list.append;

That seems good enough, but there's a catch: The -> operator will evaluate
until its left side stops producing a result. If you write 3 -> x and
forget the !, then the program will write 3 to x forever (or at least
until 3 becomes nothing). The ! unify operator ensures that it's only done
once.

There's also a short-circuit update operator => which exits if its right
side doesn't produce a result.

I wrote a sieve of eratosthenes function to demonstrate:

void func<> sieve
{
  [int] list;   // list of primes
  int candidate;  // number to test for primeness
  @ ![2] -> list;  // start with the first prime
  @ !3 -> candidate;  // start testing with 3

  walk list =>   // test each prime in the list
                                // inline function: return void if this
number
    // is a multiple of a known prime
    int func<smaller_prime>{if candidate % smaller_prime -- candidate --
void}
    -> list.append;  // if it passed all the tests, add it to
the list
}

These primitives make for a very communication-oriented program flow...
hm...