HNHacker News
TopNewBestAskShowJobs

ericssmith

283 karma · joined December 10, 2011

https://www.functionalgeekery.com/episode-37-eric-smith/
submissionscomments
ericssmith··on How to name things in programming
"I loved the hieroglyph page; I think that functional programming failed for years as an engineering discipline because of the culture of that style of code."

I don't quite follow your observation, but if you are suggesting that this function would be better with verbose, Englishy naming, I think you are mistaken. Quite the opposite, the parametrically is better illustrated with hieroglyphs.

Regarding failing "for years as an engineering discipline", are you suggesting that imperative programming was "successful" because of the reliance on using naming to communicate intent in the midst of rampant state mutation and unbridled complexity?

ericssmith··on I would have hired Doug, but...
Here is the first program I ever entered into a computer.

1 8 + A 5 + 0 0 + 6 5 + 0 1 + 8 5 + F A + A 9 + 0 0 + 8 5 + F B + 4 C + 4 F + 1 C

I remember how much like some kind of incantation it was. I still get that feeling. And I've had the good fortune to work some fun, powerful, and interesting magic with those incantations.

I suspect that most younger people haven't yet seen their tech choices slip into decay and disuse. And they hang on tightly, hoping to expend less effort in learning as time goes by and they master that tech. It's a vain hope. The essential part of the experience is the underlying creativity, the joy of getting to the next ledge, and really understanding what a marvelous thing a computer is.

ericssmith··on I would have hired Doug, but...
I am 53 and started programming in 1977. I feel EXACTLY the same as you.
ericssmith··on Microsoft makes it easier to build Minecraft Mods using Visual Studio
"If you haven't watched a 12 year old play Minecraft, you need to do so. It's the ultimate fantasy universe, and the way you combine elements to make something new is very analogous to programming in the vanilla game."

Watching my 5 yo work in Minecraft reminds me of the programmer "crunching entities" in the movie "The Zero Theorem".

ericssmith··on Ask HN: Why do people have a hatred for Scala?
I have used Scala for building business solutions since 2012. I had been maintaining PHP and Rails systems of 50k to 150k LOC prior to the switch. I still have to maintain PHP and Rails systems. The move to Scala was driven by the need for better performance, system resiliency, and to mitigate the effect of multiple developers coming in & out of a codebase. It turns out to be ideal for this.

Idiomatic Scala is not a grab bag of features or paradigms. It is firmly based on programming with expressions and using the type system to improve abstraction. Statements and mutable data structures show up when interfacing with external systems or for performance reasons. The Collections libraries are arguably "object-oriented" as that term is commonly understood, but this is not typical for application code. However, object-oriented features such as objects, classes, and traits are the basis of Scala's module capabilities.

For programmers coming from 20th century mainstream languages that are all based on programming with statements, mutable variables, and are arguably a thin abstraction over the machine itself, programming with Scala can be a challenge. If you want to do your familiar imperative style of programming, Scala is going to be painful. Use another language. But if you would benefit from a type system and good support for expressions, then Scala is possibly the best choice currently for growing business applications. We are not in 2005 any more.

Scala is not ideal as an introduction to functional programming. Other languages, such as F#, SML, OCaml, and Haskell have better, simpler syntactic support for features associated with functional programming.

People who dislike on Scala are probably either stuck in the past or don't have pain that Scala would solve.

ericssmith··on Watching and Re-Watching “The Mother of All Demos”
What timing. I'm currently reading "The Dream Machine: J.C.R. Licklider and the Revolution That Made Computing Personal" by M. Mitchell Waldrop. And when I got to the 1968 Fall Joint Computer Conference this weekend, I went and watched Engelbart's presentation. The book gives great context for the demo.

As a side note, I know quite a bit about the early history of computing, and I was amazed how carefully Waldrop navigates these murky historical waters. Highly recommended.

ericssmith··on Don't Enforce R as a Standard
"A software monoculture at least gives reviewers a fighting chance of spotting issues with software that might affect the validity of results."

If I understand it correctly, this observation shows just what a short distance we've come in programming languages and software development since the 1960s. Verifying the correctness of a program shouldn't depend on good naming or being able to execute it in your head.

ericssmith··on Ask HN: Advice for 14-year-old who wants to learn to code?
Why is he interested in programming? It must seem cool to him for some reason. I'd try to tap into that in order to find a direction to go in. And for a 14 year old, it would be helpful to find some heroes. Without the cool and the heroes, it may be hard to devote the time for it to be impactful.
ericssmith··on Learning Curves for Different Programming Languages
Yes. Continuing beyond monads to learn about category theory is mostly because it is interesting. It is definitely not a prerequisite.

