Fork me on GitHub
#beginners
<
2016-06-08
>
donaldball01:06:12

See the docstring for var. It is a special form that takes a symbol that must resolve to a var. function-name isn’t a var, it’s a local binding

danmidwood01:06:18

You can do it as a macro through, something like

(defmacro valid-args? [function-name] `(:arglists (meta (var ~function-name))))

danmidwood01:06:27

That will macroexpand like this

user> (macroexpand '(valid-args? map))                                                                                                                                                                             
(:arglists (clojure.core/meta (var map)))        

danmidwood01:06:39

And work like:

user> (valid-args? map)                                                                                                                                                                                            
([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])  

bronsa10:06:01

or as a function by using resolve rather than var

rcanepa19:06:36

I am struggling to understand why I cannot “read” a file using using a relative path, but it finds the file when I use . I solved the issue doing this: (io/reader (.getFile (io/resource "bootstrap/accounts.csv"))), however, I would like to understand the why.

rcanepa19:06:03

The file is inside the resource file, so I know that is part of the classpath.

rauh19:06:41

Don't get the file of a resource, it'll bite you in deployment (the resource will only be a URL and not a file)

rauh19:06:47

@rcanepa:Just call reader on the resource

rcanepa19:06:11

@rauh thanks!… that works perfect