I'm looking for a more idiomatic way, if possible, to write the following clojure code:
(import '(System.Net HttpWebRequest NetworkCredential)
'(System.IO StreamReader))
(defn downloadWebPage
"Downloads the webpage at the given url and returns its contents."
[^String url ^String user ^String password]
(def req (HttpWebRe...
I have a sequence of values that I get from somewhere else, in a known order. I also have one separate value. Both of these I want to put into a struct. I.e.
(defstruct location :name :id :type :visited)
Now I have a list
(list "Name" "Id" "Type")
that is the result of a regexp.
Then I want to put a boolean in :visited; yielding a...
So there's list?, seq?, vector?, map? and so on to determine what type of collection the argument is.
What's a good way of telling the difference between
a map (i.e. something that has key-value pairs)
a collection (i.e. things that contains values)
a non collection value like a string.
Is there a better way than
#(or (seq? %)...