Is there a preferred library for partial applicati...
# announcements
j
Is there a preferred library for partial application and similar functionality that is not available in stdlib?
Copy code
fun byTagCategoryAndTag(tagCategory : TagCategory, vararg tags : TagInfo) : (TagCategory, TagInfo) -> Boolean = { cat, tag -> tagCategory == cat && tag in tags}
fun byMatchingTags(vararg tags : TagInfo) : (TagInfo) -> Boolean =  partial(::byTagCategoryAndTag, TagCategory.ROOT)
k
arrow has a lot of FP stuff if you wanna go off the deep end: https://arrow-kt.io
there’s
.partiallyN
permutation extension functions on all the
kotlin.FunctionN
types
j
Thanks, already using arrow, took me a while thanks the varargs that was throwing me off. My problem was I needed to partially apply to the return value.
Copy code
fun byMatchingTags(vararg tags : TagInfo) : (TagInfo) -> Boolean =  byTagCategoryAndTag(TagCategory.ROOT, *tags).partially1(TagCategory.ROOT)