Skip to content
Sign upLog in
← Back to Community
The L Programming Language
Profile icon
theangryepicbanana

The L Programming Language

This is a programming language that I made as my final project for my CS class this past year (for those of you who are curious, I got a 98% on it). It ended up turning out much better than I had expected, so I thought it'd be cool to share it here on Repl Talk.

What is L?

L is an array-oriented programming language made for performing complex operations on large sets of data. It is inspired by languages of the same category such as R, Julia, and J (which was my main inspiration).

While it appears to be an abstract mess of symbols at first, the conciseness of using symbolic operators as opposed to named functions allows you to do more by doing less.

About J

J was my main inspiration for L. I had found J a few months ago after doing some stuff for the APL language mode here on repl.it, mainly because J is highly influenced by APL (minus its Unicode character set).

The core concept in both languages is that you can create new functions by composing existing functions, all of which can either be a unary operator (monadic; takes one value) or a binary operator (dyadic; takes 2 values). While L does not allow you to compose functions (that would have taken way more work and I didn’t have time for that anyways), it does have the monadic and dyad operator features.

Another core concept is that when you perform operations on an array of values, the operation is performed on each value of the array. For example, doing 1 2 3 + 1 will give you 2 3 4 as a result. If you perform a binary operation on 2 arrays of the same length, it will perform the operation on each element of the arrays in parallel. For example, doing 1 2 3 + 4 5 6 will give you 5 7 9.

If I had more time…

If I had more time to work on this, I would have added things like:

  • More mathematical operators (log, trig, etc).
  • More statistical operators (min, max, average, etc).
  • More operators in general.
  • “Boxed” sets (that don’t perform operations on every value it has).
  • “Flat” sets (opposite of above but one level deeper (if that makes sense)).
  • User-defined functions/operators.
  • “Lazy” expressions that can be assigned to variables and aren’t evaluated until they’re referenced/used.
  • Better documentation.

Documentation

Because the original documentation for my project is super long (too long for a Repl Talk post), I've included it in the repl files as a PDF (file name is Docs.pdf).

Examples

Factorial

