<jupyter_start><jupyter_text>Partial function application<jupyter_code>def f(a: Int, b: Double) = a + b
// Provide b only
// g is now a function that only takes an Int (first argument)
def g = f(_: Int, 2d)
// g: Int => Double
g
g(2)
// Provide "a" only
def h = f(1, _: Double)
h
h(3d)<jupyter_output><empty_output><jupyter_text>Currying<jupyter_code>val f = (a: Int, b: Double, c: String) => a + b + c
// Curry it
val fCurried = f.curried
fCurried(1)
fCurri<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14754098360655737, 'fraction_numerical': 0.010245901639344262, 'mean_word_length': 4.620689655172414, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '410112', 'license': 'MIT', 'n_tokens_mistral': 208, 'n_tokens_neox': 204, 'n_words': 60, 'path': 'scala/Partial-functions-and-currying.ipynb', 'repo_name': 'ashishpatel26/learning', 'size': '488'}