On the subject of foreign data wrappers, there's an extension for storing columnar data in Postgres which is implemented via this concept: https://github.com/citusdata/cstore_fdw
I haven't used it myself but it's pretty cool that it's out there.
Splitgraph co-founder here. cstore_fdw is great (we even use it in Splitgraph to store data [0])! It's not as fast as purpose-built columnar stores like MonetDB. However, it plugs seamlessly into PostgreSQL and supports all types, even those added via extensions. Read performance for OLAP workloads like aggregations is better than PostgreSQL [1] and it has a much smaller IO load and disk footprint (you can get long runs of similar values in column-oriented storage, which compress better). As a nice bonus, you can simply swap cstore_fdw files in and out of the database without having to "load" them into PostgreSQL. We use this idea too to enable data sharing.
Pattern matching goes significantly beyond checking “foo.type”. It adds the ability to specify exactly (as exact as the language and your data allows) what case you’re dealing with. For example, a list of length three where the first and last elements are empty strings. Having to specify this with a series of if statements often leads to verbose and error-prone code, but it’s trivial in a language like reasonml:
switch (mylist) {
| [“”, _, “”] => x
| _ => y
}
Moreover, pattern matching usually involves pulling information out of the object at the same time. In the above example, maybe you want to do something with the middle element:
While having a type system is helpful in all of the ways a type system is generally helpful, there’s nothing about this code which wouldn’t also be handy in a dynamic language like JavaScript. For further evidence of this see Erlang and Elixir, dynamic languages which make heavy use of pattern matching.
(Code typed on my iPhone so forgive the dopey examples)
Nevertheless, those special cases are the exception, not the rule. Most of the time the pattern matching really is just a more convenient switch statement.
I'm not sure what your experience is, but this seems to differ from mine (lots of recent Haskell experience, some dated OCaml).
I agree that matching on multiple levels in one statement isn't common, if that's what you were talking about. But performing bindings in a match is very common, and not something that's part of a switch statement (except in those languages where a switch statement is doing pattern matching more generally anyway).
Yes, I was just trying to say that matching on multiple levels is rarer. I agree with you that automatically binding new variables is the best part of pattern matching.
My examples were deliberately dumb, but I’ve certainly use this ability to pattern match at arbitrary depth innumerable times. It most commonly appears when looking at a tuple of N values, and I want to enumerate specific pairings of values.
Nevertheless, if that was the only benefit of it, one might argue it’d be more of a party trick. But it’s simply one more facet of a very powerful, simple-to-use technique for expressing how your code reacts to the shape of your data.
I’m curious how much exposure you’ve had to languages which support it — you might find it more useful than you think.
I find it often winds up clearer to pull things into multiple case statements, especially as the code grows more complicated. That said, there may be a difference in what we 're meaning by "most of the time," so let's be more precise. IME, most Haskell programmers will encounter use cases for multi-level matches (beyond simply pulling the first couple elements off a list) a small number of times per week (maybe month, depending on the programmer), whereas they're typically writing a case statement some number of times per hour.
I wouldn't call it a party trick, but I also wouldn't say it's the most common use of case by a long shot. I don't expect that you disagree.
I find that Haskell (both mine and that of others) involves a lot less pattern matching than ReasonML, since control flow is often expressed by type classes. Unfortunately, these are lacking in reasonml, and I think that might contribute to why you tend to see more explicit pattern matching there. But maybe that’s an incorrect impression. In either case, it’s not common all the time, but neither is it particularly rare.
I think you have a very specific, and not widely shared, definition of “code as art.” Code as art does not mean code full of pointless Rube Goldberg mechanisms or following some esoteric golden ratio whatever. For me, “code as art” means code which is well-abstracted, readable, correct, concise, maintainable, extensible, well-documented, performant, etc — I.e. reflecting the things that matter to me as a developer. The process of getting to the point where the code has all of those things, or as many as possible, is indeed the “art” of coding. To assume that the result is some horrible morass of spaghetti that no coworker wants to read is a strange one for sure.
The thing I detest about discussions of code aesthetics is the idea that the quality metrics you speak of have such a direct relationship to the "product features" of the language, that we can simply know it's good by looking at it, and we are hapless simpletons unable to write this so-called "beautiful" or "clean" code if we do not have the feature available. That is all bullshit. Most of the features are shiny baubles for raccoons and magpies, I do NOT know what good code looks like(I can only state whether the coding style eliminates some class of errors), and what matters the most is the overall shape of the tooling.
Some languages have a big bag of tricks, other languages let you extend them to the moon, and still others make you work at it a little. In the end it's all just computation, and the tool choice can be reduced to a list of "must haves" and "cannots". If you need more expressive power -- make your build a little more complex and start generating code, give it a small notion of types or static invariants. It only has to generalize as much as your problem does, and that leads you to build the right abstraction instead of dumping an untried language feature on the problem in the hope that it is a solution.
> Error: ENOENT, no such file or directory '~/foorc'
I can’t count how many times I’ve seen error messages that look like this, often with no context at all, in JavaScript apps, even widely used ones like npm and webpack. Proper error handling is never easy, but the JS community seems particularly given to avoiding it.
As a Chicago resident worried about the terrible air quality here, this gives me some hope that things can be improved if the political will can be mustered.
Not to be "that guy," but I think the real reason we'll never colonize Mars is simply that we're going to run out of time. Climate collapse and/or nuclear war will probably set in long before we have the technology or wherewithal to terraform a planet millions of miles away. We may be only a decade or two from severe environmental catastrophe, which makes the prospect of Mars colonization pretty far-fetched at best.
To be clear, I don't think studying this is a waste of time. On the off chance that we get there, that'll be great (setting aside the concerns of this article of course). It just gives me a sense of a terminally ill person planning their retirement. Sorry to be the downer here.
America’s success was the direct result of ethnic cleansing of millions of Native Americans and the backbreaking labor of millions of slaves. The comparison is ridiculous. We were the exploiters.
No it wasn't. It doesn't even pass the sniff test.
Why do you think the slave-free north was much richer than the south, before the civil war?
If slavery makes a country rich, why isn't Africa rich?
Why wasn't Brazil, which imported ~4 million slaves (compare to ~200k for USA) significantly richer than the USA?
Native Americans had slaves:
> "An exhaustive search of some 725 late 18th/early 19th century ethnohistoric sources and 20th century ethnographic works indicates that predatory warfare, or preying on other groups for plunder and captives, was engaged in by virtually all Northwest Coast societies."
> "Source after source notes, either through specific instances or in general terms, and with almost monotonous iteration, that within this large area a prime motive for raiding was to gain captives for enslavement."
If you think slavery was instrumental to any rich nation getting rich, I suggest you read a lot more history, and look at who had the most slaves in history, and who has the most slaves today.
> Why do you think the slave-free north was much richer than the south, before the civil war?
Because the North had a diversified, industrialized economy, while the South specialized in cotton production.
But the North never could have diversified in this way if it weren't for the South. First because slave-grown cotton was a major source of capital for the overall US economy - it provided over half of all US export earnings. Second, because the demand for textile factories, meat processing plants, insurance, shippers etc. in the over-specialized South is precisely what created a market for the North to diversify into.
This is on top of the fact that the North itself had slaves for a long time, from initial settlement to abolition many decades later.
I think you're going off of old/bad data. Olmstead's paper in 2016 writes:
> Other findings of the NHC, such as the assertion that the Cotton South was the primary force driving national expansion in the antebellum period, are neither original nor correct.
As you say:
> it provided over half of all US export earnings.
This is not true. It may(?) have been over half of US exports, by some measure, but cotton was definitely not over half of earnings. Per Olmstead 2016:
> North’s fellow new economic historians promptly assaulted his thesis. It was widely recognized that cotton was leading U.S. export in the antebellum period. But exports represented less than one-tenth of total income (Kravis 1972). Figure 2 graphs the values of cotton exports as a share the value of U.S. merchandise exports, and then both U.S. cotton and merchandise export values as shares of GDP.30 As the bottom line makes clear, cotton exports were a very small share of national product—less than 5 percent over much of the of the antebellum period (Engerman and Gallman 1983, p. 28).
Emphasis mine. It goes on:
> Perhaps more surprising, given the NHC narrative, is that in 1839 and 1849 corn, not cotton, was even the South’s leading crop in terms of value! Some familiarity with historical data might have moderated the sensational claims of the NHC literature.
If you're interested in the topic, I suggest you read it, especially the section "The Economic History Slavery Debates". You should also read the sections relating about diversification if you have a strong belief in the over-specialized south.
Are you arguing that slavery did not contribute significantly to the wealth of the North, first by using slaves directly, then by integrating advantageously with the South’s economy and the slave trade?
My condensed argument is that Slavery per se does not make countries rich. Rather I am only arguing that slavery, in many countries including the USA, Brazil, and others world-wide, did not contribute to the long term economic success of the nation nearly as much as many claim it does (or solely claim it does in the USA).
We don't have a counterfactual Twin Earth where those countries did not have slaves, but we know for sure slavery is not necessary for a country to be successful. And if we look at countries that had way more slaves, the advantage of simply having slave labor seems hugely insufficient for a country to be successful.
It is possible that the USA had slaves and was able to economically leverage them far greater than all the other countries that had slaves, but this seems unlikely, and such a scenario would also be the biggest gain for a counterfactual scenario that the USA would have been successful without them, too.
> If slavery makes a country rich, why isn't Africa rich?
I never made the claim that any country can become rich simply by having slavery. The question of why the West is so much richer than e.g. Africa or Brazil is obviously vastly complex and does not boil down to "because of slavery." But whether or not the American South was richer than the North at the time of the civil war, it certainly very very wealthy, and slavery was instrumental in this.[0] I don't think this is really controversial.
> Native Americans had slaves:
The existence of slavery in these or other societies does not in any way absolve the US from its past in this regard. Pointing an accusatory finger at some Native Americans who enslaved prisoners of war and the like, in contrast to a vast and extremely profitable business empire built on systematic enslavement, which has had ripple effects of racism on individuals and communities since, seems incredibly tone-deaf. Even more so when you consider that we killed the Native Americans by the literal millions.
I'm not trying to point accusatory fingers anywhere, you're missing the claim. You made the claim that USA success was the direct result of slave labor. If this were true, you would expect other societies with boatloads of slave labor to be more successful. They weren't.
Since lots of places had lots of unpaid labor and did nothing particularly successful, there must be more to it. If there is more to it, it is (usually) evidence that the USA would have been successful without slave labor.
Perhaps my choice of the term "direct" is overly specific, but I feel like this is a very nit-picky quibble. The underlying point I was trying to make doesn't change, which is that the United States benefited hugely (in purely economic terms) from slavery. Whether or not we would have been as, less, or more successful without it, or whether it has been helpful to others, is an orthogonal discussion. As I said, I am not making the claim, and never intended to, that slavery was the only cause of American prosperity. If this is the primary dispute you have with what I said, I readily accept the correction and we can move on.
However, if your intention is to dispute the claim that slavery was immensely beneficial to the development of the American economy, or to suggest that the morality of American slavery was somehow mitigated by other historical examples of slavery, I strongly disagree. I think in general this mentality is incredibly disrespectful. Acknowledging the role played in our success by the (unwilling) sacrifice made by millions of slaves and Native Americans is the very least that we can do.
> United States benefited hugely (in purely economic terms) from slavery. Whether or not we would have been as, less, or more successful without it, or whether it has been helpful to others, is an orthogonal discussion.
I don't see how these can be orthogonal. If the claim of benefiting from something isn't a comparison to a world in which you didn't have that thing, then what is it?
And since we don't have access to a world in which the US didn't have slavery, the best we can do to get information is to compare to other somewhat similar societies. Other places in the Americas with (and without) slave economies seem extremely relevant.
One comparison not mentioned so far: The cotton mills of England spun a lot of slave-grown cotton, just like the ones of New England. It was debated at the time how essential this was. And the civil war blockade provided a useful natural experiment, in which it turned out not to take very long to switch to cotton from other places, like Egypt.
The moral questions don't seem tightly coupled to the economic ones. Would anyone claim that slavery in what's now Haiti (or Brazil) was less of an evil act than slavery in the US, on the grounds that these places are poorer now? Or more evil, on the same grounds? And if not, then why is disputing the economic benefit of slavery in any way taken to be disrespectful of suffering?
First of all, I have heard and read from numerous sources that I trust that slavery played a huge role in the early American economy. But that on its own would be a simple factual dispute.
The second issue is that regardless of the accuracy of the claim, downplaying the value of slavery is a way to devalue the debt owed to black Americans and has been used as such in arguments. The less valuable slavery was, the less white Americans should feel owed to pay back. So I think there’s a significant moral cost to this argument, and yes I think it’s disrespectful. But again, it’s factually controversial as well.
I had also made a variety of significant points which GP failed to respond to, instead focusing only on a hyper-literal interpretation of one subset of my argument. ¯\_(ツ)_/¯
The fact that England, another state with a horrific history of exploitation and colonialism, was also guilty of slavery, is hardly exculpatory for the US. Whether slavery was economically beneficial in every single historical example is a separate question from whether it was beneficial to the United States.
That the slave economy was huge in early America is beyond doubt. But the more interesting debate is to what degree this influenced later American wealth. This question doesn't answer itself, we need evidence. And the presence of lots of other slave sugar plantation economies nearby is a treasure-trove. Many were also rich in the 18th C, like Barbados & Saint-Dominque... richer than the weird experiment in theocracy going on around Boston. Their 18th C riches didn't translate to 20th C riches. The "huge role in the early American economy" at early dates actually tells us very little about the effect on the trajectory in later centuries.
My argument re English cotton mills was much more focused than you credit. It was about how rapidly they switched from slave-grown cotton to non-slave cotton, once there was a blockade, not some denial that they consumed slave-grown cotton before this.
I don't think slavery is instrumental in the economic success of the USA - it probably hindered development, while no doubt enriching some individuals. If true, then when slavery was ended we would presumably have seen a stagnation in the economic fortunes of the USA, which I don't think has happened.
> If true, then when slavery was ended we would presumably have seen a stagnation in the economic fortunes of the USA, which I don't think has happened.
Something like that did in fact happen -- the post-civil war period coincided with the Long Depression (https://en.wikipedia.org/wiki/Long_Depression), which some economic historians would date between 1873 and 1896.
However, the Long Depression was at least in part a global phenomenon, and with any economic story there are many confounding factors. (And on top of all of this, nations did not keep rigorous economic statistics at the time anyway.)
Actually America industrialized quite early. The north was business and industry savvy, while the south focused on slavery. Slavery was not important for national economy - otherwise there would have been no civil war in 1860:s. Instead north was doing just fine economically without slavery, while south wanted to hold to most of it's capital (slaves).
I agree that the expansion to west was facilitated by forced migration of native americans from their homelands in a process that was borderline genocidal.
The fun part is about american industrialization - quite lot of it was based on directly stealing the IP of european industrialists (i.e not respecting their patents). This is quite fun in the sense how vocal US is now in upkeeping IP laws.
This project is very interesting and I think it’s great that this is being studied, but we already have a technology for reducing greenhouse gasses in trees and other plants. They do not have expensive and pollution-causing manufacturing processes, contribute to biodiversity and natural ecosystems and don’t produce lasting waste. Perhaps I’m being cynical, but it seems like the ultimate driver of this technology is still profit. There’s a lot of trademarks and business speak in this article.
I haven't used it myself but it's pretty cool that it's out there.