Thursday, December 8, 2022

Books released recently

 I used to be a voracious reader.  Now I merely read a lot.

Here are books released recently by some of my favorite authors.  Your mileage may vary.

Cedar SandersonCrow Moon    A collection of fantasy short stories.

Celia HayesLuna City 11th Inning Stretch        The ongoing saga of the wacky adventures of a world-class chef in a small Texas town.

Sarah HoytBowl of Red        The ongoing story of shape-shifters running a diner in Colorado.

Here's a couple other authors whose works you may enjoy.

Alma Boykin (my favorite author)

Peter Grant

Dorothy Grant  (yes, they're a couple)

J. L. Curtis

And of course, Larry Correia, the mountain who writes.

Monday, December 5, 2022

Listack, a flat programming language

 I'm working on yet another new programming language.  After the success of Falsish, a False derivative with elements of Fish ><> enabling both global (upper case) and local (lower case) variables, with a stack of stacks enabling local scope, I wanted to make something better.  Or at least easier to read.  (False was made to be an obfuscated esolang.  It wasn't the first, but it did kick off the movement, as it happened at the beginning of the internet era.)  So I started working on something similar, but with a real parser to handle, you know, words, and not just individual symbols.

I worked on that a bit, and it worked well enough, but I wanted something more.  Something different.  Stack based concatenative (Forth-like) languages have been done to death, because they are easy.  Factor looks intriguing, but its on-line documentation is, well, so thorough and detailed as to be unreadable.  And then I ran across a video on Stackless Python.  (Abandoned in favor of PyPy, apparently.)  The language implementation is more or less flat, without using the call stack to handle procedures calls and returns.  It claimed to be easier to use for advanced functions like concurrency.  EVE Online uses it to handle tens of thousands of simultaneous users.

Well, that certainly did sound different.  A challenge!  But how to implement it?  At about the same time, I read something about a stack based pure functional language that took as its arguments the program and the data stack, and returned a new data stack and program for every function call.  While this seemed inefficient, it had potential.  After all, a program is basically a list of past outcomes, future commands, and the current command as "now".

So that's what I am building.  I've done a few technical demonstrations, and gotten them working.  The key, as usual, is to make things simpler.  Always simpler, never more complex.  It's working spectacularly.  Whenever something seems difficult, I take a break, and the correct, simple way eventually comes to me.  I'm still refining, because this method of language implementation has opened up so many broad areas to explore.

Listack (current working name, because it uses lists and stacks) is a flat language.  It operates purely on a loop with a few context variables.  It does not call itself.  It is not, in and of itself, recursive.  It supports recursion, of course.  (While loops are implemented as recursion, for example.)  How does it work?  The past is a stack, with the most recent data on top.  Future commands are a queue, with the next one to be executed at the front.  Moving items from the future queue to the past stack and back is trivial, but the key to how everything works.  Listack is implemented as two deques, one for the past stack and one for the future queue.  The present is a single variable called current.  (There is also a deque of deques to implement local scope by saving versions of the past.)

The only real control flow operator in the language is IF.  All IF does is to delete one of two items, based on a boolean condition (true or false).  If the condition is true, it deletes the second item.  if false, the first.  That's all you need to implement control flow.  Well, that and a bit of meta programming to move elements around.  (I'm using ALL CAPS to show commands.)

In postfix notation, if works like this: 

        condition [do if true] [do if false] :IF

With the flat implementation, I can also implement a prefix version: 
        IF: [condition] [do if true] [do if false]

And infix, which seems easiest to read: 
        condition IF [do if true] [do if false]

With if, we can create while.  The begin gets added so we can implement continue and break in the body of the while.

original postfix: [condition] [body] :WHILE
becomes:  condition [body BEGIN [condition] [body] :WHILE] NOP :IF

prefix:  WHILE: [condition] [body]
becomes:  IF: [condition] [body BEGIN WHILE: [condition] [body]] NOP

