I think the ‘doable exercise for a budding Racket programmer‘ was scoped to be an achievable, but important piece that someone else could use to make a DrRacket plugin.(or more likely change DrRacket core)
Kind regards, Stephen On Tue, 24 Oct 2017 at 00:52, Guthrie Price <gprice1...@gmail.com> wrote: > Thank you all so much for your comments (the resulting discussion was also > entertaining and unexpected). > > If I were to implement path auto-completion, would it be useful if it > wasn’t integrated into DrRacket? I am not precisely sure what I would be > adding this functionality to if not DrRacket. > > > On Sunday, October 22, 2017, Neil Van Dyke <n...@neilvandyke.org> wrote: > >> I could be missing something, but I think a filename completion procedure >> (not the DrRacket integration part) might be a doable exercise for a >> budding Racket programmer, so long as they already have a basic familiarity >> with using the filesystem and shell as a normal user. >> >> Point them to the "Paths" and "Filesystem" sections of the Racket >> Reference, and tell them they just need a few procedures from each >> (probably including `split-path` and `directory-list`). >> >> They might want to first make a procedure like this: >> >> (path-completions path-or-string?) >> ==> (listof completion-string) >> >> And then make a second procedure, which uses the first procedure, then >> adds an additional step, to let it return two values instead of one: >> >> (path-completion-prefix-and-suffixes path-or-string?) >> ==> (values prefix-string-shared-by-all-completions >> (listof completion-remainder-after-any-shared-prefix-string)) >> >> Then, when a user is interactively doing completion (like when they hit >> the Tab key in a shell), the first value returned by that second procedure >> is what would get added automatically to the path. The second value is the >> list of possible completions following that shared prefix. >> >> There are a few special cases to consider, but most should be easy to >> recognize and work through, just by thinking methodically about each point >> in your code. For example, what do you do when the input path is relative, >> or when when there are no completions, or when the path is invalid or >> nonexistent or permissions-inaccessible, or when your path is already >> complete. One case that's not obvious from the code: if the path is >> already complete and is a directory, a shell usually completes a directory >> separator, so consider whether you want to do that. >> >> To make unit tests for these, they'll have to also look at more of the >> "Filesystem" section of the Racket Reference, to create and remove files >> and directories. >> >> (I think wrapping a shell process, robustly, is much more difficult.) >> >> -- >> > You received this message because you are subscribed to a topic in the >> Google Groups "Racket Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/racket-users/0sNHzZx3JPc/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> racket-users+unsubscr...@googlegroups.com. > > >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Kind regards, Stephen -- Ealing (London), UK -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.