L

From Esolang
Jump to navigation Jump to search

L is an esoteric language made by User:Phase no later than November of 2015 that only uses two accumulators.

  • l increments the first accumulator
  • L increments the second accumulator
  • w multiplies the second accumulator to the first accumulator and stores it in the first accumulator
  • \n prints the first accumulator and sets it to zero; second accumulator is not reset

Examples

Hello, world!

LLLllwllww
lwwllwwll
lwlwww
lwlwww
lwlwwlw
lwlwllwll
lwwlwll
lwlwlwwll
lwlwwlw
lwlwwllw
lwlwww
lwwllwwl
lwwllw
lwwl

FizzBuzz

Interpreters

Python 3

import sys;file=open(sys.argv[1]);a,b=0,0;
for c in file:
    if c=='l':a+=1
    if c=='L':b+=1
    if c=='w':a*=b
    if c=='\n':print(end=chr(a));a=0

Befunge

Instructions are interpreted one char at a time. You will need to devise a way of inputting the \n character, however.

0v<<     <     
 ~ $           
  ^|:-+29_$1+  
 9 $     :     
 1 9     -     
 +,9     "     
 -:g           
 :$"     "     
 _^      |:-"B"
   "     $     
   -     9     
   *     g     
         1     
         +     
         9     
         9     
         p     

Program Generator

Also written in Javascript, this function prints the L code needed to print a message, given what value of L is used. A recursive helper function L(x,l) is used to generate a message for a given number, then is used iteratively for each character in the message. l must be at least 2 for the code to work.

const L=(x,l)=>x==1?'l':(x%l?(L(x-1,l)+'l'):(L(x/l,l)+'w'));
function Lm(x,l){let o='L'.repeat(l);for(let c of x){o+=L(c.charCodeAt(),l)+'\n';}console.log(o);}

// Lm(<string>, <L value>)

Resources