Share your repls and programming experiences

← Back to all posts
4 languages that can kill themselves
DynamicSquid

4 files, each with a different language. Each file will call the next file, and then commit die. Like this:

Basically how this works is each file calls 2 shell commands, one to run the next file, and one to commit toaster bath. The bash command to commit skydiving without a parachute is rm FILE_NAME.

I also added brief comments on how the shell commands work in each language so you might learn something.

I'm just bored.

Voters
nathanmachane
SilvermoonCat
JWZ6
OldWizard209
LennyPhoenix
ch1ck3n
Squirrel777
ninja2k11
JasonLiu19
ike_fite
Comments
hotnewtop
JWZ6

noice

OldWizard209
DynamicSquid
OldWizard209

=D I suck at making memes @DynamicSquid

ike_fite

I've thought of doing this before. You just have to make sure you commit a snapshot before the program commits. @DynamicSquid

DynamicSquid
JohnsonAndrew

This is the kind of useless nonsense we need more of!

DynamicSquid
LAMAQDAHODWALA
DynamicSquid

@LAMAQDAHODWALA lol! nice one :)

[deleted]

Are you available to help me with something? @DynamicSquid

DynamicSquid

@MohammedBalsara sure what's up?

[deleted]

Can you help me make a language? @DynamicSquid

DynamicSquid

@MohammedBalsara oh, sorry no. I'm really busy myself. I can point you to the right direction though

[deleted]

alr, tell me more. @DynamicSquid

DynamicSquid

@MohammedBalsara Okay, try to make a lexer first. A lexer takes in a string input, and turns that into a list of "tokens". A token is a class which has a type, and the actual token.

For example:

(you do python right?)

A token might look like this:

Right now, you can start small and only focus on arithmetic operations. You want your code to take in input like:

And print this:

[deleted]

alr thanks @DynamicSquid

archie426

very much a c way of doing things but ok

elizurfk

I can't do it for me it says

clang++-7 -pthread -std=c++17 -o main
clang: error: no input files
conpiler exit status 1

see I can't do it

DynamicSquid

@elizurfk thats not how you compile using clang

DynamicSquid

@elizurfk clang++ -o main main.cpp

elizurfk

@DynamicSquid I just can't do it it says what I said in the comments

DynamicSquid

@elizurfk

You are using clang++ as your compiler, your exe file name can be whatever you want.

zplusfour

lol!

Code1Tech

At first I was so confused, but I understand now! Very cool, lol. It deleted all the files and I’m left with main.exe, not sure if that’s was supposed to be deleted.

DynamicSquid

@Code1Tech hmm... I heard another person talking about that too. I've been noticing recently that repl.it keeps the binary files, maybe part of a new update...

SeamusDonahue

so basically the file opens a new file then commits lego step..... truly the best use of technology what a genius

DynamicSquid

@SeamusDonahue thank you!!

RahulChoubey1

@SeamusDonahue Lego step! How did I forget‽

SwaroopBappanad

Dynamic Squid: Creates repl that commits sudoku
Literally everyone: SMASHES UPVOTE

DynamicSquid
SwaroopBappanad

@DynamicSquid all jokes aside, its a pretty good project

DynamicSquid

@SwaroopBappanad oh thank you!!

iocoder

i fell like this could be a movie called "Self Destruct" where one thing causes itself and another things to explode etc...

DynamicSquid

@ridark lol!

iocoder

btw this is incredible nonsense, it epic @DynamicSquid

gibbsfreenergy

Yo @DynamicSquid you should have been one of the languages!

DynamicSquid
gibbsfreenergy
Leroy01010

cool but errmmm...

mind:spit it out stop wasting time
me: hows squid going to take the comment
mind: tell me what the comment is
me: whts the point of this
mind: you can clearly see that it's usefull
me:ok
mind: he saw our conversation.
me:...
mind: squid said they where board when squid posted it
ME:HEY SQUID THIS WAS TOTALLY USEFUL DELETING A BUNCH OF FILES
mind: IT'S DESTROYING THE FILE!!! THE MAIN FILE!!
me: ohh!! thats why it's useful. :)
mind:so you can start a project without the main file

DynamicSquid
RahulChoubey1

There's this file simply called main and it contains this text:

DynamicSquid

@RahulChoubey1 you shouldn't really be able to see that file, repl automatically hides it

RahulChoubey1

@DynamicSquid I did see it…

[deleted]

@DynamicSquid i did too

RahulChoubey1

There's basically two types of languages: "// for comment" languages and "# for comment" languages

firefish

@RahulChoubey1 What about ** comment langs

RahulChoubey1

@firefish What are those!?

fuzzyastrocat

@RahulChoubey1 @firefish Don't forget -- for comment langs and <!-- for comment --> langs :D

RahulChoubey1

@fuzzyastrocat The latter is basically HTML and all HTML derivatives.

fuzzyastrocat

@RahulChoubey1 Still, it exists.

firefish

@fuzzyastrocat And ; langs =)

fuzzyastrocat

@firefish Ooh yeah, forgot about that

firefish

@fuzzyastrocat AND WHO COULD FOR GET THE GODLY MULTI-LINE COMMENTS

RahulChoubey1

@firefish Wow, this comment is highly active!

DynamicSquid

@fuzzyastrocat oh, I learned haskell in my comp sci class when I got bored. I learned how to loop through a string:

haskell's a very weird language...

fuzzyastrocat

@DynamicSquid map toUpper "squid" is the canonical way to do it. The goal of idiomatic Haskell code is to remove as many named variables as possible — defining uppercase_letter letter is verbose, if you really wanted to do it that way you'd do map (\letter -> toUpper letter) "squid", but (\letter -> toUpper letter) is the same as just toUpper. Yeah, coming from low-level languages Haskell probably seems weird, however it's way cleaner and if you use it enough it's the low-level languages that start to seem weird :D

DynamicSquid

@fuzzyastrocat lol yeah. like all I'm exposed to right now is int var = 5; var = 3 lol, but haskell is completely different and it should be a good experience learning it

fuzzyastrocat

@DynamicSquid smh true believers use(\var -> (\var -> [code that uses "var"] ) 3) 5

You must feel the cleanliness of the lambda calculus course through you before you prepare to do the trivial mortal task of code production, or else you will forever live in the land of anguish and never reach functional nirvana. Do that which is functional, let the bindings of imperative programming break loose, and you shall then reach inner peace with the computers.

...Or just use a bunch of random do blocks, whatevs honestly

DynamicSquid

@fuzzyastrocat lol okay I'll try

fuzzyastrocat

@DynamicSquid Most of what I said there was pretty jokey (I mean, I don't like LISP because it and the most of the people who use it are always so aloof) but there is a bit of truth to changing your whole mindset about how programming works.

firefish

@RahulChoubey1 Anything wrong with that?

RahulChoubey1

@firefish With what?

firefish

@RahulChoubey1 With it being highly active

RahulChoubey1

@firefish No, I'm just surprised!

realTronsi

You forgot nodejs ;-;

FlaminHotValdez

"commit die" "commit toaster bath" "commit skydiving without a parachute" "commit unalive" BWAHAHAHAHAHAHAHAHA

DynamicSquid
RahulChoubey1

@DynamicSquid We need more!

FlaminHotValdez

@RahulChoubey1 Yes! We need more! @DynamicSquid

KimiTian08

@maxyang MOAR COMMITZ

Orange541

How do you do this? This is fantastic and I love it!

DynamicSquid

@Orange541 you just commit unalive on each file

DungeonMaster00

bruh

DynamicSquid
adsarebbbad

dude this is awesome

DynamicSquid

@adsarebbbad thank you!!

PattanAhmed

Why only FOUR?

DynamicSquid

@PattanAhmed idk lol

PattanAhmed
RayvelArjoon

It's useless...
BUT IT'S TOO GOOD!!!!!!!!!

DynamicSquid

@RayvelArjoon lol thanks!!

Pizzaz4me

I can't stop running the program and reloading the page. Help!

DynamicSquid
Pizzaz4me

this made me learn C++ lol

[deleted]

this is amazing 😆

DynamicSquid

@DakotaCearley thank you!!

MkDeon

its makes me feel exciting

DynamicSquid

@MkDeon lol!

RahulChoubey1

Skydiving without a parachute is survivable…

RahulChoubey1

Commit toaster bath? I don't understand.

RahulChoubey1

Can't run twice.

DynamicSquid

@RahulChoubey1

no
toaster and bath = death
reload the page

BobTheTomatoPie

lit

DynamicSquid