Closed gacelita closed 3 years ago
Why exactly is it happening? Are you putting vector in dictionary? Why? It’s actually perfectly valid to return substitute of functions (e.g. maps) as well as real functions from dictionary.
I am building a personal website. The website has a list of works. The works have a description that has to be translated in English and Spanish. So I put the works (which are stored in a vector) in the dictionary. Is this a bad idea? Should it be a list instead?
I know that I can store functions in the dictionary, but I do not want to store a function whose only purpose is to return the vector. I chose to fork tongue and make the change I mentioned here.
Interesting, I haven't envisioned tongue to be a storage for any random stuff, only strings. But your use-case makes sense, I'm thinking now how to better address it without sacrificing agility that ifn provides. Any ideas (besides chaning to fn?)
Revisiting this, it's not that difficult to simply dispatch the proper collection without putting the collections inside tongue's dictionaries. Putting a large, dynamic amount of data inside the dictionaries does not seem like a good practice.
You can close this, if you want. Greets!
In core.cljc:
(if (ifn? t) (t) t)))
I think it should be:
(if (fn? t) (t) t)))
This way, vectors stop being called with 0 arguments.