Live data from Hacker News

Conversations with a six-year-old on functional programming

byorgey.wordpress.com

311–319 of 319 posts

Re: Conversations with a six-year-old on functional programming

#311
post #73

Earlier quoted context omitted.

Well, a linear function is a function where you can only use the parameter once when expressed in its Taylor expansion. E.g. these are not linear: x^2=x*x (used twice), exp(x)=1+x+... (used infinite times). It’s a very symbolic way of thinking about it though, and not what you usually consider an important property of linearity.

Not all linear functions possess a Taylor expansion, as not all linear functions are continuous, example: https://en.wikipedia.org/wiki/Discontinuous_linear_map But, your statement is true for all real-valued linear functions AFAIK.

That is a badly written article. And the ones for linear map and continuity linked there, which would be important to the topic, too. The good mathematical articles start with a definition after the intro.

So much for teaching year olds. This is not rocket science, but mathematicians (almost inherent) inability to have language skills makes it seem so, notably.

Re: Conversations with a six-year-old on functional programming

#312
post #232

Earlier quoted context omitted.

Your comment seems confused in exactly the same way as coldtea's. How are you imagining turning input 20 into output 6 without acting on the input? If you don't act on the input, you have an identity function , not a constant function. Constant functions must alter their input whenever it doesn't match the constant output. Nobody ever complained that the problem with Procrustes was that he didn't do anything to the g…

Functions don't alter anything. 20 is still 20 even after you evaluate f(20) to be 6.

That's where linear logic differs, if you will. The highest voted comment in this sub-thread already alluded to that.

Re: Conversations with a six-year-old on functional programming

#313
post #254
post #125

Earlier quoted context omitted.

I think the problem is that our intuition is more or less based on a mechanical world in which the concept of a side-effect free or ineffective input is foreign.

I suspect it's more that our intuition is that everything is meaningful, or at least something is, so when the solution to is to ignore the only thing you have at hand , it's hidden in plain sight.

This goes so far that the phrase "nobody knows" is described by grammarians as having a zero pronoun, ie. "nobody knows (it)". "it" doesn't need to be specified, because nobody would know what it is, and so nobody cares. Correspondingly, functional programmers use to write "f(_)" and in prolog for example that acts as a catch all glob operator, if I recall correctly, not sure about Haskell.

Re: Conversations with a six-year-old on functional programming

#314

Earlier quoted context omitted.

The gist of music theory: It sounds interesting when sounds with simple frequency ratios are played at the same time. E.g., playing a 440 Hz tone at the same time and 660 Hz tone has a 2:3 ratio. Some combinations of frequencies, when played before or after other combos can establish an expectation and then either fulfill it or negate it. E.g., if you take the ratio above and then play 440 + 587, it'll sound like it'…

Wow, that's really not what music theory is at all. This kind of eggheaded simpletonism is grossly offensive and embarrasses the HN community, not to mention engineers in general. Please, the world outside of STEM is not reducible to a few hand-wavy sentences about physics.

It's more about the ratios than the example frequencies I provided. That's more apparent if you play an instrument with an exposed string and a finger-board but still true if it's hidden under e.g., the hood of a piano. The definition of consonance versus dissonance is basically whether or not the ratio is simple. The overtone/undertone series from which the various scales are derived is also one only one logical step away. One step past that gets you to diatonic harmony which leads to harmonic progression/retrogression which makes up the bulk of my theory text book and the real gist that I was getting at.

If you can provide a better overview or point out how it's anything more than a bunch of terms/shorthand for sonic patterns, I'd love to be informed.

Re: Conversations with a six-year-old on functional programming

#315

Earlier quoted context omitted.

This comment would be valuable if it provided some support to the assertion that the original author was wrong.

The problem with the above explanation is that it starts at a lower level of abstraction than is warranted. Analogously, it explains MOSFET's rather than algorithms. The fundamental unit of Music Theory is the Interval (as in "frequency interval between notes"). A better explanation would have explained Intervals, how particular combinations of Intervals form various Scales, and how Scales influence Chord Progression…

> The fundamental unit of Music Theory is the Interval (as in "frequency interval between notes"). A better explanation would have explained Intervals, how particular combinations of Intervals form

Guess what... A perfect fifth is a 3:2 ratio/interval of frequencies (+/- a small allowance for the historical/mechanical constraints that lead to well/equal tempering unless we're talking modern micro-tonalism in which case no adjustments are necessary). The inverse, 2:3, is a perfect fourth.

The example frequencies I gave correspond to concert-A, then E and D. I took a very simple/short path from intervals to harmonic function/progression to try to give a taste of the meat and potatoes before providing a link to additional sources.

I avoided music theory terms because that would've been a circular definition for any readers who had no understanding of even the basics.

In light of your post, I should've added a sentence or two about mood (major = happy, diminished = tense/scary) and compared that to how you can make a 'warm' picture using reds, oranges and yellows or a sombre picture with darker colors, etc.

Re: Conversations with a six-year-old on functional programming

#316
post #232

Earlier quoted context omitted.

Functions don't alter anything. 20 is still 20 even after you evaluate f(20) to be 6.

That's where linear logic differs, if you will. The highest voted comment in this sub-thread already alluded to that.

I'm a big fan of linear typing but I think of it as more like "consuming" the input than "changing" it.

Re: Conversations with a six-year-old on functional programming

#317

Earlier quoted context omitted.

Wow, that's really not what music theory is at all. This kind of eggheaded simpletonism is grossly offensive and embarrasses the HN community, not to mention engineers in general. Please, the world outside of STEM is not reducible to a few hand-wavy sentences about physics.

It's more about the ratios than the example frequencies I provided. That's more apparent if you play an instrument with an exposed string and a finger-board but still true if it's hidden under e.g., the hood of a piano. The definition of consonance versus dissonance is basically whether or not the ratio is simple. The overtone/undertone series from which the various scales are derived is also one only one logical ste…

Pearls before swine.

Re: Conversations with a six-year-old on functional programming

#318

Earlier quoted context omitted.

Ask any member of a large, poor family whether they would trade (life improvement costing $XX,XXX) for having fewer children in the family. Life is beautiful and easily beats filthy lucre. It's worth the struggle. People lose sight of this.

Sure. Can I ask the how many more kids they plan on having? Can I ask you the same question? Can I ask why that number is less than 16?

I spot two assumptions in your comment: 1) that families plan the number of children they have, and 2) that this planned number is some number lower than 16.

Yours is not the only worldview.

And with birth rates plunging worldwide, many now trending below sustainable levels, who will provide you with healthcare and other services in old age?

Re: Conversations with a six-year-old on functional programming

#319
post #206

Earlier quoted context omitted.

I'd argue it's not ambiguous: current age would have to be a function of invocation time, while "age at time of writing the function" would be a constant. Expressing "age" in whole years is acceptable in English, but using a decimal would be highly defensible. That's an issue of grading though.

Yea, that would have stumped me, expecting a trick/trap. What if my birthday is tomorrow? By the time my teacher checks it, it's wrong. "Your birth year" would have prevented that. This is a problem I have with certain parts of computer science and math education. Everything is encouraged to be exact, then, suddenly, variable names are used inconsistently, niche cases are ignored arbitrarily and explained with essent…

It's graded immediately (automatically), so there wouldn't be any issues. Further, the text of the problem makes it clear that I'm not actually going to check their age - they can return any valid number (although it does check >0 and <100, perhaps discriminatorily). It would be a little invasive to their privacy otherwise, I think.
Post reply on HN