Seems to work very well for that one example, but I can't get it to work for anything else.
Autocomplete from Stack Overflow
121–130 of 151 posts
Re: Autocomplete from Stack Overflow
#122Re: Autocomplete from Stack Overflow
#123Re: Autocomplete from Stack Overflow
#124Earlier quoted context omitted.
The OS/SDK/Browser/Protocol/Firmware which you used to type this comment is a compiled copy/paste of a zillion lines of code, of which you probably typed none. If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. Now, if a programmer decides whether or not study and understand the pasted code has nothing to do with the quality of the final…
> If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. No, it's the opposite. The whole point of DRY is you don't copy/paste, you put the thing in a common place and have references to it. Many SO answers are good enough to be libraries. But they should be libraries , not snippets that are copied and pasted. Fortunately we're moving in that…
Re: Autocomplete from Stack Overflow
#125Earlier quoted context omitted.
Maybe it was, but that's a problem if so - it's not going to benefit from updates, and it will have to be maintained on its own indefinitely.
but that's a problem if so It's not necessarily a problem. It actually cuts both ways. The code is not going to benefit from updates, but the code is not also going to be harmed by updates. Think API or behavior changes. Additionally, if the use case for a dependency changes, sometimes the "new" solution doesn't match well. Ex: I work with jscript in ASP sometimes. A javascript library changed such that instead of do…
Re: Autocomplete from Stack Overflow
#126Rather than indexing StackOverflow, why not do this by indexing all the open source code out there? Sure StackOverflow answers are good, but they usually skip error checking for focusing on the question at hand. Code used in production applications surely is more sound.
Come up with a general purpose algorithm for evaluating the quality of code and we can get somewhere. AFAIK that's the whole point of being a developer: you can compare the code intelligently.
Re: Autocomplete from Stack Overflow
#127Earlier quoted context omitted.
Where can you buy this book? I want it!
No need to buy it, it's free: https://www.gitbook.com/book/tra38/essential-copying-and-pas... Found yesterday in this HN Story: https://news.ycombinator.com/item?id=11333448
It's funny because I thought "you can't just copy and paste SO, there's a number of things to think of to be able to do it correctly". Guess I'm not the only one who thought that.
Anyway, most intellectual work is just applying known recipes (copy-paste, renaming a few variables), so it's just a matter of granularity and sources. The hate for SO copy-pasters owes a lot to the few beginners who don't understand that yet and take copy-paste literally.
Re: Autocomplete from Stack Overflow
#128Earlier quoted context omitted.
npm and maven modules are not easily discoverable - How do you search for a function other than by description or name. Assuming the developer classified properly and you even happen to use the same domain language as the writer. - When multiple modules are returned, similar packages, how do you compare and select efficiently without wasting hours reading the code, evaluating it, checking if it is still maintained an…
Hoogle helps for Haskell projects, as you can search by Type, and the Types are expressive enough that that actually finds what you're looking for most of the time.
Re: Autocomplete from Stack Overflow
#129Earlier quoted context omitted.
> If we encourage the DRY paradigm in the whole development cycle, copy/pasting a function is just a further reach of such paradigm. No, it's the opposite. The whole point of DRY is you don't copy/paste, you put the thing in a common place and have references to it. Many SO answers are good enough to be libraries. But they should be libraries , not snippets that are copied and pasted. Fortunately we're moving in that…
I'm not sure how linking (as part of compiling) works. I thought how it worked was by copying the compliled thing from other files into the same executable. Is this not the case?
But even if there's copying going on at the implementation level, it's an important conceptual distinction to make.
Re: Autocomplete from Stack Overflow
#130Earlier quoted context omitted.
Does the order of the parameters matter? It's been a while since I've touched Haskell, so maybe it's obvious that this isn't [a] -> a -> Bool for some idiomatic reason. I guess that would be `isContained` instead of `contains`, so it probably wouldn't be the first thing I search for, but there's at least some potential for ambiguity.
It's almost a convention in Haskell. The idea is, since currying functions is easy and common, you stick the argument that you'd want the least in a curried version last. So if you wanted to find out if x was in ten lists, you'd just: map (elem x) [list1, list2, ..., list10] or, for folds, the function is the one least likely to change, so you put it first, and the list is most likely to change, so you put it last: f…