4 ms·
Haskell has this through hoogle. http://www.haskell.org/hoogle http://www.haskell.org/hoogle
by efnx 10y ago
Haskell has this through hoogle.
http://www.haskell.org/hoogle http://www.haskell.org/hoogle
- Klockan 10y agoDoes Hoogle let you search by example?
- efnx 10y agoIt lets you search by type signature. If you know the inputs and output then you know the type signature. So in short, yes. Edit, example: https://www.haskell.org/hoogle/?hoogle=Char+-%3E+Char https://www.haskell.org/hoogle/?hoogle=Char+-%3E+Char
- eudox 10y ago>It lets you search by type signature. If you know the inputs and output then you know the type signature. So in short, yes. In short, no.
- mchaver 10y agoSearching by type signature is very useful. I think searching by example input and output pairs would be a great addition to Haskell as well, especially for beginners and the base libraries. A technique I use for poorly documented libraries is searching in github '<some keywords> <optionally library name> language:<language>'. Unfortunately there are some serious limitations in github search, no way escape certain characters.
- efnx 10y agoIn short, yes. You give it an example of the types involved. Instead of "hi" -> "HI" you give String -> String.
- sternenseemann 10y agoWell, not exactly.
- CMCDragonkai 10y agoHaskell has something even cooler. Automatic program synthesis through examples: http://nautilus.cs.miyazaki-u.ac.jp/~skata/MagicHaskeller.html http://nautilus.cs.miyazaki-u.ac.jp/~skata/MagicHaskeller.ht... For example: f "hi" == "HI" Gives: f = (map toUpper)
- malisper 10y agoFrom the abstract: > The synthesis algorithm takes a generate-and-test approach: it generates an infinite stream of all the expressions having the same type as f; then, they are tested against the given predicate. I'm really impressed that such a simple approach works. Initially I thought it was something similar to FOIL[0]. FOIL was a program that could learn function definitions by examples. One version of FOIL was able to solve exercises from a Prolog book. For one of the exercises, it was able to come up with a solution that was shorter than what humans had previously come up with. I don't remember exactly how FOIL worked, but if I recall correctly, it would repeatedly add predicates to it's currently best solution while trying to maximize the number of test cases which it had solved correctly. [0] http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=4AD32A0EB7A8DB42D651EB951F50B128?doi=10.1.1.34.4926&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=4AD...
- CMCDragonkai 10y agoThere's probably some overlap with the different search strategies that can be applied to logic languages and Prolog-like systems. Further heuristics can limit the search space. Now we have programs that write programs!
- gokr 10y agoThe Smalltalk mechanism (Squeak/Pharo) also uses generate and test, just FYI.