[1] can anyone help me with clarity here as to why triple stores failed? Is it because no :db/retract and no time axis so cache consistency problems? or a deeper reason?
Why Don't We Have a General-Purpose Tree Editor? (2014)
211–220 of 222 posts
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#212Earlier quoted context omitted.
Your representation is certainly valid , but I think those properties (light-weight, intuitive, etc.) apply to your example rather than your representation. For example, imagine representing the HTML of this Hacker News page in your format; it would be completely unwieldy, and Hacker News is notoriously simple as far as HTML goes. It's clear that this representation is massively space inefficient, since it repeats th…
>> For example, imagine representing the HTML of this Hacker News page in your format; it would be completely unwieldy, and Hacker News is notoriously simple as far as HTML goes. Well yes, but that's because HTML is a mess, not because graph notation is unwieldy. In any case I don't think it's a good idea to try to program in graph notation, or anything like it. Actually, I think it's a terrible idea. Unless you want…
It does prevent some errors, like malformed structures. For example, the following Lisp:
(defun (square x (* x x))
Or the following C: void square(int x {
return x * x;
Or the following Ruby: while $i
These sorts of things can occur when manipulating programs at the character level, but they're inexpressible at the level of parse trees/graphs. Balancing parentheses, braces, quotation marks, begin/end, etc. is exactly the sort of task that machines can automate away.The idea of a general tree editor is not to prevent syntax errors, undefined behaviour, etc. because those are properties of specific trees, e.g. the parse trees of C programs. A tree editor just edits trees; it doesn't care what those trees represent (that's why the author mentions a plugin mechanism, like Emacs has different modes for editing files written in different languages).
Manipulating programs at the level of parse trees can also be more efficient, less tedious and prevent errors, e.g. see the paredit videos linked in other comments. By analogy, what's the point of a general text editor, when our CPU can already perform arithmetic on bytes? A general text editor doesn't prevent syntax errors, undefined behaviour, etc. Does editing strings of text, rather than numerical bytes, provide expressive power or syntactic clarity that we don't have with high-level languages already?
I also don't think the author was asking for something "graphical" or "GUI" per se; their analogy is with text editors (e.g. Emacs and Vi), which are efficient both in their display and their interaction. A general tree editor wouldn't be based around e.g. drag'n'drop of nodes/edges, in the same way that general text editors aren't based around drag'n'drop of glyphs in a grid.
General text editors have features for moving to the start/end of a line, for cut/paste up to the next space or linefeed, for highlighting parentheses, for folding/unfolding between sentinel characters, etc. General tree editors would instead have features to move to the root/leaf of a tree, cut/paste sub-terms, fold/unfold expressions, etc. No need to care about the existence of whitespace, linefeeds, indentation, parentheses/delimiters, etc. they can all be handled mechanically.
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#213Trees are graphs with out cycles but you always end up adding cycles. Code is no exception. There have been endless attempts to create coding systems based on graphs. These systems promise extraordinary modularity and reusability and an ease of programming which will allow anyone to construct complex software with a few clicks and drags. So far everyone of these systems that I have seen in the last 25 years has falle…
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#214We do: http://strlen.com/treesheets/
I just tried this on macOS. I really like the concept but: It does not conform to macOS UI standards (I could live with that), and it is very slow (I cannot live with that).
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#215We do: http://strlen.com/treesheets/
Seems like a enhanced personal wiki and away from PIM style and more added MindMap style. I would say this is not a tree editor.
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#216Earlier quoted context omitted.
>> For example, imagine representing the HTML of this Hacker News page in your format; it would be completely unwieldy, and Hacker News is notoriously simple as far as HTML goes. Well yes, but that's because HTML is a mess, not because graph notation is unwieldy. In any case I don't think it's a good idea to try to program in graph notation, or anything like it. Actually, I think it's a terrible idea. Unless you want…
> Manipulating graphs, er, graphically, will not give you some sort of magical get-out-of-jail-free card against syntax errors or undefinable behaviour etc. It does prevent some errors, like malformed structures. For example, the following Lisp: (defun (square x (* x x)) Or the following C: void square(int x { return x * x; Or the following Ruby: while $i These sorts of things can occur when manipulating programs at…
A trivial example of this are input fields which enforce a lexical format. For instance, we can implement an input field for a floating-point number where you simply cannot type some garbage like "1.E". What happens is that you type "1" (so far so good), then then "1." (still good) and then "1.E" (good prefix, but bad). Since it is a good prefix, the "E" is allowed, but the validator automatically inserts some suffix to make it valid, like 0. So you see "E0". The 0 is selected so that the next thing you type will replace it. But if you type some garbage like Z, it will be rejected; at that point you may only type a + or - sign, or a decimal digit.
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#217Earlier quoted context omitted.
How do you feel about tools like Reaktor, which I assure you works very well indeed?
Reaktor is a audio program. There is actually a long history of this type of app working well. PD is an early example. This is indeed a limited type of programming. Above I was referring to attempts to apply this idea to general programming. I'm not saying such systems are impossible just that it's a bad idea to assume it will make the programmer's life easier.
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#218Earlier quoted context omitted.
> Manipulating graphs, er, graphically, will not give you some sort of magical get-out-of-jail-free card against syntax errors or undefinable behaviour etc. It does prevent some errors, like malformed structures. For example, the following Lisp: (defun (square x (* x x)) Or the following C: void square(int x { return x * x; Or the following Ruby: while $i These sorts of things can occur when manipulating programs at…
We can have editing methods that are character-based, yet which make those kinds of syntax errors impossible. A trivial example of this are input fields which enforce a lexical format. For instance, we can implement an input field for a floating-point number where you simply cannot type some garbage like "1.E". What happens is that you type "1" (so far so good), then then "1." (still good) and then "1.E" (good prefix…
Your example doesn't work very well, since it's very specific (the author wants "general-purpose"), and I would say it's not actually a "character-based editing method": it has a keyboard-driven UI and a character-based display, but so does NetHack. Instead I'd say your example is a float editor, rather than a 'text editor with syntax rules'.
In any case, there is an example which is close to a general-purpose tree editor that's is keyboard-driven with a character-based display: paredit mode in Emacs, as mentioned by other comments. It's implemented exactly like you describe: many keypresses correspond to the insertion of their respective characters, but when that would invalidate the tree structure (e.g. '(' and ')' keys), different actions are taken instead. For example, '(' inserts '()', whilst ')' "steps over" existing ')' characters rather than inserting extra ones.
My issues with paredit, as I've written in other comments, are that it's stuck with a single representation of trees as parenthesised s-expressions: there's no way to alter the "view" of a tree, e.g. to a boxes-on-sticks view or a nested-boxes view (whether they're displayed using ASCII art or GUI widgets). It also leaks implementation details, e.g. altering the alignment or indentation of expressions will cause the file contents to change, despite having nothing to do with a tree.
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#219Earlier quoted context omitted.
def f = x = readline; g x def g x = print x; f
Not 100% sure how to interpret this piece of code, but my naive interpretation gives this AST: (def f () (let ((x (readline))) (g x))) (def g (x) (print x) (f)) Writing in Lisp can open one's eyes about the underlying structure of the code.
[1] Unless your "tree"-view is actually a lazy call-graph …
Re: Why Don't We Have a General-Purpose Tree Editor? (2014)
#220Earlier quoted context omitted.
Thanks. Or you can always use what I think is slightly informal notation, where a directed edge is notated as a -> b (I've seen that in textbooks, but I'm not sure where it's coming from).
Haven't seen this notation in text books so far, but I guess one of the following 3 things happened: (1) The notation a->b was defined as a simple shorthand, i.e. a->b := (a,b). (2) The notation a->b was defined to be the graph consisting of just a, b and the edge, i.e. a->b := ({a,b}, {(a,b)}) ... this may be followed by some algebraic rules about how to combine small graphs to build larger graphs. (3) The notation…
I guess it's convenient notation for a typical step in those algorithms, where two edges are oriented towards a common vertex- shown as A -> B ___________________
[1] Causality; models, reasoning and inference:
http://bayes.cs.ucla.edu/BOOK-2K/
[2] A Fast Algorithm for Discovering Sparse Causal Graphs; Peter Spirtes & Clark Glymour:
http://repository.cmu.edu/cgi/viewcontent.cgi?article=1316&c...