Recurl

From Esolang
Jump to: navigation, search

Recurl is an esoteric programming language designed by User:Madk.

It is characterized by its data handling. Numbers and lists can be stored in lists, including the list itself, which can result in a list's contents being infinitely long.

Instructions

example list:
 
 A:<4,4,3,5,8>
 
 A:<4,4,3,5,A>
 is a valid list. the 4,4,3,5 pattern of data would repeat infinitely.
 
 A:<4,A,3,5,8>
 would look like 4,4,4,4,4,4,4,4,4,4,4,...
 from the opposite end, ...3,5,8,3,5,8,3,5,8

 commands:
 
 define a list
 A:<...>
 
 append to the end of a list
 A]<...>
 
 append to the beginning of a list
 A[<...>
 
 define a set as the sum of two lists
 A:<B>+<C>
 A:<5,5,6,8>+<4,4,2,3,7> would become A:<9,9,8,11,7> - numbers that don't exist in one list are treated as 0
 this can be carried on,
 A:<B>+<C>+<D>
 and parenthesis can be used to modify the order of operations, which is pure left-to-right normally
 A:<B>+<<C>+<D>>
 
 other operations
 A:<B>-<C> subtract
 A:<B>*<C> multiply
 A:<B>/<C> divide
 A:<B>%<C> modulo
 
 output a list's contents, the first 3 numbers of the sequence
 A#3
 the last 3 numbers
 A#-3
 output all of them, this would cause a crash if used on an infinitely long set
 A#0
 alternative to #, $ outputs the ASCII equivalents of the numbers to allow outputting of a string
 A$0
 
 conditional statement, only do the code in the brackets if the first number in A is >0
 A?1<...>
 inverted conditional, do the code if the sum of all numbers in A is <1
 A!0<...>
 
 loop the code in the brackets as long as the first number of A is >0
 A@1<...>
 as long as the last number of A is <1
 A&-1<...>
 
 exit loop, terminate program if not in a loop
 ~
 
 add the constant 4 to the second number of A
 A+2<4>
 
 terminate program
 =
 
 line separator: ;
 A#3;A:<4,4>;B:<A>+<B>
 
 comment: \
 A#3; \ this is a comment.

Examples

Hello, world!

A:<72,101,108,108,111,44,32,87,111,114,108,100,33>;A$0;

99 bottles of beer

bottle:<98,111,116,116,108,101>;s:<115>;
beer:<32,111,102,32,98,101,101,114>;wall:<32,111,110,32,116,104,101,32,119,97,108,108>
take:<116,97,107,101,32>;one:<111,110,101>;it:<105,116>
down:<100,111,119,110,44,32,112,97,115,115,32,105,116,32,97,114,111,117,110,100>
no:<110,111,32,109,111,114,101>;newl:<255>;num:<98>;
num@1<
  num+1<1>;num$1;bottle$0;s$0;beer$0;wall$0;num$1;bottle$0;s$0;beer$0;newl$0;
  take$0;one$0;down$0;newl$0;
  num+1<-1>;num$1;bottle$0;s$0;beer$0;wall$0;newl$0;num+1<-1>
>
num+1<1>;num$1;bottle$0;beer$0;wall$0;num$1;bottle$0;beer$0;newl$0;
take$0;it$0;down$0;newl$0;
no$0;bottle$0;s$0;beer$0;wall$0;newl$0;=;