<div>Hi,</div><div><br></div><div>I'm writing a project and was wondering what other people think about it.</div><div><br></div><div>This project is meant to be a compiler feature/wrapper that analyzes your code and chooses the best data structure depending on your source code. It analyzes the functions used on a wildcard data structure and chooses the type of structure that minimizes the time complexity. It nearly supports C language and hopefully some other languages too. The purpose is that you don't have to care which data structure to use ever again :D (hopefully, if it works well, lol).</div><div><br></div><div><br></div><div>Maybe some illustrative examples:</div><div><br></div><div>int main()</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ds d; //data structure</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while(something) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>insert(d, 5);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while(!empty(d)) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>printf("%d\n, max(d));</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>delete_max(d);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>}</div><div><br></div><div>Here dsinf would infer some kind of a heap (or possibly a rbt with max element cache).</div><div><br></div><div>int main()</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ds d; //data structure</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while(something)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>insert(d, 5);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while(something)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>update(d, 2, 7);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while(something)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>delete(d, 1);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>printf("25 is in the set", search(d, 25));</div><div>}</div><div><br></div><div>Here it would be hashtable (it differs from the earlier, because we don't need element ordering).</div><div><br></div><div>if anybody wants to hack it, the C api is in dsimp/ds.h and some tests in C/tests/.</div><div><br></div><div><br></div><div>I have some ideas how to extend it from trivial cases, the ideas are in github issues.</div><div><br></div><div>repo: git clone https://github.com/alistra/data-structure-inferrer.git</div><div>hackage: http://hackage.haskell.org/package/data-structure-inferrer-1.0</div><div><br></div><div><br></div><div>So just let me know what you think ;]</div><div><br></div><div>Also does anybody know a good ~MIT licenced library of data structures written in C (they're needed for the auto-compile option)?</div><div><br></div>