num: 5 {* (1..num)

Filter numbers between (min, max]

range: 1..10 min: 2 max: 8 range ?> min ?<= max

Prime number checker

num: 17 #(num / (2..num-1) % 1 ?= 0) = 0

Future thoughts

Might try adding more features to this in the future like user-defined functions or something. Also might try rewriting this in Rust since it'd have less boilerplate than doing it like this in C++

Voters
Profile icon
sobakarooted
Profile icon
SonicCoder
Profile icon
firefish
Profile icon
Coolkelman
Profile icon
Nanowrimoijk
Profile icon
xxpertHacker
Profile icon
snowboardsheep
Profile icon
TheForArkLD
Profile icon
DarshanRajpara1
Profile icon
SwaroopBappanad
Comments
hotnewtop
Profile icon
Coder100

Nice lol
now we need L++ and L#

Profile icon
xxpertHacker
Profile icon
Codemonkey51
Profile icon
Crcoli7307
Profile icon
Coder100
Profile icon
CodeLongAndPros

@Coder100

now we need L++ and L#

You mean L++ and L++++?

Profile icon
Coder100
Profile icon
TheForArkLD

@Coder100
A Few Months Later...

now we need LF***

Profile icon
Acronymical

@Coder100
also Objective L

Profile icon
DaCuteRaccoon

@Coder100
And Blazor L#!

Profile icon
DaCuteRaccoon

@CodeLongAndPros
You don't get increments. A number can be incremented in coding by appending ++ to the variable. For example, look at this JS: var o = 7; i++;. The variable 'i' will be 8. C++ is like the 'incremented version of C,' which explains why C++ is harder and better than C.

Profile icon
Coder100
  1. necropost
  2. looks like you missed the point
  3. no c++ sucks it is not better

@DaCuteRaccoon

Profile icon
flafflar

εικόνα
Mind blown

But anyway, really cool language! If it had all those missing features I might consider actually using it

Profile icon
DynamicSquid

You had to create your own programming language for CS class? Damn...

Wait, does your CS class teach C++?

Profile icon
theangryepicbanana

@DynamicSquid
I choose to make a programming language (because we weren't allowed to make a game), but yeah the class is C++

Profile icon
DynamicSquid

@theangryepicbanana
Oh cool! And was this the best project in the class?

Profile icon
theangryepicbanana

@DynamicSquid
Not sure (because the teacher didn't announce anything like that), but it was most likely one of the best

Profile icon
TheForArkLD

Like J?

Cool!

I like APL’s friend language

Profile icon
theangryepicbanana

@TheForArkLD
Thanks!

Profile icon
TheForArkLD
Profile icon
HackermonDev

Is there any reason it is called L?

Profile icon
theangryepicbanana

@PDanielY
Yep! J and K are existing languages that are similar the language, so I chose L because it comes after K

Profile icon
Jakman

You C++ chads are always out with some cool stuff. Nice.

Profile icon
studentAlfredAl

It seems like everyone is making their own coding language now 😂
Anyways, good job! Keep it up :)

Profile icon
[deleted]

Sense your a moderator, I have a question for you.

Profile icon
theangryepicbanana

@FunnyLamma
Sure! What's the question?

Profile icon
[deleted]

Can you report someone for copying someone elses code and then posting it saying they coded it?

Profile icon
theangryepicbanana

@FunnyLamma
Yes you can (and you always should!)

Profile icon
[deleted]

@theangryepicbanana
, okay, Thanks!

Profile icon
[deleted]

https://repl.it/talk/share/Your-Mental-AgeFOUND-OUT/38545, i found this, this person copied code from

@KobeFF

Profile icon
theangryepicbanana

@FunnyLamma
It's been taken care of. Thanks!

Profile icon
ChezCoder

@theangryepicbanana
hi, i have been longing to talk to a mod ever since I got a moderator warn for something I didn't do :(. So basically, this guy created a bunch of posts on multiple boards with a very inappropriate title and very inappropriate content. I mentioned a moderator to get it removed fast because the report function took forever. I actually mentioned the moderators on all the posts this guy made. But the thing is, the notifications made it look like I made the post and since I mentioned them on posts with the same name, it looked like I was spamming them. Then, because it looked like the post was mine, it looked like I was swearing. And guess what happened? I got warned for swearing and spamming. :/

Profile icon
theangryepicbanana

@ChezCoder
Thanks for bringing this to my attention. Have you communicated with the moderators on the Repl.it Discord server about this yet? I wasn't aware of this when it happened, so I can't really determine what did/didn't happen, but the other moderators on the server will probably be more helpful than I can be right now.

Profile icon
[deleted]

@ChezCoder
,I had something similar happen to me on another website, it was awful.

Profile icon
ChezCoder

@theangryepicbanana
yes, I direct messaged Vandesm (im scared of pinging mods now xD) and he said that he had no power to lift the warning and I tried creating a ticket with them but I got no response :(

Profile icon
theangryepicbanana

@ChezCoder
Message the "Hoot Boot" bot if you'd like to contact the mods privately then :)

Profile icon
ChezCoder

@theangryepicbanana
yeah thats what i did :(

Profile icon
theangryepicbanana

@ChezCoder
How long ago?

Profile icon
ChezCoder

@theangryepicbanana
like 2-3 days ago. They never replied since :(

Profile icon
theangryepicbanana

@ChezCoder
Hmm that's odd. Try doing it again, and I'll make sure that someone replies to it

Profile icon
ChezCoder

@theangryepicbanana
thank you :D

Profile icon
ChezCoder

@theangryepicbanana
also very good language! I might use it to do the next #weekly xD

Profile icon
theangryepicbanana

@ChezCoder
No problem, and I'm glad you like my language :)

Profile icon
ChezCoder
Profile icon
[deleted]

@CSharpIsGud

look, an actual quality post

Profile icon
[deleted]

@roylatgnail
yeah, doesn't happen often

Profile icon
[deleted]

@roylatgnail
and look, 5 upvotes
vs. 54 for a bunch of functions and classes

Profile icon
xxpertHacker

@sugarfi
When you post an entire language, to get 10 cycles, then someone else posts that we need to stop praising cycles and gets over 50.

Profile icon
[deleted]

@StudentFires
I got that post locked so I can't get cycles from it.

Profile icon
Jakman

The virus I am making in your language is nearly complete

Profile icon
theangryepicbanana

@Jakman
nice

Profile icon
Jakman

@theangryepicbanana
it turns out that the array oriented rules work well with destruction.

Profile icon
theangryepicbanana
Profile icon
AmazingMech2418

I'm currently thinking about making a pi approximator in your programming language, but it seems like this repl only contains a REPL for L, not a full interpreter/compiler. So, how would I read a program from a file and run it in L? Do you have a file reading system somewhere in this repl or another repl or would I have to create my own?

Profile icon
theangryepicbanana

@AmazingMech2418
L had meant to be more of an interactive language, so I didn't really think about running files. You could probably (for now, as I don't have time right now to add this myself) pipe input into the running program (using whatever language you want) so that you can put multiple lines in at a time (I'll also note that you can have multiple expressions on 1 line). If you were to give me a bit, I could probably make a solution myself.

Profile icon
AmazingMech2418

@theangryepicbanana
I just set up the system for reading the files.

Profile icon
AmazingMech2418

@theangryepicbanana
Looking at the docs, it doesn't seem like L natively supports either loops or functions. How could I possibly add loops and possibly functions to L? The only thing I can think of is creating a secondary compiler with loop unrolling that compiles into L and then runs with the unrolled loops, but I don't know if Repl.it could support that (the pi approximation algorithm needs 150,000 iterations).

Profile icon
theangryepicbanana

@AmazingMech2418
L does not have loops (or functions), but ranges and list comprehensions should be decent substitutes. Think about how it was done in APL

Profile icon
AmazingMech2418

@theangryepicbanana
I did it in APL with recursion...

Profile icon
TheForArkLD

i know these language

  • DefLang
  • L
  • K
Profile icon
DarshanRajpara1

I've been wanting to make a programming language for a long time now, but could never seem to be able to find any good tutorials. Can you teach me?

Profile icon
theangryepicbanana

@DarshanRajpara1
I would highly recommend craftinginterpreters and MAL :)

Profile icon
DarshanRajpara1

@theangryepicbanana
ok ill look at it

Profile icon
glitchish

[Mostly] Everyone is making a working programming language XD!
Oh, you know what? Next thing you know L is going to be a programming language on repl! Oh, just imagine that though LOL!

Profile icon
rediar

Cool, but what kind of name is L?

Profile icon
theangryepicbanana

@rediar
J and K are existing languages that helped to inspire L and L comes after J and K in the alphabet

Profile icon
MesyetiIsTaken

Cool, but what kind of name is [email protected]

Profile icon
rediar

@MesyetiIsTaken
a bad one. Must be a minor language. Never heard of c or cpp or CSharp or anything, so obviously bad language.

Profile icon
MesyetiIsTaken