The historical relationship is that Eugenio Moggi wrote a paper in 1988 "Computational lambda-calculus and monads" http://bit.ly/1x9uUHQ that used ideas from category theory to handle the semantics of programming language features. His problem was that the lambda calculus itself failed to adequately handle certain "notions of computation" such as side effects and non-determinism. This inadequacy goes way back to the origins of programming language semantics, starting with Peter Landin's 1964 paper "Mechanical evaluation of expressions" http://bit.ly/1rrBit3. He described a virtual machine (SECD) for evaluating lambda expressions, but had to add special constructs for handling assignment and jumps. In case you don't know what semantics is about, imagine that you had two small programs written in two different languages. How would you determine if they were the same? One way would be to demonstrate their equivalence to a common, mathematically sound, language. That's what Landin used the lambda calculus for. But it's only good for a subset of what we understand computation to be (particalurly what a Von Neumann computer is capable of doing).

That's what prompted Moggi to look to a more encompassing branch of mathematics -- category theory -- to describe semantics. In 1991, he wrote "Notions of computation and monads" http://bit.ly/1viXT6z, which is much shorter and more accessible, but essentially the same as the previous paper. Philip Wadler, one of the original authors of Haskell and long-time functional programming researcher and educator, was inspired by Moggi's work to write (several times) a tutorial showing how Moggi's "monads" could be applied to the restrictions of functional purity. For example, to simulate the incrementing of a global variable representing a counter (of some operation), one could use a "state" monad.

The monad of Wadler (and Moggi) is really pretty simple. First, you need a way of representing one of these notions of computation. In a programming language, this is done with types. Or to be more precise, a 'type constructor' since you will want the computation to be general. For instance, if your computation changes state (eg the counter above), you might want to construct a function type that given a value, takes a state (eg integer representing the counter variable) and returns a tuple consisting of the value and some new state. I should point out that my last sentence is what makes monads so confusing and challenging in languages other than Haskell. They don't have a nice way to represent what I just said. To use Wadler's notation:

type T x = S -> (x, S)

The second component of a monad is a function that takes a value and returns a "computation" (ie, the type described above). And the third component is a function that takes one of the computations and a function from a value to a computation and returns a computation. That's a mouthful, and it requires the language to support polymorphic types and higher-order functions. If your language does not or doesn't provide good syntax for them, then monads will be an elusive and difficult concept. But as you can see, a monad is just a pattern made up of these three things. That's all ... almost.

Because of the relationship to category theory, a monad (consisting of the three components) must also obey certain rules for how these operations are expected to behave when combined in certain ways.

In fact, monads are pretty cumbersome to implement, especially when there isn't good syntactical support in a language. But they provide a general solution to certain kinds of problems which is functional in nature.

ericssmith··on Oliver Heaviside
The following two books are a fascinating look at Heaviside's contributions and extraordinary life:

http://www.amazon.com/Maxwellians-Cornell-History-Science/dp...

http://www.amazon.com/Oliver-Heaviside-Electrical-Genius-Vic...

ericssmith··on A concise introduction to category theory
If you want an actual introduction to the topic, "Conceptual Mathematics: A First Introduction to Categories" by Lawvere and Schanuel is the right choice.
ericssmith··on Ask HN: How or where to begin learning mathematics from first principles?
Since I have painstakingly gone through the series of proofs in Landau's book, I feel I need to weigh in here. On the surface, this book does appear to start from sets and convincingly proceed up to real numbers etc. It's interesting that you include the quote from the beginning about "high-school mathematics", which I think is laughable.

I personally believe that Landau was caught up in the spirit of the times and optimistically believed that math could be built up from "first principles". The famous kickstart to this is Hilbert's 1900 presentation. And it certainly continued up through Nicolas Bourbaki.

In fact, Landau's mathematics is presented in a somewhat archaic style and his proofs are extremely hard to follow in spots, as if he is making unstated assumptions. Overall, it is an interesting, but ultimately thankless, task to go through that book. It is a mostly a historical curiosity. The same can be said of Hardy's "Course of Pure Mathematics", which was recommended elsewhere in this thread. I find it hard to believe that anyone who recommends these books have actually read them.

To the OP, while I can relate to the goal from personal experience, after decades of going down a similar path, I can tell you that the history of math is very messy. Our textbooks and notation reflect this messiness. My recommendation is to dive into whatever part strikes your fancy, although it may help to start from where you are. For instance, if you program, you might want to get a book on physics in game programming or learn Haskell.

