You are viewing archived messages.
Go here to search the history.

Paul Tarvydas 2024-07-31 02:49:17

I’m in the process of writing a transpiler that spits out Drawware 0D kernel code in various languages (like Python, Lisp, JS, WASM, etc.) from a higher-than-HLL. I’m using a very simple “circuit” to regression test (Larson Scanner, as seen on T.V. Knight Rider). Current status and “working paper”: programmingsimplicity.substack.com/p/2024-07-30-diagram-compiler-status?r=1egdky

📝 2024-07-30-Diagram Compiler Status

This project creates a working “Larson scanner” (seen on the T.V.

Paul Tarvydas 2024-07-31 03:22:21

I think that this might be interesting to FoC’ers because: it demonstrates various techniques (t2t, 0D, feedback with queues, etc.) that aren’t common in Functional Programming. These techniques might inspire ideas of what is possible in the FoC realm, beyond the usual more-programming-using-only-the-function-based-paradigm. I, also, believe that VPLs and DPLs are ignored for at least 2 reasons: (1) it’s believed to be very hard to parse diagrams, and, (2) text says it all, what more could there be???. This progress report quietly attacks both mis-beliefs. (1) Parsing diagrams - in 2024 - is sooo easy that even someone like me can do it. (2) Feedback loops and structured message-passing produce efficient ways to express certain idioms that can’t be expressed - easily - in textual form, hence, are roundly avoided, hence, causing inadequate simplicity of design in certain problem domains.

Paul Tarvydas 2024-07-31 18:17:12

One thing that I keep forgetting to mention, is that even though I appear to be drawing node-and-arrow diagrams, nodes contain input and output ports. Possibly many of each. In contrast, functions in FP, have exactly 1 input port and exactly 1 output port (modulo the wart called “exceptions”. So-called “multiple parameters” to functions are but an optical illusion supported by destructuring operations (it’s all just one block of data that all comes at the same time, regardless of how you want to slice-and-dice the block)). Arrows can only be drawn from port to port, not from node to node. This simple concept of ports provides high levels of encapsulation of data /and/ encapsulation of control flow. Nodes are akin to Actors, except that Container nodes can be recursively defined to contain other Container nodes. Akin to the idea of Lisp lists containing atoms or, recursively, lists.

Ivan Reese 2024-07-31 16:20:52

My basement flooded this week. So that's going to set me back a bit. But, hey, here's a quick update on the two FoC-relevant things I'm floating.

  • DANK WIKI • At the last FoC virtual meetup, we talked about setting up a super lo-fi, friendly-to-nontechnical-folks, hackable community wiki. I've got a repo all set up for that locally, and just have a tiny bit more experimentation to do before it's ready to share. All the pages are just simple HTML or MD. There is a build step — wait, stop, don't run away — it's a build step, but it's cool and different!! There's a really simple spec and a short reference implementation. Zero dependencies, less than 100 loc. Everyone is encouraged to port the script into their language of choice and commit that. That way, other people can check out the repo, add some pages, and build it locally without having to conform to whatever ecosystem the build script requires. I'd ideally like to have impls in each of the most common ecosystems right away (JS, Python, Ruby, maybe bash, etc). Finally, the wiki is (for now) going to be hosted on Github, with an action that runs the reference build script on commit, so if people want to edit it via the Github web interface they can. (I'll be liberal with handing out the commit bit). This is going to be a social experiment as much as a technical one. Excited to see how it goes. Hoping to have the initial version of this go live this weekend.
  • LIFE RAFT • I'm itching to get cracking on a Slack successor. I'm thinking I'll spin up a dedicated channel, and solicit people to drop in whatever random wishes / ideas / requests / suggestions / advice they feel like offering, so that these can filter in to the design process. I'm also hoping to put together goals for an MVP. This will need to include several things, including but not limited to: visual mockups for the GUI on desktop and mobile, technical architecture, priority features, estimated timeline. I intend to be quite restrained here — I want to make the smallest possible good enough thing.
Kartik Agaram 2024-07-31 17:22:36

It's been on my mind to come up with a schema for this. You've mentioned channel -> post -> comment before, and cerca has post -> comment. I feel we need something slightly richer that allows wiki-like workflows as well. Revisions. The ability to summarize a thread in a wiki page while maintaining provenance to the original thread (so another kind of revision?) The ability to create multiple views of a thing, qua Glamorous Toolkit. Maybe that's also another kind of revision?

One challenge in combining markdown with an easy build script: markdown is notoriously hard to parse. Do you have thoughts on how to slice that tension? My thought so far has been to just restrict ourselves to a subset of html. Many forums and blog platforms allow html in comments but only a short list of permitted tags they can just mention below every textarea. That feels like one reasonable approach.

(I'm so sorry to hear about your basement!)

Ivan Reese 2024-07-31 17:43:08

I'm thinking we can get pretty far with a subset of markdown, parsed using a series of not-awful regexes. Here's what I currently have — cobbled together from a few different sources online, not well tested yet.

Screenshot 2024-07-31 at 11.41.26 AM.png

Paul Tarvydas 2024-07-31 18:25:30

FWIW: I strongly favour the use of OhmJS (PEG) over the use of REGEXs... REGEXs fool you into thinking that they work, until you hit some edge-case that doesn't work. Unlike CFGs, PEGs can be used for simple parsing tasks instead of mega-project full-blown compilers. I would immediately jump to using OhmJS for parsing something like markdown.

Jamie Brandon 2024-07-31 19:10:47

djot.net is mostly markdown but is significantly easier to parse. You probably don't want all of djot, but studying what they changed to make markdown easier to parse seems worthwhile.

Ivan Reese 2024-07-31 19:43:29

Paul Tarvydas I'm generally inclined to agree. Humblebrag: I work on a three-person team at my job, and Alex Warth is one of those three people. But in this case, I value the code being dependency-free and trivial to rewrite in other languages, so Ohm is probably out. So if we figured out a way to parse this subset of md syntax that satisfied the goals of this project, that'd be awesome. Would be happy to switch to that once it's figured out.

Konrad Hinsen 2024-07-31 20:08:19

dependency-free and trivial to rewrite in other languages

Translation: only languages with built-in regex support are allowed, and let's hope that their notions of regex are sufficiently similar (probably not an issue unless you need advanced regexes, but... we will see).

Just to point out the can of worms hidden behind any idea in the space of "let's keep data transformations simple".

Kartik Agaram 2024-07-31 20:21:20

This is strengthening my preference for "html (subset) all the way". Consistently across both wiki and life raft.

Paul Tarvydas 2024-07-31 20:22:34

OhmJS (unlike Ohm?) is portable to every browser of note.

Ivan Reese 2024-07-31 20:25:46

Reminder that the build script is a sideshow. The main attraction is authoring content for the wiki. That experience should be made as good as possible for as many folks as possible. This goal is in tension with the goal of making the build script stupid-simple and portable (in several senses — don't want to be tied to any particular host platform either).

Ivan Reese 2024-07-31 20:27:30

To the extent that we have a build script at all, the reason to have multiple impls is to allow people to run it locally without prescribing a single ecosystem (eg: npm). But that's not the same goal as "support every language in existence".

Kartik Agaram 2024-07-31 20:28:50

Yeah, fair. I can live with a markdown subset. We just need to be able to clearly communicate what subset it is, that'll be part of the authoring experience.

Ivan Reese 2024-07-31 20:28:51

Paul Tarvydas I meant OhmJS, sorry.

Paul Tarvydas 2024-07-31 21:17:19

Ivan Reese In your defence, a bird in the hand is worth two in the bush. And, my opinion is highly polluted by the notion that most existing 3GLs (Python, Haskell, WASM, etc.) are just assemblers and that OhmJS is the vehicle for making zillions of little DSLs using these assemblers.

Konrad Hinsen 2024-08-01 06:20:51

We are re-enacting "worse is better" here: go for a simple solution that does 90% of the job and leaves the remaining 10% to the user to deal with? Or go for the Right Thing with a proper parser and proper error messages, at the cost of more code and some dependencies?

The relevant question then is: will our users (present and future community members) be able to deal with the 10%, or will they give up when they can't get their contribution to render correctly?

Ivan Reese 2024-08-01 14:19:13

Konrad Hinsen But what different set of tradeoffs would you make? Can you find one that might better satisfy more people?

Ivan Reese 2024-08-01 14:36:56

Not to ignore your question, though it seemed a bit rhetorical: I don't think the regex will produce an unsatisfying result 10% of the time — not to take the idiom literally, but we're engineers, so let's try to work with realistic numbers. I think it'd be more like 0.01% or 0.001%, and the failure mode would be rendered text that visibly doesn't match your intent, not a silent failure. The ultimate fallback in that case is likely "just write that bit in html". My hunch is that people will generally prefer writing in the subset of md, and would more often hit a case where plain html fails them (they miss a closing tag, say) than where the md regex fails them.

Ivan Reese 2024-08-01 14:39:34

Shipping a bigger, more complex build script will make it harder to port and maintain the build script in multiple ecosystems. That'll mean fewer people use the build script locally, relying on the build step that runs on push. That's a much longer feedback loop.

Konrad Hinsen 2024-08-01 19:09:41

I think we have something similar to Zookoo's triangle: out of three desirable characteristics, we can pick any two. The three are:

  • Simple build system
  • User-friendly input syntax (Markdown)
  • Well-specficied build system (meaning an input format specification that actually corresponds to what the parser takes)

If we give up 1, we use a Markdown-to-HTML compiler with a parser for something well-defined (Commonmark, djot, etc.).

If we give up 2, we use HTML as our direct input format.

If we give up 3, we use some regexp-munging for transforming something Markdown-like to something HTML-like.

My personal order of preference is 2, 1, 3 (the number being the feature I am willing to give up). I am not going to give any arguments, because I can easily give arguments for any of the three choices. It really comes down to weighing them against each other.

If everyone agrees that these are the trade-offs, we could do a poll to see what we mostly care about.

Ivan Reese 2024-08-01 20:09:43

I appreciate the effort to find a framing that helps us think about this issue. But I disagree with the premise behind this particular framing. I think all 3 are achievable, and are already sufficiently achieved for the immediate needs of this project. The parsing worries expressed in this thread are missing the point of markdown. (For those who know their markdown history — I side solidly with Gruber, and solidly against Atwood.)

I'm going to go ahead and ship what I've got. That's the spirit I'd like to engender with this project — just get something out there, it doesn't have to be perfect. If people try to use it and find that something about the setup impedes their desire or ability to contribute to the wiki, we can work on that concrete problem. I don't expect that what I have will work perfectly, especially not at first. That's a non-goal. The goal is to get people writing wiki entries.

(And because I love a framing, even one I disagree with: 3, … … … … … … … 1, 2)

Konrad Hinsen 2024-08-02 07:41:11

My point 3 indeed assumes Atwood's perspective on Markdown ("Markdown is a formal language"). I have a lot of sympathy for Gruber's view ("Markdown is a notation") but judging from the Markdown use cases I have experience with, it has failed in practice. It could perhaps be implemented robustly using AI, but there isn't much money to be made there so it won't happen.

Side note: Markdown history deserves being studied in detail because it showcases many general issues with human-computer interfaces.

That said, please go on with your project. "We believe in rough consensus and running code."

Maikel van de Lisdonk 2024-08-04 20:03:05

Hi, Because I want to understand better how neural networks work and can be trained, the best way to do is, is by building a small one from scratch myself and training it.

In this video youtu.be/TG9TGqM9HCs I show creating and connecting a few neural-nodes together and a show a very small prebuilt neural network.

To be able to do this, I've created 4 new node-types in my visual programming system: neural-input-node, neural-bias-node, neural-node and neural-output-node.. the first 3 output weighted connections. This means that a weight property is attached to the connection and can be changed.. the neural-node and neural-output-node use these weights in there respective calculations.

The neural-node currently uses sigmoid as its activation function.

The neural-bias-node only outputs a value of 1 and the output value of a neural-input-node can be changed. When any of these values are changed, they propagate forward through the network.

In the current example flow, an error is also calculated using an expression node-type depending on the output and expected value.

The white object-node is also a new node-type and can be used to obtain multiple values and output them in a single object.

In the near future I hope to implement a neural network that can be trained with the mnist digit dataset, but I have to do a lot more work before I am at that stage I think.