Better HN
topnewbestaskshowjobs
Log inSign up

T-R

1,407 karma · joined Jun 14, 2010 (16y ago) · 438 submissions

Submissions

comment 8y ago · link · parent

Which is doubly disgusting, since the US is one of the only countries that double-taxes its expats.

comment 8y ago · link · parent

I think that's kind of his point - Optionals/tagged unions are "Null values", but only in the places where they semantically make sense.

The problem with nulls isn't strictly null references, in the sense of "a pointer that points to nothing" or "a pointer that throws a null pointer exception", it's that languages with nulls implicitly make null an element of every type. They tend to do this because variables are allowed to have null references, but if you changed the semantics of variables to technically forbid null references, but still had a null value as an implicit element of every type, you'd still have the problem of needing to do runtime checks for null everywhere.

comment 8y ago · link · parent

I think those single-letter names like "S combinator" are a holdover from Math notation, where it was a practical consideration, but in practice in functional programming, those names aren't used (I certainly haven't memorized them); If you look at the Haskell column on the page, you can see that they're actually named for readability (though it might not initially seem like it if you don't do a lot of coding in Haskell):

- K is "const" and C is "flip"; they're generally used to for arguments to a higher order function: "map (const 5) myList", "foldl (flip f) 0 myList"

- Psi is "on", since it's regularly used to construct a new function "h = f `on` g"

- S is a specific type of application, called infix as "f `ap` x", but also has an operator to intentionally make it look more like just line noise: "f < * > x". (Had to add spaces to this operator so HN wouldn't interpret it as italics)

The operators might seem opaque, but the idea is to make it more visually apparent that it's a pattern, not some application-specific business logic. There are lots of concepts of "apply" - there's pure application ($), Applicative application (< * >), Monadic application (=<<), etc. - writing them out would distracting to read. Using operators makes it easier to skim and get the general idea of how the code works without worrying about the underlying structural details, while still being precise about them.

comment 8y ago · link · parent

It's intentionally to get across the idea that you don't, and shouldn't, know anything about these arguments within this scope beyond "this is a function" and "this is an argument". These functions just define how to combine things; if you knew any more about the arguments, it would be breaking the abstraction.

The only better names you could really give are ones like func1, func2, arg1, arg2, which don't add any information, just add noise. Trying to get any more specific than that would leave the reader trying to interpret the meaning of the name, but the whole point is that it's strictly "apply this thing to that in this way, without looking at what they are". Even fix-point, which is unarguably cryptic, really needs a paragraph explanation for the unfamiliar more than it would benefit from better names.

comment 8y ago · link · parent

> They chose (perhaps felt forced to chose) to change their body to fit the stereotype.

This is kind of presuming the conclusion, and ignoring the stated experiences of the people being discussed. The concept of gender identity (whether or not it does a good job of it) is explicitly intended to highlight that the causation isn't "I fit this stereotype, therefore I am this", but just "I feel I am this", with the implication that it may (or may not) be reaffirming to fit in socially with other people who are that way. Many don't identify with the stereotypes. Sure, some cling to stereotypes - maybe because they previously felt constrained from expressing themselves, or just as a practical measure against getting misidentified - but that doesn't imply that that's the cause or the goal. If you don't believe the claim that it isn't the cause, that's fair, but then it's just a person's beliefs against anothers' self-assessment.

The term "transitioning" is also used in a general sense, including "being yourself", as opposed to necessarily taking hormones. Taking hormones, changing paperwork, doctor appointments, losing fertility, etc., is kind of a long, drawn out, stressful ordeal that inherently starts with "being yourself in your own body" until changes kick in; it's pretty unlikely that someone transitioning hasn't considered just not doing the hard part, especially since it's so slow that there's ample time to turn back.

I'd wager most trans people are as opposed to gender essentialism and gender stereotypes as other feminists are. Nothing about accepting that they might actually just not be comfortable in their bodies, or at least just letting them be, implies philosophically accepting gender essentialism. Moreover, making the world more accpeting of people just being themselves is pretty closely aligned with just letting trans people be - if they actually don't need to transition, they'd be less likely to in a world where those who don't fit stereotypes, like trans people, are more accepted. And it's not a verboten topic - the Reddit trans communities have these discussions pretty often, when the questions are asked genuinely. It's just that, as with other minority-focused topics, it's often brought up with the clear intention of harassment rather than having an actual discussion, so there's a low tolerance for things that signal disingenuousness.

comment 9y ago · link · parent

I can't speak to the complexity of this project, but for ROM hacking in general, it's not all too complicated, but it does take some persisence.

First you need to find code relevant to what you want to do. You can take diffs of memory as you do things in the game to narrow down where the relevant addresses are, and then set breakpoints on read/write to those locations to find relevant code. After that, you can mostly just follow the assembly - you can even read backwards up the call stack by reading to what look like the beginning of a procedure, and searching for jumps to that address. Once you've found the code you want to modify, you just need to find some empty space in the ROM that you can branch out to to write your code.

The trickier bit is if you're in a spot where you need to worry about timing. On older consoles, this included things like changing the HUD or wave effects, etc., since you need to make sure whatever work you do gets done in time for HBlank/VBlank.

Some consoles also had some built in functions that would give you an idea of what code was for, like the lz77 compression on the GBA, which was mostly just used for graphics. Similarly, DMA was most often used for copying sprite data. On newer consoles where code was often compiled from C (rather than assembly with macros), I'm under the impression you can also do things like try to pattern match on the signature of standard library functions.

comment 9y ago · link · parent

Impurity is a lack of constraints. You can, with impure code, write an interpreter for a language that constrains code to being pure, and implemented correctly, you can then depend on code written in that langauge to be pure.

His point is that there's no lost benefit in calling pure code from impure code - the code is already unconstrained. Calling impure code from pure code, though, means you've lost the purity constraint, which means you've lost the nice emergent properties you get from that constraint.

Even if you write 'pure' code in an impure environment, you can't depend on it being pure, because that constraint isn't actually enforced. No matter how pure I try to keep my Javascript, I can never depend on it being pure - there could be a bug, or someone could add impurity at the bottom of the callstack, breaking referential transparency.

comment 9y ago · link · parent

That's a fair point - seems related to the fact that people aren't writing as much anymore.

Anecdotally, I feel like Japanese picks a better point in the tradeoff space than other languages - Chinese characters are used where they get some leverage, with phonetics for everything else, even with a bunch of half-kanji words. Still, I'd imagine some of the less-commonly used ones will get dropped over time.

On the other hand, English+Emoji+Txt simplification seems to be approaching the same point from the other direction.

comment 9y ago · link · parent

> First, literacy isn't completely related to the writing system. Look at Spanish speaking countries, where the alphabet is more phonetic than the English alphabet.

Perhaps more to the point, Japan, which uses Chinese characters for nouns, adjectives, adverbs, and verb-roots, has a very high literacy rate. [1]*

[1] https://nces.ed.gov/pubs2014/2014008.pdf

* Not trying to cherry-pick for Japan being at the top, but Japan's not listed in the 2015 UNESCO report that's referenced all over the place. This US DoE report from 2013 seems legitimate enough.

comment 9y ago · link · parent

Practically speaking, things are more nuanced than the article would imply, though - they're not 3000 completely unique characters, and at least for a lot of nouns, the radicals do serve to broadly categorize things as, e.g. "related to water", which can serve as a reading aid similar to how root words do. The author further claims "With a phonetic writing system like an alphabet or a syllabary, you need only learn a few dozen symbols and you can read most everything printed in a newspaper.", but that's only accurate insofar as reading means "pronouncing"; it's a tradeoff with being able to infer meaning.

comment 9y ago · link · parent

They seem to be restocking in small batches and selling out immediately, at least online. According to nowinstock.net, in the US, Best Buy's been getting shipments most consistently, and received one as recently as last week. Some people find out what days they get shipments and just wait outside the door for them to open.

comment 9y ago · link · parent

It's certainly reasonable for a studies across fields with hourly pay or, e.g., including both part-time and full-time (such as the BLS survey cited by the Forbes article), but I'm not sure we can make that assumption for software development - programmer productivity in a given time period is, on its own, somewhat mythically considered to vary by orders of magnitude.

comment 9y ago · link · parent

> they didn't control for hours worked

Are the programmers in question being paid by the hour? Does programmer pay within each gender correlate closely to hours worked?

comment 10y ago · link · parent

Sure, Korean is phonetic, and so learning it phonetically makes sense, since you won't be forced to re-learn it again to be able to use your knowledge. Speaking from experience studying Korean, though, attaining a useable vocabulary through rote memorization is dramatically harder than if you're familiar with the 한자/漢字 words are derived from, for exactly that reason - even though hanja's not used directly so much in korean, we started studying it in the third semester of Korean class, and it was helpful, though I'd agree maybe a bit excessive there.

Games that use a strict hiragana character set are readable by natives because they're already fluent in speaking; they're unnecessarily difficult for non-native speakers, particularly since they tend to only have the bare minimum of separators between words. After living in 4 prefectures, working for a small Japanese company, and dating a native speaker for roughly a decade, I still find those games hard to read - it's just hard to identify the shapes of words, like reading English with no spaces; you have no choice but to guess where the boundaries are and sound everything out syllable by syllable, because everything's written differently from how you'd see it anywhere else.

If some people want to put off kanji or memorize phrases from a travel guide, that's their prerogative, but not teaching the compositional aspects of kanji, and leaving students to fend for themselves after selling the idea that it's all rote memorization (and seemingly to push this implausible ethnocentric dream of the language one day being exclusively romanized) is just a disservice to the students, as it was to me.

comment 10y ago · link · parent

They're not reasonably separable. Memorizing romaji, or even strings of hiragana, removes the associations between root-words that are related, like those radicals that let you identify menu items, and removes the visual aid for identifying root words in context. Memorizing associations between arbitrary groups of sounds without the radicals is actually harder, it just sounds easier to those intimidated by the idea of learning characters.

Given, much to Mair's displeasure, that actual native media is written with kanji, they're immediately necessary, and not studying kanji effectively bars students from any learning outside the classroom until they have - which is completely counter to giving students either the context necessary for immersion or the reinforcement for traditional study to work.

Maybe it's merited for Chinese classes, with its larger character set, but Mair's approach just sacrifices students' ability to learn on their own in favor of lowering attrition rates of intro-level classes. It's actively harmful to students aiming for fluency to build up the characters as this insurmountable mountain in the distance before they can actually use their knowledge, rather than the useful compositional blocks and visual aids that they are.

comment 10y ago · link · parent

> pay little or no attention to memorizing characters

I'm not usually one to speak bluntly, but, at least for Japanese, speaking from a lot of experience, this is flat out the wrong approach.

Older books like the romanzied "Japanese for Busy People" took this approach. I started with this book, it felt easy at the time, but it was immensely impractical - you don't build up enough of a base to learn from any other material. It's completely useless. After over a year, in a formal setting, I ultimately decided to just completely start over.

Currently Japanese courses mostly just focus on Hiragana and Katakana, since material for children usually has pronunciation guides over the kanji anyway. This is workable, but it just gives you no leverage where you could have some - you end up memorizing a thousand indiviaul words, some of which maybe kind of sound similar in parts, when you could instead learn a dozen charcters, and know that they share root words. Phoenetic approaches work for children who are in a situation where they can memorize from immersion with native speakers, and have additional clues like context and intonation to emphasize root words, to pick up new vocabulary.

When I started studying Chinese, we instead went with a "radicals-first" approach, and after just a short time of that, my Japanese vocabulary exploded - I could suddenly pick out all the seafood on a menu, and I started asking people mid-conversation "oh, does that use these characters?", and I could understand what it meant without them having to struggle to translate to English: Heart+Electric+Map - it's probably an electrocardiogram, especially if we're talking about hospitals. If you haven't learned the kanji, you don't even know if you can make that association from the sounds, much less how to ask that question.

That's how you get to fluency, by building up a foundation that lets you learn without active study. You can't get there by avoiding the basis of word composition in the language. Apologies if my frustration with characters-last approaches came through a little strong - they wasted a lot of my time.

comment 10y ago · link · parent

"standard 12pt font" is biased for latin characters, though - at the larger font size, the Chinese characters are still getting much better information compression than the latin characters, which need to expand horizontally by using several characters per unit of meaning, plus separators (spacing and hyphens) to even be readable. In practice, even adjusting for font size, paragraphs of Chinese and Japanese are almost always shorter than latin-language equivalents.

Of course, the real winner of this argument is probably Korean.

comment 10y ago · link · parent

Kanji isn't so bad - most of the more complex characters are built up out of smallers ones, and even the smaller ones, as the article breifly hints at, have a primary radical that roughly categorizes it - learn the radical for "water", and you can identify all the seafood on a menu, even if you can't read a single character. They're actually really helpful for both comprehension and reading speed, like learning latin root words would be for English, but a lot more consistently applicable, so it gives you a lot of leverage.

The stroke order seems annoying at first, but it's pretty consistent, and actually really helpful for memorizing. The different pronounciations also seem intimidating at first, but for the most part:

- One's for composing with other characters

- Others are mostly variations on that one for fluidity, where people will still understand you if you get it wrong

- There may be one for when it's used on its own, that gets used so often you quicly think of it as basic

- Anything else is probably an edge case that you'll never see

tl;dr: Don't let the Kanji intimidate you

comment 10y ago · link · parent

Thanks for the link. I'm actually under the impression that the situation in Haskell will be changing in the near future with the project called "Backpack"[1][2], which Simon Peyton Jones and Simon Marlow are both involved with.

[1] http://plv.mpi-sws.org/backpack/ [2] https://ghc.haskell.org/trac/ghc/wiki/Backpack

comment 10y ago · link · parent

Distributed Programming was one of the things flagged "Immature" in State of the Haskell Ecosystem [1]. Just out of curiosity, was that a motivation behind the project, or do you have any other thoughts on that post-project?

[1] https://github.com/Gabriel439/post-rfc/blob/master/sotu.md#d...

comment 10y ago · link · parent

That's more or less it. Some things you can do:

- Dataflow analysis, to get an idea of the types/range of values you're working with

- Pattern matching to try to identify higher level constructs from math to loops to jump tables.

- Compiler-specific pattern matching to identify things like function entry points

- Signature pattern matching common functions (like C standard library calls), along the lines of what's used in High Level Emulation.

comment 10y ago · link · parent

This is maybe true, given that Rust is intentionally multi-paradigm, but it's a pretty unfair comparison: My FP-style version deliberately made almost no changes to the original code aside from adding names - I even stated in the comment that I don't even know Rust (haven't touched it beyond knowing what "Affine types" means, and once having gotten someone else's "hello world" to compile for ARM). The imperative version you're comparing it to completely changes the semantics of the program, and is written by someone very familiar with the language.

comment 10y ago · link · parent

Oh, it definitely pops up a fair bit, but it really is just not-well-factored code. It's a direct parallel to having long boolean expressions, or long equations without breaking out any sub-expressions and storing them in named variables - after all, functions are just sub-expressions - which is something Code Complete specifically advocated against in procedural/OOP code.

Some people seem to fall back into it a bit when they discover point-free style (and that seems to make up a lot of what you see in mixed-paradigm code). I don't think it'd be controversial to say it's bad practice in any paradigm, so the association of it with FP is kind of like judging web programming by late 90's beginner PHP code (which, at one point in time, did describe a lot of web programming, but it was never good, and we'd like to put that behind us).

comment 10y ago · link · parent

I think the issue with procedural loops (not to be critical, just in general) is that there's no abstraction - it's not clear what's getting mutated, or what the result is (or its type), it's harder to look at the individual steps, and it's harder to refactor.

The nice thing about functions like "map", "filter", "fold", "flatmap", etc., is that they describe intent - when you see a "map", you know it's not aggregating things, just applying a function: "map" has a distinct purpose from "fold" (and depending on how pure things are, you may not even be allowed to do anything crazy).

Aside from that, the higher-order functions have pretty intuitive algebraic laws for refactoring (like with "compose" mentioned in my other comment) - It's not clear how you'd factor code out of a nested loop without understanding the whole thing, whereas "flatmap" (a.k.a. "bind" for the list monad) has laws for refactoring it.

comment 10y ago · link · parent

> a closure works fine, so `|fname| to_buff_reader(check_err(open_file(fname)))` would work

Ah, yes it would. Clearly I'm a bit too tired to be writing code, if I've overlooked function application. I suppose it doesn't have to be point-free. =)

Pretty cool, though - thanks for the info.

comment 10y ago · link · parent

Please, please, please don't associate inlining everything with functional programming. Lambda-lift and name those functions. If you name them, you can ditch most of those comments, too (by moving that information into the names). Not too familiar with Rust syntax, but (to rewrite without changing semantics) something like:

    let open_file = |fname| (fname.as_str(), fs::File::open(fname.as_str()) );

    let check_err = |(fname, f)| {
      f.and_then(|f| Ok((fname, f)))
        .expect(&format!("input file {} could not be opened", fname)) };

    let to_buff_reader = |(fname, f)| (fname, io::BufReader::new(f));

    let line_to_words = |line| {
      line.unwrap()
          .split_whitespace()
          .map(|w| w.to_string())
          .collect::<Vec<_>>().into_iter() };

    let get_file_words = |(f, file)| {
      file.lines()
          .flat_map(line_to_words)
          .collect::<HashSet<_>>().into_iter() // prune duplicates
          .map(move |word| (word, f)) };       // emit inverted index entry

    let add_to_index = |mut idx, (word, f)| {
      idx.entry(word).or_insert(Vec::new()).push(f);
      idx };

    let idx = args.iter()
      .map( compose(to_buff_reader, check_err, open_file) ) //[1]
      .flat_map(get_file_words)
      .fold(HashMap::new(), add_to_index);
[1] Does Rust have a compose function? I hope so. If not, you may need 3 successive "map"s. And stream fusion.

comment 10y ago · link · parent

The grandparent brought up the concept of a community problem where members from a community actively seek out and mock members of another, completely unprovoked. I won't argue whether members of the Haskell community do it or not - I haven't seen it, maybe I've just missed it, but it's terrible if they do. Whether you think it's a particularly good example or not, I'm merely pointing out that it happens a fair bit in the other direction here on HN, and the community either supports or turns a blind eye to it.

That's what's obnoxious about that comment - it's completely unprovoked trolling, and yet it was heavily upvoted. Of course the first reply disagrees with it - If I go to a thread about a Ruby library and insult people for wanting to use Ruby, you'd expect the top reply to disagree. What you'd hope not to see is for that trolling comment to be overwhelmingly upvoted to the top, and for the community to be making excuses as to why in this instance it's ok.

If someone's not interested in some content, or disagrees with it, that's one thing, but to actively find, mock, and seek community support in ostracizing people who are interested in learning it because of that interest - I'd argue that's anti-intellectual by definition. But whatever you want to call it, it's, as the grandparent comment stated, a community problem. Sadly for the author of that comment, the HN community excuses that sort of behavior - it's just different from the wonderful folks in whatever language community they're used to.

comment 10y ago · link · parent

I think that's changing. A lot of the over-proliferation of operators came from missing functions (like Data.Function.(&)), missing typeclasses (Like with Data.Lens or other generic operators), or missing sugar (like Applicative Do or Idris' bang notation).There's definitely some cleanup work since the ecosystem's changed so much, though.

comment 10y ago · link · parent

Lazy IO's an issue, but Lazy Evaluation? It's not that different from writing SQL, and the places where it is, it's a lot more consistent, predictable, and tuneable. It's usually just bad defaults like Lazy IO, or String instead of Text that get you, but there's some consensus to move away from that.

There are definitely some toxic assholes, as in any community, and it's really shitty if they're going to, e.g., /r/java and harassing people. I feel pretty strongly that the opposite is a more common problem, though, particularly on HN: the anti-intellectualism against functional programmers, and Haskell users in particular, is rampant and gets pretty offensive. Example off the top of my head - https://news.ycombinator.com/item?id=10527745 - article simply explaining a math concept gets, as what was the top comment at the time, a condescending comment calling it all "mental masturbation". I've stopped reading HN so much because it's pretty clear that people trying to learn abstract algebra and apply it to code aren't welcome here.

12345
15