Rebmu

From Esolang
Jump to navigation Jump to search

Rebmu is an esoterical code-golf dialect of Rebol, made by HostileFork.

Overview

The underlying language is case-insensitive, so it uses CAPSalternationTOseparateTOKENS. It doesn't use JustCapitalLetterBreaks because it ascribes special meaning to INITIALcapitals—this means the first token will be the target of an assignment. This is in contrast with nonINITIALcapitals, where none of the tokens are assumed to be assignment targets.

Examples

Roman number to int converter

Here's an example program (fairly straightforward implementation, just a test) that reads a Roman Numeral string from the input and calculates the integer value:

rSfeCs[Nse[x10i1v5l50c100d500m1000]twCi~j[JnCN]Kk+elJn[alN-j N0]'jJn]k+j

Without going into too much detail, the first 6 characters are equivalent to if you had written the nine-character sequence r s fe c s. The meaning is "read string s" then "for each character c in s execute the following block of code". Every function knows its arity—so the fe knows it needs exactly three parameters (a variable, a quantity to iterate, and the block of code to execute) while r knows it needs only one. This minimizes need for parentheses and delimiters.

Use of the caps alternation (a concept I call "mushing") is purely optional. But this shows what has empirically borne out—about a 40% savings in character count. It's relatively transparent once you've absorbed the rule, a little bit like reading pig latin. :)

Merging two sorted lists

u[iG^aNXa[rvA]apGtkFaM?fA]apGscA

Un-mushed:

   u [                     ; until
       i g^ a nx a [       ; if greater? args next args
          rv a             ; reverse args
       ]                   ; (we want the block containing the next value first)
   
       ap g tk f a         ; append output take first args
       m? f a              ; empty? first args
   ]                       ; (first block is now empty)
   
   ap g sc a               ; append output second args
                           ; (add the remainder of the second)

Usage:

   >> rebmu/args [u[iG^aNXa[rvA]apGtkFaM?fA]apGscA] [[1 5 10 17 19] [2 5 9 11 13 20]] 
   == [1 2 5 5 9 10 11 13 17 19 20]
   
   >> rebmu/args [u[iG^aNXa[rvA]apGtkFaM?fA]apGscA] [[2 5 9 11 13 20] [1 5 10 17 19]] 
   == [1 2 5 5 9 10 11 13 17 19 20]

Hello World

p"Hello World"

External links