1,356 karma · joined Jun 19, 2017 (9y ago) · 591 submissions
comment 1y ago · link · parent
The parts on compile time execution are the better parts of the article, IMO. There’s food for thought here. The author might enjoy reading up on partial evaluation.
Then, fulfilling Greenspun’s 10th, the article reinvents Lisp macros.
comment 1y ago · link · parent
If it’s an expected call or they give me a good reason to, I’ll call their listed contact number back.
So far I have not missed out on anything of consequence by refusing to identify myself to someone who initiated contact with me.
comment 1y ago · link · parent
It turned out there a few places that had assumed a predictable - not just stable, but deterministic - hash key iteration order. Mostly this showed up as tests that failed 50% of the time, which suggested to me a rough measure of how annoying an error is to track down is inversely correlated with how often the error appears in tests.
(Other issues were mostly due to the fact that Perl 5 is all but abandoned by its former community: a few CPAN modules are just gone, some are so far out of date that they can't be coerced to still work with other modules that have been updated over time. )
comment 1y ago · link · parent
I can't really see a device like this getting used super heavily every day, so expecting it to still be usable from time to time for a few years seems reasonable to me.
comment 1y ago · link · parent
Regexes are effectively write-only. If you change the grammar parsed by a regex, you're probably going to discard the regex and make a new one.
comment 1y ago · link · parent
https://scholar.google.com/scholar?&q=Hinze%2C%20R.%2C%20Paterson%2C%20R.%3A%20Derivation%20of%20a%20typed%20functional%20LR%20parser%20%282003%29
Here's one for the semantics of the Cedille functional language core in which proofs are given as key components in symbolic language with prose to to tie them together; all theorems, lemmas, etc are given symbolically. https://arxiv.org/abs/1806.04709
And here's one introducing dependent intersection types (as used in Cedille) which references formal machine-checked proofs and only provides a sketch of the proof result in prose: https://doi.org/10.1109/LICS.2003.1210048
(For the latter, actually finding the machine checked proof might be tricky: I didn't see it overtly cited and I didn't go looking).comment 1y ago · link · parent
(Uncommonly, some papers - mostly those related to type theory - go so far as to reference hundreds of lines of machine verified symbolic proofs.)
comment 1y ago · link · parent
You can't, in Java, declare anything like "class Foo<F<T> extends Functor<T>>", or use a similar generic annotation on a method: you can't have an unapplied type-level function as an argument to another type-level function.
These things get a name in Haskell because they can be directly used as useful abstractions in their own right. And perhaps because Haskell remains very close to PL research.
comment 1y ago · link · parent
I waver between a belief that developers with curiosity about computer science topics will, over time, be quantitatively better developers, and the notion that these are niche topics with limited relevancy.
After all, it's very clear that the Java standard library design committee understands what monads are and where they're useful, since the library is littered with the things, but there's vast numbers of developers out there making effective use of futures, collections, optionals, and streams, building their own intuitions about what "flatMap" means you can get away with, all without reading any monad tutorials.
comment 1y ago · link · parent
The most widely recognised example, IMO, would be monadic parser combinators. "A parser for a thing, is a function from a string, to a list of pairs of strings and things."
comment 1y ago · link · parent
The "fully bright" part is a consequence of human vision. Your brain is making sense of limited, noisy information coming from your eyes. A flickering light appears brighter than the light in steady state, lots of still images shown in rapid succession look like they're moving, as far as you can tell you can perceive the full range of colour out of the corner of your eyes, and the dress could be either colour.
comment 1y ago · link · parent
Commercial interests have been assaulting truth since before I was born, nearly half a century ago. The methods for doing so have steadily improved. Social media briefly hindered it, before being co-opted thoroughly to advance it.
Even where the truth hasn't been completely buried, finding what's true and what's spewed from the firehose of bullshit is a time consuming and difficult task, one that definitely doesn't scale to very many of life's decisions at all.
Culminating this trend is the rise of the extreme right across the globe. This is tightly linked to politically motivated disinformation coupled with whatever the techniques are that are forming closed mind cult-like behaviours.
Maybe it's not an assault on truth - maybe truth is just collateral damage - but I don't think I could even pose it as a question to ask if you could convince me these things are not happening.
comment 1y ago · link · parent
I have no answers: just questions that haunt me, from time to time.
comment 1y ago · link · parent
(With some modifications to the code as shown, anyway: `lookup` is linear but used in such a way it can be replaced with a constant vector index, instruction lists can be compressed to just jumps & labels with byte counts following, avoiding the duplicate invocations of `p` in `arginf`, etc).
I'd be dubious that there's an algorithm to find the true minimum in less than cubic time, but there's plenty of "good enough" approaches: most branches will be definitely short or definitely not; jumps backwards can be resolved when encountered; jumps forward can be written long and replaced with a short jump plus no-op padding when the target is encountered within short jump distance.
comment 1y ago · link · parent
An LR parser will produce a parse tree, showing how the given token stream satisfies the parser's grammar - or an error, if the token stream doesn't satisfy the grammar. Your typical parser algorithm is deterministic, even if the grammar it matches isn't, so you'd expect to get the same parse tree for the same token stream, every time. By and large LR parsers (as described in TFA) are shift/reduce parsers: there's a bunch of states, and in each state the next token in the input stream determines if the state shifts (pushes the token onto a term stack and moves to the next input token) and jumps to another state, or reduces (pops a number of terms off the term stack and replaces them with the term being reduced to) and goes back to a prior state. TFA talks about the situation where more than one shift or reduce action is possible for a given state and input token.
An LLM uses embeddings. AFAIK the current state of the art algorithm (method, perhaps?) for this is still transformers with attention: roughly speaking, each token in the input gets projected into an embedding vector, a query vector, and a key vector; attention means that for each token, all other tokens with a key vector near to their query vector have their embedding alter the query token's embedding, allowing for context to have an impact. Multiple layers of attention can run one after another, eventually producing a final set of token values. Different embedding models use different means to pick one of those values (eg, pick the last one in the input sequence, if your query/key vectors tend to push information 'forwards' to following tokens), and that's your whole input's embedding. Neural nets can be deterministic, but those used for embedding rarely are: the values produced by repeated runs over the same input will (or should) always be pretty close, but generally won't be exactly the same.
comment 1y ago · link · parent
A source code hosting service has direct access to the "secret sauce" of a company built around proprietary software. A customer relationship management service has direct access to the "secret sauce" of a company built around sales and customer relations. A document management service has direct access to the "secret sauce" of a company built around confidential documents. A cloud hosting provider has direct access to the "secret sauce" of a company built around a database.
Everything's SaaS. Everyone's confidential and critical data is aggregated in some big provider's system. Except for a few paranoid (sensible? rational?) holdouts who aren't competitive as a result.
comment 1y ago · link · parent
For enterprise IT, it's got some potential. Devices users can't muck with facilitate standard operating environments, hot desks, and similar practices that are already user hostile. In that setting, there's no big deal here. It's even got the chance to be less awfully intrusive than existing SOE software.
It's also, IMO, a bit of a leveraging of a monopoly position to crowd out those SOE vendors. Microsoft's the only one who can make this device; anyone else is stuck at best making a browser-only thin client and hoping 365 works well on it for long enough to recoup R&D costs and make bank on top. Not a fan of SOE vendors, but not a fan of monopoly control either.
comment 1y ago · link · parent
If E were a different expression, perhaps "E h = let F i = if z == i + h then 7 else 8 in if y then F 1 else F 2", then the inlining choice (made twice, here) would be very poor - F would be inlined four times all up, and since "z" is a free variable here there's no constant case/if to fold, and everything would wind up worse.
The ANF transforms should look something like:
let
a0 = if x then 1 else 2
E h = if h == 1 then 2 else 3
in
E a0
Departing from my previous analysis, I'd say that the next obvious step is the inlining of the now-only-called-once E: let
a0 = if x then 1 else 2
in
if a0 == 1 then 2 else 3
But (either here or earler) that's not ANF, the "a0 == 1" isn't a simple constant or variable: let
a0 = if x then 1 else 2
a1 = a0 == 1
in
if a1 then 2 else 3
Let's take the time to rewrite all those conditionals and such as case statements: let
a0 = case x of { True -> 1; False -> 2 }
a1 = case a0 of { 1 -> True; _ -> False }
in
case a1 of { True -> 2; False -> 3 }
Now we can inline a0 into a1, since it's only called once: let
a1 = case (case x of { True -> 1; False -> 2 }) of
{ 1 -> True; _ -> False }
in
case a1 of { True -> 2; False -> 3 }
A case-of-case transform applies to a1: let
a1 = case x of
True -> case 1 of { 1 -> True ; _ -> False }
False -> case 2 of { 1 -> True ; _ -> False }
in
case a1 of { True -> 2; False -> 3 }
Two case of constant transforms on a1 apply: let
a1 = case x of { True -> True ; False -> False }
in
case a1 of { True -> 2; False -> 3 }
a1 can be inlined and case-of-case once again applied: case x of
True -> case True of { True -> 2; False -> 3 }
False -> case False of { True -> 2; False -> 3}
Case-of-constant again leaves us with just: case x of { True -> 2; False -> 3 }
And that's our desired outcome. We took some risks doing case-of-case because of the duplicated outer case, but that can be dealt with using join points for the expressions that get duplicated; a bit more long winded but the same end result here due to the case-of-constant transform eliminating the duplicate immediately each time, followed by an inlining of an expression evaluated only once.comment 1y ago · link · parent
if x then
let a0 = a in E a0
else
let a0 = b in E a0
If a and b are simple variables or constants the new “let”s will be eliminated by ANF.What happens to E isn’t so straightforward. In your example, though, it’s a small expression tree and would just be duplicated inline with the same obvious constant reductions available.
If it’s ‘large’ (heuristically) it might instead be assigned to a “let” binding outside the “if”, to avoid duplicating a large block of code.
CPS should be making that same determination on E.
comment 1y ago · link · parent
This isn’t identical to floating the call to E inside the “if”, obviously, but would have (within predictable boundaries) the same performance. If this code went through LLVM to produce machine code I suspect it would wind up identical as LLVM will likely rewrite the duplicated call to be outside the “if”.