art-w
Joined 12 years ago
Joined 12 years ago
is_descendant(A, B) ->
lists:all(fun ({Actor, Event}) ->
Event =< proplists:get_value(Actor, B, -1)
end, A).
compare(A, B) ->
A_in_B = is_descendant(A, B),
B_in_A = is_descendant(B, A),
{A_in_B,
B_in_A,
A_in_B and B_in_A,
not (A_in_B or B_in_A}}.
The function `is_descendant` is nearly a translation of your APL code. I'm not convinced that we need APL on the Beam, for the quality of this VM certainly isn't in its array processing capabality... but I was expecting the argument "such an array-oriented language would motivate improvements in this direction", which is definitively true!APL-enthousiasts often forget that APL forces you to use its builtin operators, while modern languages provide means to implement them (and aren't restricted to arrays). lists:all isn't a builtin in Erlang, but does it really matters that you can write it as `^/` in APL?
Note for functional programmers: `^` is the boolean AND operator, `/` is `fold`, and somehow there's an APL builtin hack so that `fold` knows that 1 (true) is the monoid identity of `AND`... but really `^/` is a compact notation for `fold (&&) True`
For completness:
all(_, []) -> true.
all(Pred, [X | Xs]) -> Pred(X) andalso all(Pred, Xs).
get_value(_, [], Default) -> Default;
get_value(K, [{K, V} | _], _) -> V;
get_value(K, [_ | Rest], Default) -> get_value(K, Rest, Default).http://people.ucalgary.ca/~rzach/static/open-logic/open-logi...
Summary: They are going for the foundations of maths, computer science, and logic with completeness, decidability and computability on the menu. I don't know the authors, and I understand your reticence, but the contents looks really good. It's not the kind of logic a practitioner would care about, probably, but it is the big mathy results that logicians do need to learn: they actually mention that this isn't a new course for them, but rather a reference book for lessons that are already given to philosophers.
It's also clearly not written for people who are afraid of maths -- I'm more concerned about their targeted audience. Can you go through that text without an already solid interest in maths?
I agree that triangles look a lot better than squares (to the point that the "swastika effect" is indeed a problem, even though the drawings are generated by a human, and not randomly.) However, they are also very hard to draw properly.
To recover the QR code decentralization, have you tried to encode data inside your triangular grid? You would loose the "drawable" property (due to the size), but the result would still look more interesting than the pixel junk of QR codes (and you could enforce "connectivity" for aesthetic and error correction.)
- Everything gets recomputed on any minor change.
- If a cell is referenced by N other cells, it will be recomputed N+1 times on every update. Worse, this can be exponential for A2=A1+A1, A3=A2+A2, which leads to A1 being recomputed 5 times. There's no sharing or memoization.
- Circular references are detected because they trigger a "too much recursion" exception.
- An impure cell "=Math.random()" will be observed with different values by its dependencies.
Here's a presentation that dives into loeb and expands it to a comonadic fixpoint that lets you do the fibs example correctly: https://www.youtube.com/watch?v=F7F-BzOB670
Furthermore, Incremental isn't memoizing every function calls. It just keeps the intermediate results of the latest computation in memory, so that when the inputs change, it can determine exactly which subresults need a recomputation, and which can be reused. It's like Excel, but with dynamic dependencies.
(But yes, Haskell definitively does not do this. You could say that Haskell is about doing the least amount of work to compute something fresh, while Incremental is about working the least to recompute something we (almost) already computed just before.)
- https://arcan-fe.com/ which introduces a new protocol for TUI applications, which leads to better interactions across the different layers (hard to describe! but the website has nice videos and explanations of what is made possible)
- Shelter, a shell with reproducible operations and git-like branches of the filesystem https://patrick.sirref.org/shelter/index.xml