16 comments

[ 5.2 ms ] story [ 52.1 ms ] thread
Penrose is a platform that enables people to create beautiful diagrams just by typing notation in plain text.

https://penrose.cs.cmu.edu/

> just by typing notation in plain text

Isn't this what all computer programming is?

You might be surprised how many people would exclude languages like HTML on the basis that they don't describe computations. (I am more of a PL maximalist: any syntax that allows you to describe and manipulate some class of semantic objects in a machine-processable manner can reasonably be called a programming language.)
To me, the statement "just ... plain text" implies some level of simplicity that I don't see in the examples. It looks pretty complicated, in fact. There is no escaping essential complexity.
I took the like from the frontpage. Maybe they want to attract non programmers and doesn't want to scare them with the word "programming"?
Well, tried modifying Caffeine (since it looks like there should be a perfectly 3-symmetric variant repeating the O and CH3 arms, but it ain't "beautiful". Wonder how their Caffeine molecule comes out so perfect. Here is the code for my wonder molecule:

   -- Wonder molecule, expressed via structural-formula DSL
   Carbon C1, C2, C3, C4, C5, C6
   Nitrogen N1, N2, N3
   Oxygen O1, O2, O3
   Hydrogen H1, H2, H3, H4, H5, H6, H7, H8, H9

   SingleBond(H1, C1)
   SingleBond(H2, C1)
   SingleBond(H3, C1)
   SingleBond(N1, C1)

   SingleBond(H4, C2)
   SingleBond(H5, C2)
   SingleBond(H6, C2)
   SingleBond(N2, C2)

   SingleBond(H7, C3)
   SingleBond(H8, C3)
   SingleBond(H9, C3)
   SingleBond(N3, C3)

   DoubleBond(O1, C4)
   DoubleBond(O2, C5)
   DoubleBond(O3, C6)

   SingleBond(N1, C4)
   SingleBond(N1, C5)

   SingleBond(N2, C5)
   SingleBond(N2, C6)

   SingleBond(N3, C6)
   SingleBond(N3, C4)

   AutoLabel All

   Title title
   Label title "C6H9N3O3"
I have to say, I'm very confused. There is possibly something very cool here, but confusion reigns supreme for me right now.

In the "A", or "signed angle outside" example [1], what defines the position of the points making the A?

Also, the amount of text required to make that examples seems huge, when you consider the >600 lines of style. How is this advantageous over SVG, which can also be semantically-meaningful?

1. https://penrose.cs.cmu.edu/try/?examples=walk-on-spheres%2FS...

The point coordinates are defined at the very bottom of the ".style" tab, after the commented out code. I had the same question!
It would be great to see new practical software for declarative specification of general 2D diagrams. With increasing emphasis recently on language-based tools, this is an excellent opportunity.

It would be good to find ways to make the internal algorithms and their parameters more "open" or more easily parameterized and recombined in novel ways. It would be good to find ways to rely on more generic optimization methods, though software like this is probably skating on the edge of computational intractability (not to mention usability or interpretability issues) so it's a very challenging problem.

Kudos.

This is the type of thing I want AI to solve for me. I give an English description, I get some Penrose output, I tweak it till I get what I want. Learning curve seems too stiff for something I wouldn’t use too often.
I have dabbled with Penrose, TikZ, manim, PlantUML, mermaid etc., because "I can‘t draw, I want to program diagrams".

I think I should really stop fooling myself and learn Inkscape.

More than drawing, versioning. In that all those tools excel over drawings that you may or not notice in what they are different. And then collaboration, history of changes, converting between formats if possible, and generating different kinds of outputs. That is what you get turning drawings into some easy enough to understand language.
(comment deleted)
What level of abstraction is this for? Like the digraph example, that looks like it's re-implementing core parts of graphviz—is the idea that every clones and re-uses this implementation for their own digraphs? Because the implementation (".style" tab) looks quite low-level and laborious...

https://penrose.cs.cmu.edu/try/?examples=graph-domain/textbo...