Technology wise, what are some alternative methods one could use to avoid repeating if/else if statements?
Technology wise, what are some alternative methods one could use to avoid repeating if/else if statements?
Other urls found in this thread:
desuarchive.org
twitter.com
indexed/associative jump/function table
Use indirection and collapse all your cases into one indirection. You can do this in MAID-LISP:
start: ${coinFlip}
coinFlip: "heads" | "tails";
heads: "The maid flipped heads!";
tails: "The maid flipped tails!";
Bah. I forgot to put a semicolon at the end of the start d-expression.
start: ${coinFlip};
coinFlip: "heads" | "tails";
heads: "The maid flipped heads!";
tails: "The maid flipped tails!";
>The above program would generate one of the following strings at random:
>The maid loves lobster.
>It will never produce any of the following:
>The maid loves lobster.
most of the language on that page makes it look like it was written by a teenager in high school,
Pay attention to the placing of the bullet points. The strings are 2 lines long.
The string that will be generated in full is:
>The maid loves lobster.
>The maid loves squid.
The string that will never be generated is:
>The maid loves lobster.
>The maid hates squid.
It never gets generated because the function will either resolve to her loving or hating something, and never deviate after.
What do you think I could do to make the part with the generated strings more readable?
space between pairs and maybe L shape border
Switch/case
What is maid-lisp?
Mapping And Indirection Dialect of LISt Processor. It's a LISP I am working on. The maids in that page I posted came from my last thread. You can see other book pages here:
>desuarchive
desuarchive.org
I need more anime maids to finish my book though. Every page needs 3 or 4 maids.
>The future development of public domain computer science depends on contributions from Dra/g/ons like you.
This is neat, good luck on finding maids
OOP, especially CLOS style. Indexing an array. Calculating a formula.
Thanks fren. Hopefully I can find one generous Dra/g/on who likes playing science on the internet. If I could get one Dra/g/on to donate like 500 maids that would probably be enough for me to finish the book without anymore maid begging.
It would at least be enough for me to make a lot of pages without worrying about my research going maidrupt.
>his language doesn't support pattern matching
Why are you wasting your time?
do you have a repo or something?
don't pull a Winds of Winter lol
Are the user who was looking for some old LISP manual?
>do you have a repo or something
I don't have a repo yet. I want to release the first draft of my book and the first draft of the interpreter code at the same time.
I want to bundle them together like when you used to get a book and it had a floppy disk in a packet in the back. Those were the most exciting kind of book.
Everything will be released to CC0 because playing science is only fun if you publish your work.
>Are the user who was looking for some old LISP manual?
There is a chance. A while ago I needed the first version of the LISP manual so I could learn maid expressions better to write a maid expression to dragon expression translator.
There was a nice MIT who found me the book in some archive or something. Translating S&M expressions to D-expressions will be part of the first release of the interpreter because of that nice MIT.
D-expressions don't really map 1-to-1 to LISP because I wasn't trying to make a LISP when I made them up. I was trying to make a better Dada Engine.
Consequently I have a lot of grammar dedicated to non-deterministic programming and the construction of recursive transition networks.
After the interpreter and book are released I will try to make a fork of the interpreter into a self-hosting RISC-V compiler so I can make a LISP machine with it. Probably I will get an FPGA and try to make a hardware acceleration when I play that game. I will write a book about that too if I can get people to donate the maids. So far making textbooks is cool. Playing science is fun.
Should I put student exercises in my book and make an answer key too?
You realize it's written by a teenager in high school, right?
What makes the language sound highschoolery? Is there an author I should emulate to sound more sciencey?
nakadashi
Wait a few years until you grow out of this phase.
A case, a cond, et al. It's not difficult, really.
If you're trying to avoid branching in general, it's much more difficult, you have to design some core functions in a way that makes them not require branching, like for example FORTH does with exceptions.