yeah, the thing is too, when you get used to the simpler syntax you don't ever want to go back. tap tap tap enter BOOM done.

Go has this in the function signature and the whole source code file layout is designed so it already has the top level structure in one scan. they didn't invent the design tho, this was Niklaus Wirth who came up with it.

https://en.wikipedia.org/wiki/Niklaus_Wirth

out of all the widely used languages out there right now, only Go follows his designs. Rob Pike was a big fan of Wirth's way of writing programming languages and how to engineer them.

anyhow, yeah

what's an example of an RPN query language because i'm in the middle of building something with one, i want to make it as lean as possible also

ah, i forgot what RPN means

((10 20 +) 50 *)

just putting the brackets for understanding precedence but there is no precedence in a pure RPN. Forth is a language that has a syntax like this too iirc, very popular with mathematicians, one of my first "work experience" things was at a government agriculture research lab, my supervisor wrote models in Forth... i spent some time playing with Lisp back then also, but lisp is infix thus the endless braces.

gonna put this on the back burner to figure out how to use this.

Reply to this note

Please Login to reply.

Discussion

https://en.wikipedia.org/wiki/Subject%E2%80%93object%E2%80%93verb_word_order

quite interesting, in fact by number there is more human languages that use this syntax format than any other. subject being the first on the stack, object being the second, and verb being the last, that then places the result on the stack for the next object and verb.

it's the most efficient encoding and doesn't require parenthesisation of anything.

anyway, i can't think of how it's useful for me writing a query system. the query is just a matching filter.

Yes, for simple filters it doesn't get you much. It is when you want to choose how to AND OR NOT several filters that it comes in handy. Usually you just assume everything is an AND, but it doesn't take long before someone wants something more complex. "I want all the posts from these authors from after this timestamp that don't contain these words but I do want them if they mention my favorite hashtag... Etc.

yeah, i made a filter that does all of that negation. it allows fetch by id, OR fetch by any set of pubkey/tag, THEN a since/until time window filter, AND NOT ids/pubkey/tags and then sort ascending/descending by timestamp

well, to be fair, i wrote the basic part and then i made the AI write the rest for me, with tests.

one has to put some kind of cap on the depth of logic for a relay event filter search i think. everything beyond what i just listed kinda gets into application logic i think. this is part of what i consider to be a domain error of many database query systems also, pushing so much app logic into the query engine. data formats also play a part in this, the generic event format is very nice with the metadata/author/content that can basically put anything inside it... you can even grandfather in metadata using label events, as well, though that kinda has to be kept from getting too deep.

I don't actually know any examples. But I once made my own php web framework out of frustration with overcomplicated existing frameworks. It seemed every decision was made without any real thought.

On of those things are ORMs. They are great for really simple relationships but get increasingly obtuse for any real queries. Somethings, like multiple sub queries to the same table, they couldn't handle at all.

I whipped up an RPN ORM for querying XML documents as a proof of concept. I could do any query I could think of with a very simple engine.

Granted it would have been a lot more work to get it to generate proper SQL or to optimize the queries for memory usage etc, but if you wanted to make your own engine you'd be starting with 1/100 the complexity.

I am thinking about it for distributed search. A peer to peer search is always going to kinda suck compared to a central database, but we can make choices to lighten the load on individual nodes.

If queries got passed in a standardized postfix notation, then each node wouldn't have to parse the query before running it. You could still have SQL locally for people that want it, but it would get transpiled locally before the query is sent to the network.

To update. I am letting chatgpt talk me out of postfix and into prefix. Specifically alegebraic S-Expressions. Basically LISP 😛

Should maintain the advantages of RPN but be easier for humans to read and translate more directly to a tree structure that can be optimized.

yeah, prefix, "verb subject object"

ate david pizza

ahaha. no pizza tho. celiac.

no ate david pizza. ate david (boil egg)

VSO SVO OVS OSV.

funny enough, RPN syntax is actually the predominant syntax of all human languages, something like 40%

I can't eat normal pizza either. Not celiac just migraines. I get to eat non-wheat pizza though.

i get visual migraines, but it's something to do with dehydration and something in energy drinks. sugar free ones made me lose convergence in 2023 also. it's starting to recover but it seems like if i don't keep away from allergens it doesn't recover, meaning it's partly kidney/electrolyte and partly inflammatory

damn near impossible to find anything in the whole supermarket that isn't one or the other.

Yup, those are the ones. I used to get optical migraines fairly frequently. I stopped wheat for unrelated reasons about 12 years ago and haven't had a migraine since. Makes driving a lot safer.

interesting. i have also noticed that i don't get this problem anymore, but what was mainly causing it for me was energy drinks, combined with, probably, a lot of barley malt, so, yeah, gluten there.

idk hwat it is, inositol, glucuronolactone, one of those. has some interaction with the immune system, and i think that what's happening is inflammation in the visual cortex.

Hmm. Who knows what other havoc it was causing. Visual is probably the most obvious. But I wouldn't be shocked to learn that my general cognitive ability dropped across the board.