Fork me on GitHub
#cider
<
2020-02-22
>
munichlinux16:02:05

Hey guys, beginner question: c-c c-d c-d give me a nice documentation, 1. is there a way to figure out the type of the argument? 2. examples like how I see in the clojuredocs would be nice, is there a way of getting that?

jumar16:02:22

What do you mean by the type of the argument? Clojure is dynamically typed so it (usually) cannot know what the type is.

munichlinux16:02:24

To some degree there is, e.g into take a sequence

jumar16:02:09

Yes, but there's no type information, it fails at runtime if you provide a wrong argument.

dpsutton17:02:43

C-c C-d C-c will load the clojuredocs examples in a buffer

munichlinux16:02:04

My mini buffer did show clojure.core/into: ([] [to] [to from]) if it showed something like clojure.core/into: ([] [to:seq] [to:seq from:seq]) it would have been way easier.

jumar16:02:59

That would mean you have to somehow parse the docs and infer "types" from there. There's no standard for that. For functions that have spec you can look at that though

munichlinux16:02:07

right, my argument is that it would boost the productivity.

jr0cket13:02:31

In the example you would potentially have a long list of types that into accepts, or the more generic xs. Into can take any collection types and not just sequences. Most functions in clojure.core are designed to be very generic.