ericssmith··on Java for Everything
Warning: These are not beginner books.

"Learning Java" http://chimera.labs.oreilly.com/books/1234000001805/index.ht... seems to be a decent review of the language and ecosystem, although it doesn't cover many of the new technologies in common usage (many of which are mentioned in this thread).

ericssmith··on Emacs Rocks
"why hang on to a dead word?"

Because it doesn't refer to a key. It's more of a identifier. It would be considerably more confusing to substitute whatever key you think it should be. Cmd? Alt? Opt? Esc?

When I see "M-" in the literature, I know what that means and translate it to the relevant keystrokes. For instance, M-x for me is actually "C-[ x". I've customized it that way. However, we have a lingua franca for communicating commands despite the personalizations.

ericssmith··on Talking about “types”
Sinner here.

But I could only identify with four of the seven. Mostly because I couldn't make sense of his rhetoric for the other three.

> I imagine that my passions are still rather thinly veiled in places

You got that right. But I don't deny you your right to be as passionate about it as you like. It's a debate after all.

ericssmith··on Algebraic Data Types
FWIW, Peter Landin sowed the seeds in "Mechanical Evaluation of Expressions" in 1964 in his description of recursive discriminated union for lists:

A list is either null or else has a head (h) and a tail (t) which is a list.

Rod Burstall picked up on this in "Proving Properties of Progams by Structural Induction" (1968) in an extension to Landin's ISWIM that used pattern matching on these. If you look closely the pattern matching was present in his if-then-else syntax, but he changed it to the more convenient "case".

ericssmith··on A Year of Functional Programming
I want to add some color to the other answers saying "no". If your medium-term goal is to use FP for business problems (e.g. perhaps you are responsible for technology decisions), then the OP's path of "Scala for the Impatient" -> "Functional Programming in Scala" -> "Learn You a Haskell" will likely provide the easiest transition and expose you to "real world" solutions in FP. Learning F# will give a similar pragmatic path (although its complications are due to .NET rather than the JVM).

However, if you are interested to "learn FP", as in see what all the fuss is about, then there are more direct routes. My own recommendations are for Graham Hutton's "Programming in Haskell" and "Real World OCaml" (https://realworldocaml.org). There are many other good (albeit verbose) resources but these two are the shortest path (IMO) to understanding the "common denominator" and historical underpinnings of functional programming languages and functional programming. Dan Grossman's "Programming Languages" course at Coursera was also quite accessible and comprehensive, but I think it may be closed now.

ericssmith··on Poll: How long have you been programming?
Also started with the 6502 in the late 70s, but it was entered in hex through the KIM-1. I was a teenager, and part of my brain was wired while understanding that computer.
ericssmith··on What is the contribution of lambda calculus to the theory of computation?
I'm not sure what you mean by "equivalent", but historically, the "computer science problem" that lambda calculus has been used to address is understanding the meaning of expressions in programming languages. The first paper to introduce lambda calculus in relation to computers was Peter Landin's "The mechanical evaluation of expressions" (1964). Its specific goal was to use the lambda calculus to model the facilities of other programming languages in use at the time. Landin continued this investigation with two more papers in the series: "A Correspondence Between ALGOL 60 and Church's Lambda-Notation" (1965) and "The Next 700 Programming Languages" (1966). Because of the LC's basis in mathematics and logic, it provided a useful way to define the semantics of programming languages. It continued in this role over the next few decades. One of many high points in this evolution was the use of the LC as the basis of Scheme, "An Interpreter for Extended Lambda Calculus". Among many other contributions, the "Lambda Papers" investigated other models of computation (e.g., actors).

So the lambda calculus has been used as a consistent and primitive basis for understanding computation itself and how it is expressed in programming languages. I suppose it is more "equivalent" to Newton's 2nd Law than any particular way to solve a problem. It's perhaps worth remembering that Principia used geometry, not what we know of as calculus, to clarify mechanics.

ericssmith··on Great books about mathematics
I agree with the author about History of Mathematics and Journey Through Genius, so I did what he said and bought The Mathematical Experience immediately.
ericssmith··on How I faced my fears and learned to be good at math
I have a 4yo and 6yo. The 4yo can add 2 to some numbers up to about 20. The 6yo can add any single digit to any number below 100. Most of the time. They both can read pretty well. We practice both math and reading every 'school' night for about 15 minutes.

The only goal is to familiarize them with doing stuff with numbers. The 6yo's kindergarten class has heavy emphasis on math, so I try not to get in the way of what they are doing. I avoid confusion by just staying away from the same stuff (at first, I thought I'd reinforce, but that turned out to be a bad idea. The 6yo needs a disconnect from what's happening in school, not a reminder. It's tiring).

The one thing I can confidently say is that what works changes as they pick up more concepts, and have more influences on learning (ie, other parent, school, other kids). My kids are not especially smart or gifted. The trick is that we stay just at the border of what they can do. We try new things, which fuels their confidence when they get it. We practice old things, which fuels their confidence with little cost. We stay focused and brief.

I try to get as many information and pedagogical tricks as I can. But they only work, if they work, for brief points in time. Kid thinking changes much faster than adult thinking.

ericssmith··on On the Symmetry between Microsoft and Apple
I have to back him up on iTunes. I hate it. I've always hated it. I'm not sure it dooms Apple, but I've seen lots of products die as a result of infuriating design choices. It takes a while, but it does happen.
ericssmith··on Effective Scala
I think DSLs, heavy use of operators, and Unicode characters as identifiers isn't abuse. It's unfamiliar. In Haskell, for instance, syntax is taken much more seriously than in other languages, which tend to just copy previous languages in the name of familiarity. And it takes a while to become use to the basic syntax of Haskell, let alone the various libraries that extend on its ideas. But the syntax choices are not arbitrary.

But even Clojure is syntactically heavy compared to Racket or CL. But with good reason.

A powerful and expressive language takes effort, possibly even years, to become expert in. I'm not sure that making trivial things trivial is part of the plan. There are more appropriate languages for that.

ericssmith··on Effective Scala
I've worked with C++ going back to the mid 90s, and program Scala full-time in addition to managing a team of programmers. Such a comparison has never occurred to me. Scala is arguably a simple language in its core design. It enables quite feature-rich libraries, and you could argue those make the language seem complex in practice. But to me, it just shows the language is powerful.
ericssmith··on Effective Scala
"you need capable programmers in order to not fuck it up, because it contains every paradigm ever invented."

My team has just the opposite experience. Scala offers a lot of structure and discipline that you can take advantage of without being an expert, and it is a short time to ramp up to idiomatic usage relative to other languages. In fact, this is one of its benefits. By following some fairly simple guidelines, you can avoid making a mess. This has not been my observation with imperative programmers picking up a new imperative language.

Because of the easy-to-achieve discipline, Scala is ideal for teams in my opinion.

ericssmith··on Scala School
Pattern matching, immutability, option types, combinators, traits are not advanced features in Scala. They are fundamental concepts. To be productive in Scala, write in Scala. Otherwise, you will needlessly waste a huge chunk of your life, including having to go back and clean up your messes.
ericssmith··on Scala on LLVM
Indeed. I just found this yesterday, and it is an interesting project. Not sure I'll be able to contribute in the next few months, but I certainly will "play around" with it.
ericssmith··on How serious is Google about Dart?
"Google can artificially increase traction of Dart by putting the Dart runtime inside Chrome and using that as a weapon to increase Chrome adoption"

Chrome itself gained in traction because V8 was faster for a while. Putting Dart VM in Chrome and getting another competitive leap seems like a no-brainer. Not sure how that is evil or going against the spirit of the web. It's a one-liner to have it use the Javascript version, making it available in other browsers. It's not like ActiveX, as far as I can see.

In practice, Dart is a decent enough compile-to-Javascript alternative with a low barrier to entry. And it works as advertised. Easy to learn, use, and debug. And the claims about structure are true.

As far as I can tell, the lack of conviction is as much about seeing where developers are headed as anything. Why spend a lot if there won't be adoption. It's a tough call for Google in a pretty crowded and evolving space (ie, compiling to Javascript).

I should add tha NaCl and LLVM complicate the vision of the future for web technologies as well. Hard to place a bet at the moment.

ericssmith··on Snowden granted 1-year asylum in Russia, leaves airport
As I understand it, the goal of Islamic terrorism (possibly internal anti-government terrorist?) is not to kill people. The objective is to bankrupt countries such as the US. Killing people is just a means to an end.
ericssmith··on Brand new Scala-lang.org
It's quite possible, up to a point. In fact, there is a new book "Functional Programming in Scala" that shows precisely how to do that. However, Scala is a fusion of OO and FP. Even its functional features are written in terms of objects. What you don't particularly need is mutable objects. But Scala's OO features -- notably traits -- are arguably useful for structuring code.

As the language designer himself has said: Scala is not a better Java, it is not Haskell on the JVM. I would add that it isn't just SML on the JVM either. It is much better, in my opinion, to embrace Scala for what it is, a powerful, expressive, pragmatic language for industrial use.

← PreviousPage 2 of 4Next →