3 ms·
Cool idea. Do any other languages have this?
by ape4 2y ago
Cool idea. Do any other languages have this?
- jhbadger 2y agoR has probably the best help feature for any language -- not only can you ask it about help on individual functions with "?", the tradition (and this continues with most add in packages as well as builtins) is not only does it give you info on the function, it gives you example code using it so you can understand what it does in practice.
- emmelaich 2y agoutop for ocaml is cool, gives type signatures for functions. no explicit help, but does offer completions with tab. Similarly, rtop for reason. https://opam.ocaml.org/blog/about-utop/ https://opam.ocaml.org/blog/about-utop/ and https://opam.ocaml.org/packages/rtop/ https://opam.ocaml.org/packages/rtop/
- reycharles 2y agoI wrote a small thing for adding a `#doc List.find` directive. However, I don't maintain it anymore since I think it doesn't see much use and it's work to keep up on OCaml compiler internals changes (and it's my impression it never picked up much adoption). https://github.com/reynir/ocp-index-top https://github.com/reynir/ocp-index-top dbuenzli's down also has a similar feature.
- stevekemp 2y agoLike many others here I once wrote a toy lisp in golang, and I added a help function. It would give usage-information for all the built-in functions. > (help +) Arguments N arg1..argN Adds all arguments present to the first number. > (help map) Arguments lst:list fun:function Return a list with the contents of evaluating the given function on every item of the supplied list. See-also: map-pairs
- freedomben 2y agoRuby has a similar help() function you can invoke from the REPL (irb), or from the CLI with the standalone tool `ri`[1]. Pretty nifty feature! [1]: https://stackoverflow.com/a/25671404 https://stackoverflow.com/a/25671404
- chillpenguin 2y agoSmalltalk, by far, is the best in this category.
- mechanicum 2y agoClojure has doc and source functions. For example: user=> (doc clojure.core) ------------------------- clojure.core Fundamental library of the Clojure language user=> (doc +) ------------------------- clojure.core/+ ([] [x] [x y] [x y & more]) Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +' user=> (source +) (defn + "Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'" {:inline (nary-inline 'add 'unchecked_add) :inline-arities >1? :added "1.2"} ([] 0) ([x] (cast Number x)) ([x y] (. clojure.lang.Numbers (add x y))) ([x y & more] (reduce1 + (+ x y) more)))
- JadeNB 2y agoAlthough it's probably not at the top of many people's minds (includind mine) as a favorite programming language, Mathematica does have fantastic help, accessible with `?` and expandable from there as needed.