infix:  [condition] WHILE [body]
becomes:  condition IF [body BEGIN [condition] WHILE [body]] NOP

And the best part is that I can have all three styles by just implementing the postfix version, then using meta programming to move the arguments around.  I can easily implement most commands with a prefix, infix, and postfix variant.  It's a bit tedious, but not complicated.

Procedures/functions are merely variables whose [contents] can be executed.  Of course, that's technically true of all variables, as the meaning of '5' is to push the number 5 onto the stack.

I could implement a local scope for commands , in addition to data.  I'm still considering that.  It's not like it would be difficult.  I'm just not sure of how or why to use it, and what it should look like.  Since local scope for the data stack is N(), perhaps the command queue should be N{} ?  (N is the number of items to push to the new deque from the old.  When the scope is closed, the remaining items get pushed back onto the old deque.)

I can also make the meta-programming routine available as a function in the language, so the user can create their own control flow commands.  FOR isn't complex at all.  It's just a while with some initialization beforehand and a regular change that gets tacked onto the body.

prefix:  FOR: [init] [condition] [change] [body]
becomes:  init WHILE: [condition] [body change]

You want it to look different?  Customize it!
infix:  FOR [[init] [condition] [change]] DO [body]       (Note: DO is pure syntactic sugar)
becomes:  init [condition] WHILE [body change]

You want a for-like until?
infix:  init DO [body] UNTIL [condition] [change]
becomes:  init body [condition] WHILE [change body]

Thursday, November 24, 2022

Happy Thanksgiving!

Happy Thanksgiving to one and all! 

I'm a turkey.  Eat me!

Always remember that the first Thanksgiving feast was when the surviving Pilgrims (not many, most present were relatively new arrivals) gave thanks to God for teaching them the errors of socialism, and for providing the bounty of each individual family's efforts.

Wednesday, November 9, 2022

Please help them out

Two good men both need your financial help.

Lawdog needs money to pay for his legal defense from trumped-up charges by a Leftist DA with an axe to grind.

Big Country Expat needs money to fund the legal team to sav e his granddaughter from her crazy mother and abusive, junkie father.

Please find the time to scrape together a few bucks to help them out.

Friday, November 4, 2022

Falsish esolang

 Okay, I'm a junkie.  I like making esoteric programming language (esolang) variants.  I was focusing on Subleq, but have moved my sights along to False now.

False is one of the earliest purpose-built esolangs, dating back to 1993.  You can learn more about it here.

Anyway, I was also interested in the capabilities of the fish ><> esolang.  Especially how it could create new stacks.

So, I added the new stack capability to False, along with making a new local variable list with each stack.  That meant I also had to add a new way to have global variables.

I think I succeeded in my task.  For what it's worth, it was fun and educational.  After I gave up on the first misguided and overly complicated attempt, that is.  Wow, what a difference building the right foundation makes.  😊

You can find out more about Falsish here, and download the Python code from here.

Here is a sample program, written in Falsish:

\"Factorial of "." is: ".10,

Tuesday, November 1, 2022

No amnesty. Not now, not ever.

The Left is requesting "amnesty for me, but not for thee." Here is a quote from the Atlantic article.

"We have to put these fights aside and declare a pandemic amnesty. We can leave out the willful purveyors of actual misinformation while forgiving the hard calls that people had no choice but to make with imperfect knowledge."

Always remember that, to the Left, the truth is "misinformation".  

It's amusing that they actually believe that opinions have a completely random relationship to the truth.  
"Given the amount of uncertainty, almost every position was taken on every topic. And on every topic, someone was eventually proved right, and someone else was proved wrong. In some instances, the right people were right for the wrong reasons."

Tuesday, October 25, 2022

The Broken Science Initiative

 William Briggs, "Statistician To The Stars" is one of my daily blog reads.
This is worth your time.

The biggest problems in science today are:
Big money
The expansion team effect