diff --git a/site/misc/atem.org b/site/atem.org similarity index 100% rename from site/misc/atem.org rename to site/atem.org diff --git a/site/misc/css-failings.org b/site/css-failings.org similarity index 100% rename from site/misc/css-failings.org rename to site/css-failings.org diff --git a/site/misc/digital-sikring.org b/site/digital-sikring.org similarity index 100% rename from site/misc/digital-sikring.org rename to site/digital-sikring.org diff --git a/site/misc/digitalfreedom.org b/site/digitalfreedom.org similarity index 100% rename from site/misc/digitalfreedom.org rename to site/digitalfreedom.org diff --git a/site/misc/hacking.org b/site/hacking.org similarity index 100% rename from site/misc/hacking.org rename to site/hacking.org diff --git a/site/misc/licensing.org b/site/licensing.org similarity index 100% rename from site/misc/licensing.org rename to site/licensing.org diff --git a/site/misc/longpoem/frontpage.png b/site/longpoem/frontpage.png similarity index 100% rename from site/misc/longpoem/frontpage.png rename to site/longpoem/frontpage.png diff --git a/site/misc/longpoem/index.org b/site/longpoem/index.org similarity index 100% rename from site/misc/longpoem/index.org rename to site/longpoem/index.org diff --git a/site/misc/longpoem/longpoem.pdf b/site/longpoem/longpoem.pdf similarity index 100% rename from site/misc/longpoem/longpoem.pdf rename to site/longpoem/longpoem.pdf diff --git a/site/magicng/index.org b/site/magicng/index.org new file mode 100644 index 0000000..7d975b2 --- /dev/null +++ b/site/magicng/index.org @@ -0,0 +1,290 @@ +#+title: MagicNG +#&summary +The Next Generation Programming Language +#& +#+license: bysa +#&toc + +* Chapter 1: The Future of Yesterday + +/Software./ + +/Magic./ + +Two seemingly unrelated words. Yet together they form the essentials of the new +programming language which has already changed how computers and humans interact +with each other: *MagicNG* (short for Magic: The Next Generation). + +*MagicNG* is not your common programming language; it is not biased towards one + or two paradigms, in fact it uses none of the existing ways of programming: + ++ Functional programming is, naturally, much too functional for any magic-based + programming language, as magic is not /functional/, but + /magical/. Magic-based software does not require functionality as in something + being able to do something else, because it depends on magic which /does/ + stuff instead of making sure that /stuff/ can be done; this makes using a + computer much faster. ++ Object-oriented programming does not fit very well with the ideas behind + *MagicNG* either. While the magic-oriented approach /is/ able to properly + emulate object-oriented ways of doing things, such emulations will often + require {CMU&abbr='Central Magical Unit'}-expensive conversions from spell + scrolls to object-based representations. ++ Procedural programming conflicts with the nature of magic; since in the case + of magic, advanced heuristics are used run a program, the simple approach of + procedurally executing commands pales in comparison to the magical + approach. The same is true for assembly programming and machine programming. ++ Logic programming is mute. Magic is always above logic. Logic is based on + magic. Everyone knows that. ++ Declarative programming is actually the only one of the existing widespread + paradigms which is even slightly like *magical programming*. Declarative + programming languages do, however, still base their entire existence on + deduction and knowledge, both of which are infinitely long below the + standards of magical programming languages. Deduction and knowledge are for + programming languages that do not /see/ how everything works, whose authors + do not understand the connectionabilities of everything. + +In short, *MagicNG* employs the *magical programming* paradigm because it is +superior to non-magical approaches. + + +** But how do I program in it? + +The reader should now be comfortable thinking about programming in terms of +magic and be able to see what a big mistake it was to learn all those outdated, +logic-based programming languages. The reader might also be a little +overwhelmed and perhaps confused; but fear not, we will soon take a look at an +example of MagicNG programming. + +Before we get to that, we will go over a few (yes, there are many more) of the +applications of magical programming, to pique the reader's curiosity. + +1. First, there is the temporal improvement. Since magic is independent of the + flow of time, a program can be run not just everywhere, but + every{/when/}. This is the sole reason MagicNG is already so popular --- + someone spread its use many years ago, through several temporal-offset + MagicNG runs. +2. Speed. The Central Magical Unit runs programs magically many times faster + than any CPU in existence. This is possible due both to the previously + explained effects of magic in programming /and/ what we will come to refer + as "magic downleveling" in later chapters (since magic cannot be optimized, + other approaches such as the downleveling approach have been developed). +3. Code maintenance also becomes much easier, as you will see in the examples + and excercises. + +Now, to our first example. We wish to print to a computer console (on a magical +computer) the magical string "Hello, world!". This is often accomplished in +anything from 1 to 100 conventional lines in conventional programming +languages; in MagicNG, it is not /that/ simple. It's another kind of simple, +namely the /magic simple/ way, from now on referred to as the /magple/ way. + +To write the magple MagicNG code for this example, we first fire up our MagicNG +interactive interpreter: + +#+BEGIN_SRC text +MagicNG vX +? +#+END_SRC + +(MagicNG is not being developed because it relies on magic for updates, hence +the 'X' version.) + +(The correct way to program in MagicNG is to write on pergament scrolls, but +for the beginner it is often easier to write the magical expressions on one's +computer and then print afterwards.) + +The =?= at the prompt means we can type something. Let us try typing the +following: + +#+BEGIN_SRC text +? one frog eye +#+END_SRC + +What this tells the MagicNG interpreter is that if /it is not the case/ that no +frog eyes exist in the programmer's vicinity, it will print "Hello, +world!". The frog-eye detection is only a formality, included in MagicNG to +make the proofs of magical truth be magically true, and so the sentence can be +excluded if the programmer wishes so. That is, you could write + +#+BEGIN_SRC text +t +#+END_SRC + +which is short for "one frog eye", and it would have the same effects. + +MagicNG programs can be compiled (printed) to scrolls, which can then be used +independently of a running magical computer. + +(Trivia: This was in fact one of the major reasons why the text-based nature of +MagicNG was chosen over the two other proposed ways of programming: speech and +jumping. While speech had the advantage that it worked well for people who had +difficulties writing, history had shown that the human memory was not a good +place to store information not meant to be changed. And while jumping was good +for people who were only good at jumping, it was too radical an approach for +many of the language designers.) + +Now, it may not be obvious to the casual non-magician why and how both "one +frog eye" and "t" eventually prints "Hello, world!". In fact, these two +expressions are not at all the only ways to print "Hello, world!" --- one can +also write "traveller with seven legs", "spider queen", or something +similar. The thing to remember is that it is /the intention/ that counts. If +you /feel/ that the expression "bonsai of Norway" prints the sum of all +prime numbers below 4012, then /that is what it does/. + +In essence, MagicNG is an *intention-based programming language*. This might at +first sound like all other programming languages: You have an intention on +which you base your programming. The difference here is that the intention /is/ +the programming and not just part of it. Once you have figured out what you +want and written it down in your inner language, magic takes care of the boring +stuff. + +This has the side-effect that all magic is somewhat personal; a scroll written +by an individual A might yield different results if used by an individual B +with different intentions than A. + +This means that MagicNG has *built-in encryption*. + +At this point some might note that this is not good for interoperability. At +the core of MagicNG, this is true. However, one extraordinary extension has +been made to MagicNG that makes interoperability both possible and easy: +MagicIS (short for Magic Intention Serializer). + +MagicIS encodes your intention in a magical format, after which the intention +is compiled along with your program. With MagicIS, a compiled program that +prints "My name is Niels" might look like this (imagine it compiled on a +scroll): + +#+BEGIN_SRC text +Holy oak of honey +,si:pmnin34_=UUe +#+END_SRC + +where the =,si:= part denotes the start of the serialized intention. + +The MagicIS extension can be enabled on most MagicNG compilers with a +command-line option. Note that it will need to be connected to your brain with +a special magical interface to work. + + +* Chapter 2: Real World Examples + +"This is all very nice," you might think, "but what is it any good for?" + +MagicNG can be used for everything a typical, non-magical language can be used +for, the major differences being that MagicNG is per definition faster, better +and easier to program in. This has been magically proven. + +** cat + +Consider the UNIX =cat= program. If written in C (even if you look at the Plan +9 version), there are many lines of source code. If written in Python 3, there +are 2 lines: + +#+BEGIN_SRC python3 +for line in open(filename): + print(line) +#+END_SRC + +If written in MagicNG, there is _one_ line (/and/ it is magical): + +#+BEGIN_SRC text +cauldron of candy +#+END_SRC + +(without MagicIS enabled.) + + +** Finding a value when a key is known + +In a non-magical programming language, you could use a hash map. Or you could +sort the elements by their keys and use binary search. Or you could look +through every element one by one. + +In MagicNG, no such algorithms are used; /magic/ finds the value. In fact, this +reveals a large, fascinating and unavoidable part of MagicNG: it does not +support algorithms. + +"No algorithms? But how, then, can I program?" you think. The answer is simple, +and it has been explained before, but to stress it one last time: /magic/. + +This leads us to another important part of MagicNG: its use of the *black box +model*. The /black box model/ has been revered all over the known universe for +its unchangeability (it is absolute), unworsenability (since you cannot change +it, you cannot make it worse), high surprise factor ("who knew my program could +do /that/?!"), and lack of meaningful error messages (no errors, no worries). + + +** Calculating the sum of a list of numbers + +In C: + +#+BEGIN_SRC c +int sum(int xs[], int xs_len) { + int fin_sum = 0; + int i; + for (i = 0; i < xs_len; i++) { + fin_sum += xs[i]; + } + return fin_sum; +} + +[...] + +sum({1, 3, -2, 9}, 4); +#+END_SRC + +In Python: + +#+BEGIN_SRC python3 +sum([1, 3, -2, 9]) +#+END_SRC + +In MagicNG: + +#+BEGIN_SRC text +head of Macbeth +#+END_SRC + + +** A flight simulator + +Up until now, we have only looked at MagicNG programs spanning single +lines. One can create a very powerful MagicNG program in one line, but +sometimes it can be necessary to use two, or even three lines. + +As a flight operator, you may wish to have a very durable and efficient 3D +flight simulator; in MagicNG such a system can be written concisely in just +three lines of magical code (four lines with MagicIS enabled). + +#+BEGIN_SRC text +dragon claw polished with golden mead + mead in cauldron +tastebuds of 23 pigs +,si:3=)uUUn!2aa +#+END_SRC + +(Notice the indentation and the explicit number.) + + +/[Chapters 3 through 88 have been excluded in this preview. Only members of +the Magically Magical Magic Community (MMMC) have access to these chapters.]/ + + +* Chapter 89: How to Learn More + +To recap: MagicNG is an easy language to learn, since not only does it not +require the user to learn about algorithms, data structures and related wastes +of time, but actually discourages that; MagicNG encourages its users to /not +think/ which /reduces errors/. + +To expand your knowledge of MagicNG, both in theory and practice, do not look +at the examples of other MagicNG programmers, unless you are *absolutely sure* +that their intentions are the same as yours. You can of course deduce the +intention from a MagicIS line, but then, if you wish to base a new program on +the old program, you will have to convert that intention to your own along with +the actual program, which can be tedious and very difficult (MagicNG is +actually a very complex language). + +What you should do is lean back in a comfy chair and look into nothingness and +not strain your mind. That way, everything you need to know will come to you +eventually. That's how this book was written. + diff --git a/site/misc/index.org b/site/misc/index.org deleted file mode 100644 index e27d9e8..0000000 --- a/site/misc/index.org +++ /dev/null @@ -1,23 +0,0 @@ -#+title: Writings -#+summary: A list of my writings - -* Writings - -#++eval -#+BEGIN_SRC python -macros.list_pages() -#+END_SRC - -** Pseudo-writings - -+ <@eval macros.titlelink('/projects/magicng/')@> - - -** Old - -+ [[http://projects.metanohi.name/eonaton/?t=0&s=5][Eon Aton]] (both a story and an unfinished game) - - -** Purposely crappy - -+ [[./potator/][POTATORR!]] diff --git a/site/misc/myuniverse/index.org b/site/myuniverse/index.org similarity index 100% rename from site/misc/myuniverse/index.org rename to site/myuniverse/index.org diff --git a/site/misc/myuniverse/myuniverse.pdf b/site/myuniverse/myuniverse.pdf similarity index 100% rename from site/misc/myuniverse/myuniverse.pdf rename to site/myuniverse/myuniverse.pdf diff --git a/site/misc/na.org b/site/na.org similarity index 100% rename from site/misc/na.org rename to site/na.org diff --git a/site/nanonote/glorious-nanonote.jpg b/site/nanonote/glorious-nanonote.jpg new file mode 100644 index 0000000..bd8e3de Binary files /dev/null and b/site/nanonote/glorious-nanonote.jpg differ diff --git a/site/nanonote/index.org b/site/nanonote/index.org new file mode 100755 index 0000000..2a3bb48 --- /dev/null +++ b/site/nanonote/index.org @@ -0,0 +1,16 @@ +#+title: My NanoNote +#&summary +I have a NanoNote. +#& +#+license: bysa + +* My NanoNote + +#&img;url=glorious-nanonote.jpg, alt=Glorious NanoNote, center + +I own a [[http://sharism.cc/][NanoNote]]. I think it's +cool (though I haven't found much use for it yet). The default NanoNote +distro comes with an [[http://openwrt.org/][OpenWRT]]-based. It's also possible to run Debian on it +(with only 32 MiB RAM..), but it's slow. + +(Originally, this page was meant to have a purpose.) diff --git a/site/misc/number-bases.org b/site/number-bases.org similarity index 100% rename from site/misc/number-bases.org rename to site/number-bases.org diff --git a/site/misc/ordfinder/index.org b/site/ordfinder/index.org similarity index 100% rename from site/misc/ordfinder/index.org rename to site/ordfinder/index.org diff --git a/site/misc/ordfinder/sadcomputer.png b/site/ordfinder/sadcomputer.png similarity index 100% rename from site/misc/ordfinder/sadcomputer.png rename to site/ordfinder/sadcomputer.png diff --git a/site/misc/potator/img/000.jpg b/site/potator/img/000.jpg similarity index 100% rename from site/misc/potator/img/000.jpg rename to site/potator/img/000.jpg diff --git a/site/misc/potator/img/001.jpg b/site/potator/img/001.jpg similarity index 100% rename from site/misc/potator/img/001.jpg rename to site/potator/img/001.jpg diff --git a/site/misc/potator/img/002.jpg b/site/potator/img/002.jpg similarity index 100% rename from site/misc/potator/img/002.jpg rename to site/potator/img/002.jpg diff --git a/site/misc/potator/index.html b/site/potator/index.html similarity index 100% rename from site/misc/potator/index.html rename to site/potator/index.html diff --git a/site/misc/pvd/index.org b/site/pvd/index.org similarity index 100% rename from site/misc/pvd/index.org rename to site/pvd/index.org diff --git a/site/misc/pvd/p1.png b/site/pvd/p1.png similarity index 100% rename from site/misc/pvd/p1.png rename to site/pvd/p1.png diff --git a/site/misc/pvd/pvd.pdf b/site/pvd/pvd.pdf similarity index 100% rename from site/misc/pvd/pvd.pdf rename to site/pvd/pvd.pdf diff --git a/site/misc/pygame-pycairo.org b/site/pygame-pycairo.org similarity index 100% rename from site/misc/pygame-pycairo.org rename to site/pygame-pycairo.org diff --git a/site/misc/sound-programming/index.org b/site/sound-programming/index.org similarity index 100% rename from site/misc/sound-programming/index.org rename to site/sound-programming/index.org diff --git a/site/misc/sound-programming/lsystem.flac b/site/sound-programming/lsystem.flac similarity index 100% rename from site/misc/sound-programming/lsystem.flac rename to site/sound-programming/lsystem.flac diff --git a/site/misc/sound-programming/melodyexample.flac b/site/sound-programming/melodyexample.flac similarity index 100% rename from site/misc/sound-programming/melodyexample.flac rename to site/sound-programming/melodyexample.flac diff --git a/site/misc/sound-programming/more_advanced.flac b/site/sound-programming/more_advanced.flac similarity index 100% rename from site/misc/sound-programming/more_advanced.flac rename to site/sound-programming/more_advanced.flac diff --git a/site/misc/sound-programming/sound-highlight.png b/site/sound-programming/sound-highlight.png similarity index 100% rename from site/misc/sound-programming/sound-highlight.png rename to site/sound-programming/sound-highlight.png diff --git a/site/misc/sound-programming/square.flac b/site/sound-programming/square.flac similarity index 100% rename from site/misc/sound-programming/square.flac rename to site/sound-programming/square.flac diff --git a/site/misc/sound-programming/squarewave.flac b/site/sound-programming/squarewave.flac similarity index 100% rename from site/misc/sound-programming/squarewave.flac rename to site/sound-programming/squarewave.flac diff --git a/site/misc/stadig-digital-sikring.org b/site/stadig-digital-sikring.org similarity index 100% rename from site/misc/stadig-digital-sikring.org rename to site/stadig-digital-sikring.org diff --git a/site/misc/tfr/index.org b/site/tfr/index.org similarity index 100% rename from site/misc/tfr/index.org rename to site/tfr/index.org diff --git a/site/misc/tfr/p1.png b/site/tfr/p1.png similarity index 100% rename from site/misc/tfr/p1.png rename to site/tfr/p1.png diff --git a/site/misc/tfr/tfr.pdf b/site/tfr/tfr.pdf similarity index 100% rename from site/misc/tfr/tfr.pdf rename to site/tfr/tfr.pdf diff --git a/site/misc/two-spaces.org b/site/two-spaces.org similarity index 100% rename from site/misc/two-spaces.org rename to site/two-spaces.org diff --git a/site/misc/ugs/frontpage.png b/site/ugs/frontpage.png similarity index 100% rename from site/misc/ugs/frontpage.png rename to site/ugs/frontpage.png diff --git a/site/misc/ugs/index.org b/site/ugs/index.org similarity index 100% rename from site/misc/ugs/index.org rename to site/ugs/index.org diff --git a/site/misc/ugs/unnamed-good-story.pdf b/site/ugs/unnamed-good-story.pdf similarity index 100% rename from site/misc/ugs/unnamed-good-story.pdf rename to site/ugs/unnamed-good-story.pdf diff --git a/site/misc/unhappy/MEME0.PNG b/site/unhappy/MEME0.PNG similarity index 100% rename from site/misc/unhappy/MEME0.PNG rename to site/unhappy/MEME0.PNG diff --git a/site/misc/unhappy/MEME1.PNG b/site/unhappy/MEME1.PNG similarity index 100% rename from site/misc/unhappy/MEME1.PNG rename to site/unhappy/MEME1.PNG diff --git a/site/misc/unhappy/MEME2.PNG b/site/unhappy/MEME2.PNG similarity index 100% rename from site/misc/unhappy/MEME2.PNG rename to site/unhappy/MEME2.PNG diff --git a/site/misc/unhappy/MEME3.PNG b/site/unhappy/MEME3.PNG similarity index 100% rename from site/misc/unhappy/MEME3.PNG rename to site/unhappy/MEME3.PNG diff --git a/site/misc/unhappy/MEME4.PNG b/site/unhappy/MEME4.PNG similarity index 100% rename from site/misc/unhappy/MEME4.PNG rename to site/unhappy/MEME4.PNG diff --git a/site/misc/unhappy/MEME5.PNG b/site/unhappy/MEME5.PNG similarity index 100% rename from site/misc/unhappy/MEME5.PNG rename to site/unhappy/MEME5.PNG diff --git a/site/misc/unhappy/MEME6.PNG b/site/unhappy/MEME6.PNG similarity index 100% rename from site/misc/unhappy/MEME6.PNG rename to site/unhappy/MEME6.PNG diff --git a/site/misc/unhappy/MEME7.PNG b/site/unhappy/MEME7.PNG similarity index 100% rename from site/misc/unhappy/MEME7.PNG rename to site/unhappy/MEME7.PNG diff --git a/site/misc/unhappy/MEME8.PNG b/site/unhappy/MEME8.PNG similarity index 100% rename from site/misc/unhappy/MEME8.PNG rename to site/unhappy/MEME8.PNG diff --git a/site/misc/unhappy/MEME9.PNG b/site/unhappy/MEME9.PNG similarity index 100% rename from site/misc/unhappy/MEME9.PNG rename to site/unhappy/MEME9.PNG diff --git a/site/misc/unhappy/UNHAPPY.PNG b/site/unhappy/UNHAPPY.PNG similarity index 100% rename from site/misc/unhappy/UNHAPPY.PNG rename to site/unhappy/UNHAPPY.PNG diff --git a/site/misc/unhappy/index.org b/site/unhappy/index.org similarity index 100% rename from site/misc/unhappy/index.org rename to site/unhappy/index.org