The L Programming Language

# 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.

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++

You are viewing a single comment. View All
FunnyLamma (80)

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

FunnyLamma (80)

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

theangryepicbanana (1524)

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

theangryepicbanana (1524)

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

ChezCoder (1172)

@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. :/

theangryepicbanana (1524)

@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.

FunnyLamma (80)

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

ChezCoder (1172)

@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 :(

theangryepicbanana (1524)

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

ChezCoder (1172)

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

theangryepicbanana (1524)

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

ChezCoder (1172)

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

theangryepicbanana (1524)

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