Skip to content

Conversation

@jake-jake-jake
Copy link
Contributor

No description provided.

(t/is (= 3 (simple-use))))
(let [lazily-evaluated (partial inc 2 3)]
#?(:clj (t/is (thrown? Exception (lazily-evaluated)))
:cljs (t/is (thrown? js/Error (lazily-evaluated)))))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if handling the JS case is needed, but I thought I'd add this. I can remove if that makes more sense.

(defn test-fn [& args]
(into [] args))

(t/deftest test-partial []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about:

  1. Chaining partials
  2. Including lazy sequences
  3. A partial partial

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to add some more cases.

For 2, I am pushing up a test that has an infinite sequence and takes from it. If that's not quite right let me know.

For 1, do you mean a sequence of partials? I included what could be a test for that, but also, if that's not quite right let me know.

Copy link
Member

@jeaye jeaye Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You got this one
  2. Looks good
  3. I was thinking something like (((partial partial) +) 0 5)

Seemed like a good edge case to cover.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally. I adjusted the partial-partial tests. Lemme know any other adjustments.

@jeaye jeaye merged commit eed030a into jank-lang:main Jan 10, 2025
2 checks passed
@jeaye
Copy link
Member

jeaye commented Jan 10, 2025

Well done!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants