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

Configurable threading #99

Closed
Malabarba opened this issue Jul 10, 2015 · 3 comments
Closed

Configurable threading #99

Malabarba opened this issue Jul 10, 2015 · 3 comments

Comments

@Malabarba
Copy link
Member

I always end up unwinding once after thread-first or thread-last. It would be nice to be able to specify a minimum depth or length of the first sexp in threading.

For instance, the following sexp

(remove #(< value 0) (filter :name (map :items return)))

Expands to this

(->> return
     (map :items)
     (filter :name)
     (remove #(< value 0)))

I'd like a way to say “the first line should be at least 1 level deep”, so it would end up like this:

(->> (map :items return)
     (filter :name)
     (remove #(< value 0)))
@Malabarba
Copy link
Member Author

As an extra bonus, it would be nice to be able to specify a maximum length in characters for the first line. So that if the return variable has a very long name, it would still get its own line.

For instance, the following sexp

(remove #(< value 0) (filter :name (map :items the.ns/of-a-long-var-name)))

Would then still expand to this

(->> the.ns/of-a-long-var-name
     (map :items)
     (filter :name)
     (remove #(< value 0)))

@Malabarba
Copy link
Member Author

Thanks!

@benedekfazekas
Copy link
Member

np :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants