Saturday, October 12, 2024

The four types of programming languages

There are four types of programming languages.  I'm not talking about the religious differences between object oriented, procedural, and functional languages.  I'm talking about something more fundamental - syntactic structure.  The vast majority of computer languages (excepting esoteric or very primitive ones) fall into the four camps of ALGOL, LISP, APL, and Forth/Joy.  These differ based on how you read and understand the code.

Note:  Examples are not necessarily valid code in these languages.

ALGOL:  Left to right (left or right associative based on what makes sense, usually), prefix (except infix operators like '+' and '*'), inside out.  These are the procedural languages most programmers are familiar with.

    command(arg1)
    command(arg1, arg2)
    command(arg1, arg2, arg3)
    command-a(arg1a, command-b(arg1b, arg2b), arg3a)
    add(1, 2 * 3)
    if (3 > 2) then {print("true")} else {print("false")}


LISP:  Left to right (no associativity), prefix (always), inside out.

    (command arg1)
    (command arg1 arg2)
    (command arg1 arg2 arg3)
    (command-a arg1a (command-b arg1b arg2b) arg3a)
    (add 1 (* 2 3))
    (if (> 3 2) (print "true") (print "false"))

    

APL:  Left to right (right associative), prefix or infix, inside out.  It's easier to read right to left.

    command1 arg1
    arg1 command1 arg2
    there are no 3 or more argument commands in APL
    arg1a command-a arg1b command-b arg2b
    1 add 2 x 3            this is the same as 1 add (2 x 3)
    
3 > 2 ⍳ ⎕  ← "true" ⋄ "false"            I got this from an AI prompt.  APL is weird.


Forth / Joy:  Left to right (usually no associativity), postfix (usually, unless it's immediate, which looks like prefix or infix).

    arg1 command
    arg1 arg2 command
    arg1 arg2 arg3 command
    arg1a arg1b arg2b command-b arg3a command-a
    2 3 * 1 add
    Forth:  3 2 > if "true" print else "false" print then
    Joy:  3 2 > ["true" print] ["false" print] ifte


The ALGOL (procedural) family of languages make regular use of syntactic sugar to make reading the code easier.  The annoying-to-learn syntax is what makes it more readable, and programmers spend much more time reading code than writing it.  That's part of why they have mostly conquered the programming world, despite the niche technical superiority of the other language styles.  



Wednesday, October 2, 2024

What is woo-hoo?

Scientific woo-hoo is the propagation of nonsense.  It is the belief in magic, draped in the robes of science.  The Copenhagen interpretation of quantum physics has done more harm to science than even the global warming cash and power grab.

Woo-hoo is the belief that particles don't have properties until a scientist measures them.  They really believe this, because they have been carefully trained, for generations, to not think.  (Don't believe me?  Look up the history of rogue waves in the ocean.  Despite sailors knowing about them for millennia, they "didn't exist" until scientists finally documented one hitting an oil platform in 1995.)

Woo-hoo is the belief that math is more real than reality, that models are more important than observation, that the map really is the territory, that doctrine is more important than thought.

Woo-hoo is the belief that a particle in a superposition is actually in multiple states and multiple places at the same time.

Woo-hoo is the belief that in a double split experiment, a single photon splits itself into multiple existences, some traveling slower than the speed of light while others travel faster, so it can interfere with itself along the way to the detector.

Woo-hoo is the belief that entangled particles don't have properties until a scientist measures one of them, then the other instantaneously becomes something as well.  This is the belief that if you flip a coin and see heads on top, the bottom suddenly and magically becomes tails.  The belief that if you take a pair of shoes, randomly place them in separate boxes, and mail one box to China, that box will suddenly and magically contain a left shoe the instant you open the other box and find it contains the right shoe.

Woo-hoo is the ongoing experiments to see if a particle quantum tunneling through a barrier teleports or moves faster than light.  The reality is so much more simple.  The particle tunneling its way out of a barrier does so because at that random instant, the barrier isn't there.  A tunnel momentarily opens up through sheer Brownian chance.  The particles and fields comprising the barrier have randomly moved and changed in such a way that the barrier is no longer a barrier at that particular time and place.  If you shake a box of ping pong balls long enough, while looking through a pair of holes on opposite sides of the box, there will eventually come a moment when you can see clearly through the box because all the balls are randomly not in the way.

Woo-hoo is believing that black holes really are singularities of infinite density, with alternate universes inside them.

Woo-hoo is actually believing the 'many worlds' hypothesis is in any way scientific.

Woo-hoo is the uncritical belief that Bell's theorem disproves local realism, despite Bell's inequality being obviously based on a strawman argument.  (Bell "proves" that triangle waves are not identical to sine waves, that straight lines are not curves.  The fact that nobody ever suggested they were somehow seldom gets mentioned, and those who do quickly lose their jobs and voices in the industry.  Pour encourager les autres.)

Woo-hoo is the unquestioning belief that the expansion rate of the universe randomly changes over time, never asking how or why.  So many questions left unasked - how would the rate change everywhere, evenly, at the same time?  If this is a real effect, and I am by no means assured it is (there are a lot of adjustments made to observational data), then it is the most definite proof of the existence of God I have ever seen.

Woo-hoo is strangling science through magical thinking.

Sunday, September 29, 2024

Spacetime, again

I dislike repeating myself. However, the contradictions at the heart of modern physics annoy me even more.  I despise all the self propagating woo-hoo and lack of thought.

The basic principles of spacetime: 

1) There is no such thing as negative (anti) energy. Some forms of energy are opposites, but all are energy.

2) Proper time is potential energy. (This is well modeled in particles as imaginary spin. Anti-particles have the opposite spin.) 

3) The energy density at every point is a constant. (upper limit = Planck, lower limit = 0) 

4) Spacetime is the field governing motion. (Particle motion is a perpetual, localized wave. This creates blue and red shift all by itself.) Note that none of these simple principles violate observations. 

There are no contradictions, no infinities, no singularities. Black holes are not singularities, they are hollow shells of maximal (Planck) energy density surrounding an area of zero potential energy.  Space is flat (Euclidean), (proper) time is imaginary, spacetime is hyperbolic (because when you square an imaginary number, you get a negative real number).

Saturday, September 21, 2024

The contradictions at the heart of physics

Modern physics is broken because physicists have been carefully taught to not think.  I mean this quite literally.  "Shut up and calculate" is the prevailing model of the universe!

Let us take something simple - the uncertainty of knowledge.  Okay, maybe it's not that simple.  But it should be.  Quantum physics states quite plainly that all information is locally hidden until a measurement is made.  It actually goes further to say the information doesn't exist until the measurement is made, but that's a separate idiocy for another time.  Quantum physics also states that, due to Bell's inequality, local hidden information is impossible.  The vast majority of physicists take both of these propositions to heart without any critical reflection whatsoever.  Thus, they internalize contradictions as part of their formal training.

Please forgive my repeated rant here against Bell's inequality.  In his papers, Bell carefully sets up a straw man argument, then knocks it down.  Thus, using his paper as proof, you can make the most outlandish claims - that entangled particle pairs cannot contain hidden information (even as the information must be hidden due to the probabilistic nature of the quantum wavefront), that the particle pairs communicate instantaneously over great distances when you finally do measure them, and that there is no such thing as local realism.  These claims are only possible due to the nonsensical nature of Bell's inequality.

What is the problem with bell's paper and its famous inequality?  What is the inequality?  In summary, Bell showed that sawtooth waves are not identical to sine waves.  Shocking, I know.  Where do the sawtooth waves come from?  He made them up with mathematical sleight of hand.  There has never been the slightest indication that any particle acts in any way like a sawtooth wave.  And yet that's what Bell uses to claim that entangled particles must communicate instantaneously, and that there is no such thing as local realism.  I'm quite serious.  Go read the paper yourself, and marvel at the hubris used to create the straw man sawtooth particle.  Then cry that it has been taken very, very seriously indeed by generations of scientists.


By the way, I'm not the first to notice this.  Some scientists have complained about it since just a few years after the paper was published.  However, these men seem to share similar fates in having their funding mysteriously cut off after announcing that the emperor has no clothes.  And those who spend tens of millions of dollars proving the tautology (waves act like waves) win Nobel prizes, thus reinforcing the power of "woo-hoo" politics in modern physics.  Shut up and calculate!

Tuesday, September 17, 2024

Closures

In programming, a closure seems to be this mystical thing.  There are endless reams of research and obscurely technical explanations of what a closure is and how they work.  I hate, loathe and despise needless complexity.

A closure is a function to be used later, which uses some of the data currently available, packaged together.  Enclosed, if you will.

So, in Listack terms, if you have a data stack, and a function to be used later that depends on the current state of some of the data, you package together the data with the function for later use.  This is a closure of the function over the data.  So, if you have a function that will depend on two data objects, you write:

        rest_of_stack data1 data2 \.func 3 .enlist >block  

which produces:

        {data1 data2 .func}

When the later time finally arrives, you simply invoke the closure.

        rest_of_stack {data1 data2 .func} .eval

We could even make a procedure to create closures.  Note that most of the procedure is purely for error handling.

    def: "make_closure" [Seq, Int]
    {    # will make a closure over n data items and one sequence
        dup < o     # the closure can't contain fewer than no data items
        iff {
            drop drop 
            "Closures may not have a negative number of arguments" .set_err
            exit
        }
        dup > (depth - 3)     # must have enough items on the stack
        iff {
            drop drop 
            "Stack not deep enough for number of closure arguments" .set_err
            exit
        }
        1 .+  .enlist >block        # the actual closure: {d1 d2 d3 ... dn seq}          
    }

    def: "make_closure" [Block, Int]
    {    # could also be:    \.eval swap 1 .+ .make_closure
        swap >seq swap .make_closure
    }    # could have used dip instead

    def: "make_closure" [Word, Int]
    {    # a b \func .dip --> a func b
        \>seq .dip .make_closure
    }    # could have just repeated the original definition, but where's the fun in that?
 

Thursday, August 22, 2024

Don't Roll a One!

Introducing the new gonzo role playing system, "Don't roll a one!" (DROne)

Seriously, that's the rule. Players roll a die type (d4-d20) based on their PC's attributes, class, and level. When they want to do something, they roll the appropriate die. If it's not a one, they succeed. The PC is good at most things, but has some skill they are comically terrible at. When attempting that, any roll except a one fails. Mooks flip a coin, pass (2) / fail (1).
Because there is always a need for comedy (like Drunken Master or Kung Fu Hustle), there is an alternate PC - the Plague Carrier. The plague carrier fails on any roll except a one. Except for the one skill the PC is comically good at. When attempting that, the Plague Carrier succeeds at any roll except a one.
Opposed rolls are won by the highest roll, unless everybody fails. A tie is won by the highest die type, or the side who initiated the action. Help actions have everybody roll, take the highest, and add one for each other person helping - but if anybody fails, they all fail.

Thursday, August 1, 2024

I stopped caring 20 years ago this month

I was an Army Counterintelligence NCO. My team did CI/HUMINT in Iraq way back when. At the end of the year, our replacements showed up. They were National Guard linguists (not Arabic) who had been involuntarily reclassified to CI and given a three week crash course. Three of them, that is. The fourth team member, their driver, was a mechanic. Sounds great, yes? The mechanic had no security clearance. Every mission, every meeting, was at least Secret. See the problem here?

And then, on our first joint mission outside the wire (an easy one), their team lead totally freaked out and drew his pistol on me. I was a lot faster with my rifle, and talked him down. Oh, and they openly disdained our/their interpreter. Being a classified unit, our ‘terp was an American, with a Top Secret clearance. (He asked if we could take him back home with us. Unfortunately, he was on a separate contract.) That’s the quality of people we left as our replacements. (History - different time and place, had a US citizen 'terp stolen from us by an SF unit, then abandoned in-country the next day when they didn't need him any more. That guy walked over 50 miles back to the base on his own.)

What really broke me was the day a US convoy was ambushed on the highway outside the base. We could hear the shooting and explosions, and see the dust cloud raised. When I ran into the operations center to see if they knew, the officer in charge said they were listening to it on the radio, isn’t it great? I asked when they were going to send out the quick reaction force to help. He looked totally confused, and asked why would they do that? When I explained in small words that the primary purpose of the unit and the base was to support and protect friendly convoys transiting that highway, the response was, “We can’t do that. Somebody might get hurt!”

I broke that day, rather than than start shooting officers, because I had a family to take care of, and they wouldn’t appreciate me being the subject of a “60 Minutes” special report.  So I simply stopped caring.  A couple weeks later, I pissed off the base commander enough he PNG'd (Persona Non Grata) me off his base.  I spent months, as a senior NCO, with nothing to do but be a spare body on missions outside the wire.  The team sergeants were ordered to ignore me.  The best of them didn't of course.  They came to me quietly for advice.  The worst actually did ignore me, and blew mission after mission due to their incompetence.

But I no longer cared, so that was okay.  None of what we did really mattered in the long run, anyways.  There was never any attempt to actually pacify Iraq, because that's not what the politicians wanted.

And then the unintelligible (and I mean that) Nigerian lieutenant (who came to the USA by way of Russia and France), whom somebody thought would be a good idea to make a counterintelligence officer, started sexually harassing our (happily married) female NCO.  We also found out he was physically abusing detainees.  As we gathered and documented the evidence against him, one of his junior enlisted buddies (yet another bad thing) found out and snitched.  So he accused all three team leaders, the best NCOs in that platoon, of EO violations.  Of course our company commander believed a fellow officer, no matter how unintelligible, over mere enlisted pukes.  So he sent those three Staff Sergeants back home early for courts-martial.

And then the Battalion sent me home with the first wave to return.  That gave me two weeks to save those NCOs.  Since we got home the night of Christmas Eve (Thanks, Ed!), I had the space between Christmas and New Years Day to testify to the Court officers.  (It was really handy that the Court was only a few yards from our office.)  I put it all in writing, along with the written and signed reports (which the captain thought had all been destroyed) I had squirreled away.  My testimony matched the three NCO's exactly, and they were quietly released, all charges dropped, and discharged with full back (forward?) pay "for the good of the service".

The idiotic (and I mean that) lieutenant never made captain, and the captain, who already had orders for reassignment and promotion to major, had a damning letter placed in his file.  It's not great, but it wasn't nothing.

And they wondered why I resigned my non-commission.