Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
spion
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
80 ms
·
841.
▲
by
spion
9y ago
Most nutritionists like to cherry pick studies that support their cause (even when they're low quality observational studies) and attack studies that oppose it. Michael Greger (the author of nutritionfacts) is quite the typical example
842.
▲
by
spion
9y ago
I think my example captures the spirit of this: https://news.ycombinator.com/item?id=16049441
843.
▲
by
spion
9y ago
The example wasn't perfect, but no, it wouldn't be that. What if in the future we have a screen that needs to show more than one save form? Then we'll need to stop using the "save" element id as a mechanism to denot
844.
▲
by
spion
9y ago
Here are 3 more questions: * Are these tests relying on API that is likely to change? * Can I make the API surface area used by all tests even smaller? * Can I make a library that wraps the existing API of the unit to get a sma
845.
▲
by
spion
9y ago
This should actually be fairly easy even now, simple grammar analysis could discover whether the sentence is directed at Alexa or is simply about Alexa. But of course its much easier to require "Hey"
846.
▲
by
spion
9y ago
MobX+React would be just like Vue, but with the benefits of the larger React ecosystem and full type checking with typescript/flow, and the drawback of mandatory build tooling.
847.
▲
by
spion
9y ago
This is not about the size of the system. You really cannot predict how the system will work, since its observing input from the outside and constructing its actions based on it. Sure, there are ways to ask some ML systems why they made a d
848.
▲
by
spion
9y ago
Haskell offers runST and runSTArray, which let you do mutation
849.
▲
by
spion
9y ago
In the case of 'break', it breaks out of the block of the current construct (loop, switch). with brings an object in scope, or calls something already in scope with the object as a this argument - the semantics will be exactly opp
850.
▲
by
spion
9y ago
Yeah well, it is what it is. Instead of having alternate syntax to pass the first argument, we can at least get first class syntax to pass a custom `this` argument. That will at least allow us to talk about `this` being a function argument,
851.
▲
by
spion
9y ago
No, there aren't two callable types in JavaScript. Thats precisely the point. Every single function has a `this` argument: function f() { return this + 5; } But there are only two ways to call it: f.call(5) // ca
852.
▲
by
spion
9y ago
That would muddy the water even further, since `with` normally brings object members into scope. This is specifically about calling a non-member that is already in scope, as if it were a member. Its exactly the same as `freeStandingFuncti
853.
▲
by
spion
9y ago
That example is still explained by the simplistic model. You have a function function setTimeout(callback, delay) { do the set timeout thing, at the right time, call callback(); } You pass a function argument to it, but you're n
854.
▲
by
spion
9y ago
Because I said left to the dot at " call time ". More succintly: > When you call a function, whatever is left of the dot is passed as the `this` argument The analogy is pretty good - you can't pass an argument to a functio
855.
▲
by
spion
9y ago
I meant "bound", sorry. Funny that you mention "::" in Java. ES7/ES8 was going to have a bind operator "::" that extracts a bound method with a slightly different syntax. i.e. `::f.bar`
856.
▲
by
spion
9y ago
All languages have different semantics. Otherwise they would've been one language. Python has an explicit self that is unbound. Other languages have it implicit and bound... Etc
857.
▲
by
spion
9y ago
So theargument has a default value when in non strict mode, and like all other arguments you can partially apply it with bind. Got it. Everything else, still explained by ”argument passed left of the dot at call time“ Oh yeah and arrow func
858.
▲
by
spion
9y ago
`this` is hard to learn. No it isn't. Its a function argument that is implicitly passed "left of the dot". Whatever object that function was attached to when you call it? Thats the object thats gonna become the `this` argumen
859.
▲
by
spion
9y ago
AFAIK lifting is informal and specifically refers to lifting functions. Confusion arises when this is accomplished via Applicative which... erm "lifts" currying itself.
860.
▲
by
spion
9y ago
> Lifting is when you take a value and put it into an object like a functor. It should probably say: > Lifting is when you take a function and make a version of it that operates on functors / applicatives.
861.
▲
by
spion
9y ago
Here is assocIn variant 1 type in TypeScript: declare function assocIn<T, K extends keyof T>(t: T[], x: [number, K], val: T[K]):T[] You can try it out: https://goo.gl/3JrmX3
862.
▲
by
spion
9y ago
The reason why our satiety mechanisms don't work is because carbs upregulate insulin, which supresses leptin [1]. Leptin and ghrelin are the two main hunger hormones; leptin tells our brain we're full. The signal doesn't work
863.
▲
by
spion
9y ago
And in fact they have to be converted to fat. There are only two other options: stored in muscles as glycogen - however, the muscle stores can only store up to 1600 calories so they may be full. Also, once sugar gets into a muscle it can&
864.
▲
by
spion
9y ago
Because the rules for parsing it would be more complex. That would be an exercise for the student: How would you describe the rules? Then the teacher would show them all these edge cases they haven't considered, taken from real program
865.
▲
by
spion
9y ago
Ok I think I figured out how to use a template with a slot in the spinner component: <div> <img v-if="this.status == 'pending'" src="https://media.giphy.com/media/10k
866.
▲
by
spion
9y ago
For a single expression some of it can be omitted: { do { if (condition_expression) template_evaluation }} But I gues thats not really better. I'm hoping jsx will eventually default to `do` expressions though, and then it become
867.
▲
by
spion
9y ago
Great, here are my thoughts on it 1. Render methods make vue basically the same as React plus MobX, right? (and afaik you can use JSX too) 2. The spinner component was registered in the global scope. Will normal build tools know about the f
868.
▲
by
spion
9y ago
Personally I prefer the ternary operator in those cases, however I think do expressions will fix most of the if/else awkward stuff: https://babeljs.io/docs/plugins/transform-do-expressions/
869.
▲
by
spion
9y ago
You can use a tslint rule to block casts. That way you will only be able to use type guards to change the type of something.
870.
▲
by
spion
9y ago
To me the whole idea of client-side HTML templates seems bad. They start out easy enough, but then they either limit you in power or introduce new and weird concepts to replace things that are easy, familiar and often better designed in the
More ›