Live data from Hacker News

Autocomplete from Stack Overflow

emilschutte.com

131–140 of 151 posts

Re: Autocomplete from Stack Overflow

#131
post #77
post #76

Earlier 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.

Neil Mitchell, the author of hoogle, has some idiosyncratic ideas about what to search over in hoogle. If you want a more expansive search, give hayoo a try.

Re: Autocomplete from Stack Overflow

#132

Earlier quoted context omitted.

It's fortunately not _that_ easy to get a software patent. It'd be quite difficult to patent something that's the length of an average stackoverflow answer. There's also a lower limit on the length (and originality) for copyright which I doubt many answers reach.

I can fit the concept of mp3 decoding and a sample decoder in a few dozen lines of text and code. This is a patented technology (for another year or two, at least).

I severely doubt that. Would love to see it though!

Re: Autocomplete from Stack Overflow

#133

Earlier quoted context omitted.

That actually sounds realistic. A well defined test suite is probably a good target for AI. Main issue is no partial wins, which are needed for training, so you'd need to break all functionality down into absolutely minimal units.

Also if you overfit, your code is going to look like: int add(int a, int b) { if (a == 1 && b == 1) return 2; if (a == -1 && b == 0) return -1; if (a == 13 && b == 7) return 20; return 0; } But at least it passes my unit test suite!

That's why you use property based testing like Python's Hypothesis or QuickCheck; instead of example based unit testing.

Re: Autocomplete from Stack Overflow

#134
post #132

Earlier quoted context omitted.

I can fit the concept of mp3 decoding and a sample decoder in a few dozen lines of text and code. This is a patented technology (for another year or two, at least).

I severely doubt that. Would love to see it though!

falcolas might not be able to fit a full mp3 encoder and decoder in the couple of lines, but falcolas can probably come up with enough in these lines to violate the mp3 patents.

Re: Autocomplete from Stack Overflow

#135
post #80

Earlier quoted context omitted.

Haskell has Hoogle[1], which allows you to search for functions using a type signature. This is surprisingly effective. Let's say you want that `contains` function from the original post. You'd search for `(Eq a) => a -> [a] -> Bool`, which describes a function that takes two parameters and returns a boolean. The first result[2] is the `elem` function, which is exactly what we wanted! This is a bit of a contrived exa…

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.

As you can see here[1], changing the argument order does not prevent `elem` from showing up in the first position.

If there are multiple close matches, ordering of arguments can change which is first, but the one you're looking for is almost always in the first few.

[1] https://www.haskell.org/hoogle/?hoogle=%28Eq+a%29+%3D%3E+%5B...

Re: Autocomplete from Stack Overflow

#136

I had a conversation with a coworker a few days ago where I jokingly suggested building an AI system that you give a failing test suite and it uses stackoverflow answers to make your tests pass. Sounds like we are one step closer to making that happen.

Have you heart of StackSort? https://gkoberger.github.io/stacksort/

Original credit goes to the hovertext of https://xkcd.com/1185/, I believe.

Re: Autocomplete from Stack Overflow

#137
post #64
post #41

Earlier quoted context omitted.

I've often told people that I'm just a good programmer, but a phenomenal Googler. Even in interviews. Being able to search and separate the wheat from the chaff is most definitely a skill. Unless you always want to be reinventing wheels.

Yeah but when you found the wheat you still need to know how to make bread.

You're not expected to invent the recipe for bread though - you're allowed to talk to people and find the best recipe, and if it's acceptable quality then you use that.

EDIT: Unless your job is to invent a better bread recipe.

Re: Autocomplete from Stack Overflow

#139

Earlier quoted context omitted.

One big reason I've seen people "reinventing" small utilities and modules is to avoid external dependencies, both for licensing and management hassle.

This is a big one. External dependencies are a liability, you need to be getting enough value out of them to offset their cost. For small one-off functions it's often better to just rewrite the thing than to pull in a library and have to worry about versioning or the library being abandoned or the API changing or the package manager on your target system not having that library or only having an old version or one th…

Libraryism is the sinister flipside to Not-Invented-Here Syndrome, the same kind of conceptual teeter-totter as arguments around thin vs. thick clients.

Re: Autocomplete from Stack Overflow

#140
post #62

It still astounds me that we haven't solved reusable modules in 2016. Sure, we have libraries, apis, package managers etc. but every time I read a code base, there is always a utility function reinventing the wheel. Someone wrote it because it is still difficult to discover modular code and reuse it easily. It's pretty nuts when you think about it. Imagine mechanical engineers having to recreate the same CAD file bec…

Haskell has Hoogle[1], which allows you to search for functions using a type signature. This is surprisingly effective. Let's say you want that `contains` function from the original post. You'd search for `(Eq a) => a -> [a] -> Bool`, which describes a function that takes two parameters and returns a boolean. The first result[2] is the `elem` function, which is exactly what we wanted! This is a bit of a contrived exa…

Purescript's equivalent is Pursuit: https://pursuit.purescript.org/search?q=a+-%3E+f+a+-%3E+Bool...
Post reply on HN