An execution model inspired from thought stacks

  • 4 Replies
  • 1810 Views
*

Zero

  • Eve
  • ***********
  • 1287
An execution model inspired from thought stacks
« on: September 07, 2018, 10:42:04 am »
I think it's not a new programming paradigm, because this term encompass a lot of things. But it's an interesting execution model.

You probably know stack based languages, like Forth, Factor, Joy. Basically, you push operands on a data stack, then you push an operator which pops operands and pushes the result of the operation.

You also know how thoughts work. They work a bit like a stack. What you're thinking is on top of the stack. If that raises a problem, the problem get pushed on top of your thought stack, until it is solved. The solution is then left on the stack with the previous thoughts, and you can "resume" your prior thinking activities.

What gets pushed on the thought stack depends on what is already on the top. So a basic way to emulate a similar mechanism would be to use pattern matching to decide what to push.

Classical stack-based languages let you create a program; during execution, elements of the program are pushed one by one on the data stack. Here we do something different. We set up a rule engine, like those we use in chatbots, to match the top of the data stack against rules. When a rule fires, it pushes stuff on the data stack.

It's like saying "when the top of the data stack looks like this, push that on the data stack".

Here is an example.

data-stack:
    one two foo 4 3 +

rules:
    # # +    = <built-in sum>
    # # -    = <built-in sub>
    # baz    = baz was 1 #1 -
    # foo #  = bar between #1 and #2 baz

execution trace:
    one two foo 4 3 +
    one two foo 7
    one bar between two and 7 baz
    one bar between two and baz was 1 7 -
    one bar between two and baz was 6


I'm wondering whether I should include this in Airbender, or start fresh on another project, maybe in golang.

*

ranch vermin

  • Not much time left.
  • Terminator
  • *********
  • 947
  • Its nearly time!
Re: An execution model inspired from thought stacks
« Reply #1 on: September 08, 2018, 09:31:07 am »
I think you have to make them multidimensional,  so it has options when it pulls off a leaf.

Coincidentally, I love stacks too.  I know how to make a single number stack with algebra/complex sums.
I actually thought about this alot,  and if you put a video into a stack,  it comes back out playing backwards.

I bet you could get markov chains and palindromes to work in a stack.

 O0

*

Zero

  • Eve
  • ***********
  • 1287
Re: An execution model inspired from thought stacks
« Reply #2 on: September 17, 2018, 03:31:30 pm »
What do you mean, "multidimensional"?
Sounds cool. :)

*

ranch vermin

  • Not much time left.
  • Terminator
  • *********
  • 947
  • Its nearly time!
Re: An execution model inspired from thought stacks
« Reply #3 on: September 17, 2018, 05:23:10 pm »
idea just simple one, but it backfired when i wasnt getting infinite memory from nothing  :idiot2:, a normal stack is 1d, u only push/pop the next item,  i mean just you get options each new pop/push whatever, so you have multiple stacks to pick from.

*

Zero

  • Eve
  • ***********
  • 1287
Re: An execution model inspired from thought stacks
« Reply #4 on: September 17, 2018, 08:40:35 pm »
Reminds me of Push3, which has one data stack per data type. This one is for genetic evolution of programs. Pretty cool.

 


OpenAI Speech-to-Speech Reasoning Demo
by ivan.moony (AI News )
Today at 01:31:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

261 Guests, 0 Users

Most Online Today: 343. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles