News for hackers. Stuff that matters.
Re:Most of the code you write, has probably been written bef... by thisrod on Wednesday December 28, 2016 @10:12PM (#13275411)
Smalltalk had a neat solution to this. You gave some arguments and a result, then it tried all the methods with the right types, and listed the ones that gave the result. Searching for '(a b c) and 'a would tell you what car is called in Smalltalk.
Re:Most of the code you write, has probably been written bef... by segmondy on Thursday December 29, 2016 @02:42PM (#13279489)
prolog does this too, but it's not enough. if you don't have enough data, you could find a match that will fail in the future.

To answer OP's question, the reason people rewrite is that it's "faster" to write a new one than find what's out there

OR

I don't want an entire house when all I want is a faucet. Today if you want a faucet. you might have to do something such as house = new House(); faucet = house.getFaucet(); So you have to tear apart/copy and paste the code, if it's loosely coupled enough, you find yourself dealing with all the dependencies.

This is a question lots of people have been asking tho, checkout this talk from the creator of Erlang asking the same question https://www.youtube.com/watch?v=lKXe3HUG2l4

Re:Most of the code you write, has probably been written bef... by Apsion on Thursday December 29, 2016 @07:00PM (#13281350)
The house analogy makes sense - I need to research Smalltalk and Prolog Checking out the video - thanks
Re:Most of the code you write, has probably been written bef... by billconan on Wednesday December 28, 2016 @11:16PM (#13275594)
this sounds cool, but the order of parameters matters.

for example, in the case of matrix multiplication, A * B is valid, B * A could be invalid. How to pass the parameters in right order for searching?

Re:Most of the code you write, has probably been written bef... by mbrock on Thursday December 29, 2016 @05:32AM (#13276630)
How did it avoid calling methods with dangerous side effects?