Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should not try to call vectors with 0 arguments #2

Closed
gacelita opened this issue Jul 23, 2016 · 4 comments
Closed

It should not try to call vectors with 0 arguments #2

gacelita opened this issue Jul 23, 2016 · 4 comments

Comments

@gacelita
Copy link
Contributor

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.

@tonsky
Copy link
Owner

tonsky commented Jul 25, 2016

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.

@gacelita
Copy link
Contributor Author

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.

@tonsky
Copy link
Owner

tonsky commented Aug 3, 2016

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?)

@gacelita
Copy link
Contributor Author

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!

@tonsky tonsky closed this as completed Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants