5 ms·
> When you need to pull an address out of a web page, itertools does absolutely nothing to make that easier, nor does any other functional programming technique
by mattdw 17y ago
> When you need to pull an address out of a web page, itertools does absolutely nothing to make that easier, nor does any other functional programming technique.
I'd say an approach like "iterating through all nodes, filtering for the one(s) you want" is quite functional. Add lazy iteration to that, so you're only parsing/consuming as much of the document as necessary, and on-demand, and you've got a really nice, _functional_ solution.
[edit: toned it down a little.]
- justin_vanw 17y agoOk, that is great so long as you are processing XML. Actually, it isn't great even if you are processing xml. What is the functional way to get the 3rd - 8th li in the 2nd ul where the ul has id="foo" and is in a div (either directly or as a decedent) where the div is directly before the 'comment' <-- content area --> ? You use XPath, or CSS after finding the comment with a regex. People get incredibly retarded about functional languages, but in reality the only software that I have used that is written in one is XMonad. So in your mind everyone who actually gets things done is using the 'wrong language'? Or an inferior one? Name one big success story of functional programming. There isn't one. Nobody uses it who actually cares more about getting things done than reading self congratulatory blogs between CS classes. [in no way toned down]
- plinkplonk 17y ago"Name one big success story of functional programming. There isn't one." Map Reduce. It is implemented in C++ (and other languages) but MapReduce itself is very functional. The users of mapreduce do "functional programming". Maybe you wanted success stories of functional programming languages? (which is a different question). Another : SpreadSheets Yet Another: SQL . SQL is (at the core) relational rather than functional, but functions are relations. This keeps getting rediscovered every now and then (witness all the noise around Rails3 and Arel) "Nobody uses it who actually cares more about getting things done" It must be nice to be so certain and knowledgeable about such things. You are a lucky man ;-)
- buster 17y agoI think he meant software. SQL is a standard on paper, not software. Map Reduce is a framework, ok. But written in C++? A software project that i would say counts is ejbabberd. But, that's the only one i can think of. Somehow i never looked at it in this way, but Lisp has been around since 1958, Erlang and Haskell are not new either. Still there is not much software written in those languages compared to other languages.
- plinkplonk 17y ago"I think he meant software." Ok. The AXD301 switch contained over a million lines of Erlang, and reported to achieve a reliability of nine "9"s. Would that count? RabbitMQ? "Nobody uses it who actually cares more about getting things done" is a stupid (and more importantly wrong) thing to say. Joe Armstrong is a very "get things done" person for example.
- justin_vanw 17y agoConsider your grandfather's old hammer. The one where the head fly off and you have to wedge it back on as best you can. Yes, it will fly off and hit you and bystanders, but the nails generally get in there when it stays on. It's basically as bad as a hammer can be, but a garage, a covered porch, and countless forts have been built with it. Now consider a robot that, when properly programmed, can build a house from scratch, all by itself. All you need is a team of 5 engineers on standby to program it, and to keep it humming along. It is very hard to figure out how to use the robot to even drive a single nail, but if you know how to use it effectively, and have the entire house planned out in CAD and in every detail, it will just build a house in an afternoon. It's easier and cheaper to hire carpenters to build a house than to hire the engineers that it takes to babysit the robot. Plus, no construction crew can plan a building down to the tiniest detail before they start, because the ground ends up being too soft, or it turns out that there is a bolder which must be cracked using explosives, or the windows called for in the plans aren't made anymore and the replacements are 3cm narrower, or the insulation is out of spec and a little too thick. Don't rent the robot, buy a new hammer that isn't broken.
- swannodette 17y agoExcept that XPath, CSS, and Regex express the essence of well designed functional programs.
- nostrademons 17y agoThat's like saying that abstraction expresses the essence of well-designed functional programs. True, but so broad a statement as to be nearly meaningless. There's nothing about regexps that makes them closer to well-designed functional programs than well-designed OO programs or structured programs.
- doty 17y agoMicrosoft Excel is arguably the worlds most successful functional programming language.
- justin_vanw 17y agoSpreadsheets are not functional, they are spreadsheets. Try to re implement a complex spreadsheet in another language sometime and you'll see what I mean (hint, any change propagates through the whole sheet instantly).
- mbrubeck 17y agoCouchDB (used, among other things, for both the client and server of Canonical's "Ubuntu One" desktop sync service). Dynomite, SimpleDB (though reportedly some parts of SimpleDB were initially rewritten in Erlang and later ported to C++). Darcs. Mochi Media's web stack. Jane Street Capital's trading systems. Unison (popular two-way rsync written in OCaml). Flightcaster.com. Coq. FFTW. Hacker News. I want to give a special mention to FFWT, the gold standard for Fast Fourier Transform libraries. If you use any audio or video software, you probably use this library without knowing it. An OCaml program generates the C code that compiles to the FFTW library.