3 ms·
Start small. Make a function that takes a string which is part of an English word and returns a list of completions for that word. If on Linux, use the word lis
by bjourne 12y ago
Start small. Make a function that takes a string which is part of an English word and returns a list of completions for that word. If on Linux, use the word list in `/usr/share/dict/words`.
The next step up is to improve on that function. F.e. if the string is "disc" a good candidate probably is "discussion" but not "discus" unless that word previously occurs in the document.
Then continue from there. Coding is learnt by doing not by reading guides.
- cweagans 12y agoWell, yeah. I mean, that's straightforward enough, but what people frequently leave out is what "improve on that function" entails, especially when you start getting into really weird codebases. Like I said, I understand the overall components - I need a lexer/parser to parse the code into a usable data structure that I can then examine to pull out information about that code. I also need some way for that parser to not puke if the syntax isn't perfect (for instance, if I'm typing in a line of code, that line of code isn't going to be syntactically perfect). I've been a developer for a number of years now. I know how to learn stuff. The problem is that this particular problem is so nebulous and infrequently solved in a publicly viewable way that I don't even know what I don't know, hence the idea of looking at a guide for some simple, imaginary language. If I can see the basics without all of the eventual code rot and cruft, I can go from there. A sample implementation in pretty much any language would also be adequate - I can do without the prose.