I'd also be interested if anyone knows a relatively easy way to get edit-and-continue in CPython or maybe PyPy.
426 karma · joined January 21, 2017
blog.asrpo.com
Contact: asrp email com
I'd also be interested if anyone knows a relatively easy way to get edit-and-continue in CPython or maybe PyPy.
>>> from bounter import bounter
>>> bounts = bounter(size_mb=1)
>>> bounts.update(str(i) for i in xrange(1000000))
>>> bounts['100']
0L
should give 1. The description should be more upfront that you are getting inaccurate answers.> Bounter implements approximative algorithms using optimized low-level C structures, to avoid the overhead of Python objects.
"approximative algorithms" isn't a commonly used phrase (at least according to Google) and this sentence doesn't say anything about what the actual trade-off is (loss of accuracy in the counts). A possible alternative would be writing to hard disk so what trade-off is made isn't obvious.
I also don't know what the precision and recall percentages in the example table mean.
I wrote this tutorial mainly because I wanted to try and implement my own Forth interpreter so that I could have better control over how my programs are run (up to the assembly level anyways). Jonesforth is very good but doesn't let me easily see consquences of changes in implementation.
I tried to start with the parts that I thought were the main ideas needed to get a working language that's a bit higher level and easier to reason about (to me) than assembly.
As usual, I tried to make all sources short and/or not too complicated. That's probably going to be hard in Part 2.
I wrote the other goals of this tutorial in the post itself.
Tell me if this method works for you or not.
circle(x=time, y=-time*time, r=10)
so a render can get the information it needs but there aren't individual frames to edit.
In general, what happens to interoperability if different programs/projects represent the same things, like images and animations, very differently?
And how security could be handled in such a system? Either against a malicious or haywire programs/project?
I found this an interesting read anyways especially when they start parametrizing the quine by a function F near the end. Although my interest shouldn't be that much of a surprise given my username:
asrp: a self-referential person/program/place
https://github.com/asrp/pymetaterp The boot portion of this parser can its own AST from its own grammar and its own AST
https://github.com/asrp/tkui This GUI editor can modify and (re)generate itself. Its the "generate UI code" button.
https://asrp.github.io/blog/gui_toolkit This toolkit maker can (and is required to) make itself.
Could you give an idea of what the graph and interface would look like if the language we want to write in is Lisp?
It is indeed very string that we've settled on character based editors for making programs.
Now with fish, I don't need that anymore. Pressing up a few times always gets what I need and I don't need to come up with names for shorthands. (If I really want to name it, I can always add a # "tag" at the end. A trick I picked up from one of the post here (I can't remember which one).)
Although sometimes I do wish there was a keyword search feature treating space as a separator for what I've already typed. One frequent case is when I'm looking for `rsync --bunch --of --options user@server:path other_path`. I remember `rsync` and I remember `user@server` (or one of the two paths) but not the rest (and I also ssh, sftp, scp, etc to the same place a lot).
Has someone thought and wrote about this?
And there are other aspects that don't quite fit the information theory model (like using infix notation for operators or not, from Paul Graham's post).
I wish there was some course that could teach me language design so that I can (better) predict how my decisions will affect the final result.
Plus how much can reasonably I "pack" into the language [1] in terms of notation and cognitive load when used.
Maybe some resource about choosing notation would be nice too (as opposed to parsing notation once chosen). When I try to pick many ideas from different places, I'm sometimes surprised by collisions in notation.
In general, I have to idea in what model I have to run my estimates.
What are some examples of consequences taught through the course you linked to?
[1] I'm talking about textual languages only for now.
This did happen to me with daylight saving a while back so I do sympathize.
If that doesn't happen (like in the "parens" or "other" description), to use CYK, I think you could maybe have piece of the table for each substring (so for all entries with both indices inside the substring) in each node but then I don't think the operation at the parent is commutative. And you have to decide to copy the info from the children or not (if not, you'll spend an extra log n time looking down the tree).
I wonder if only wanted a printable character ASCII editor would simplify things a lot or only a little. And I guess no tabs.
> Part 2 Line breaking
I don't really understand the problem here. Can't we count the line breaks like anything else? Is it because that's not the values we want in the end?
> Part 4: Again, making this into a monoid is pretty easy. You store two copies of the (t, m) pair - one for the simple case, and one for the case where the beginning of the string is in a comment. You also keep two bits to keep track of whether the string ends or begins a comment. In principle, you have to do the computation twice for both cases, whether the first line is a comment or not, but in practice it doesn’t make the computation any more expensive: you compute (t, m) for the first line and for the rest of the string, and just store both the first value and the monoid sum.
What if a node of the rope contains an "end comment" and (later) a "("? What should the two pairs of (t, m) be? Now that substring might be entirely inside, outside or partially outside and inside a comment.
Although I do understand the general idea of computing the result for all possible initial/input state to achieve paralellism.
> 2. Fund people not projects — the scientists find the problems not the funders. So, for many reasons, you have to have the best researchers.
So yes, the total amount may be there but is now diverted.
P.S., thanks for answering some of the questions in here! Guess I should reformulate that last part.
https://news.ycombinator.com/item?id=14058502 (2 days ago)
https://news.ycombinator.com/item?id=14074622 (2 days ago)
I meant that bipartite matching was enough for getting the answer, not that the two are equivalent.
I did try to keep it short although some parts still (fortunately) shows how to come to those conclusion. That might give it the impression of being smart but the presentation is definitely selected among many idea and rearranged.
So right now, I can write the grammar G1 for a language L1 in Ohm and parse strings written in L1 by putting them in examples.
If L1 is a language for describing grammars (such as a Ohm with a slightly different syntax), one of the "example" could be the grammar G2 for a language L2. But then I can't give the editor examples of L2 to be parsed!
(Of course if L1 has extra semantics instead of just syntax, it wouldn't be easy to change anyway, except by editing the Ohm Editor's source.)
A sample use case:
G2 is something like this:
https://github.com/asrp/pymetaterp/blob/master/pymetaterp/bo...
The example/input written in L2 that I want to give it is something like this
https://github.com/asrp/pymetaterp/blob/master/pymetaterp/py...
I could of course, rewrite this input in Ohm's grammar just so I can visualize the parse in the Ohm editor but it would be faster if I only needed to write G1 (that is, G2 translated to Ohm but matching the same language as L2=L1) and make minor adjustments to the input.
A full translation of this "input" to Ohm would also make it harder for me to port bugs fixed in the Ohm version back to the original version.
The next step would be to make this input the grammar G3 and give it inputs which can be visualized in the editor.
I'm not sure if you intend to have the Ohm editor used like this or not though.
Very nice project, by the way. I really like how you show the parts of the inputs that matches, with the option of expanding rules.
In fact, I wish more projects based on Ometa and Ohm allowed this so there's a better chance they can bootstrap each other. Of course, some semantics might still be missing but at least parsing would work.
https://gist.github.com/jboner/2841832
Edit: Just realized halfway through that there's already a link to this from their page!
https://ohmlang.github.io/editor/
Ohm is the successor of Ometa. The editor shows which portion of the string are matched by each rule.
I've recently used PEGs to write a Python parser (parsing all of Python, except for possible bugs) in ~500 lines of Python [2]. Its entirely interpreted. No parser is generated, only trees.
I'll also add that Floyd's operator precedence grammar [3] includes an algorithm which can deduce precedences from a grammar.
[1] https://en.wikipedia.org/wiki/Parsing_expression_grammar
[2] https://github.com/asrp/pymetaterp
[3] https://en.wikipedia.org/wiki/Operator-precedence_grammar
I didn't think it was possible to get the whole thing into 500 lines (well, 502 lines but `Node.__repr__`, commented code and a number of other knick knack aren't needed except for debugging). At least top search engine results all point to using large tools and/or needing multiple passes of different kind which makes the subject sound complicated and hard to get anything even working.
Prompted by arcfide's project [1], I rewrote this one and the main part (boot.py) went down from ~600 to 100 lines. Of course, the features available are not the same but I'm starting to see why shorter code is easier to change globally. I'm much more willing to refactor (by hand) anything that only happens at most 6 times in the code! (And also maybe those other features aren't as useful as I thought.)
I wasn't sure how to count lines for this one. The generated tree contains no extra information (it can be regenerated from itself and the bootstrap grammar).
[1] https://news.ycombinator.com/item?id=13797797
[2] https://news.ycombinator.com/item?id=13825225
(both are not quite the same, just similar)