When if is just a function

Table of Contents Three Reasons This Matters Looking at If Single pattern Consistency & Flexibility Piping Into Control Flow Applying functions Partial Application Higher-Order Control Flow Extensibility Unless and Until Unlimited control flow functions The Trade-offs Performance Tooling On the other hand In Python, when you write if x > 5: print(“big”), you’re using special syntax baked into the language. You can’t change how if works. You can’t compose it, pipe it, or partially apply it. You can’t pass if as an argument to another function. But what if you could? What if if, for, while and even fn and var were just regular functions? In languages like REBOL, Red and Rye they are. Three Reasons This Matters# Consistency. Most languages treat…

Read more on Lobste.rs