Since as long as I've been programming I've wanted a operator that's like the word "or" but not "logical or", rather "please try this OR that if it doesn't work". For ex. in Javascript: `someString.endsWith("jpg" or "png")` Does any programming language do this?
I've never seen the behavior you're describing but sum types can express the more general idea of "alternate realities": match ending with Jpg => stuff | Png => stuff (* Guaranteed to be either jpg or png *)
-
-
Ah yeah I see, that is sort of the same idea in a different shape(pattern matching). In the above tweet I was less interested in the general notion of "alternate realities" and more in "having a concise infix notation for trying a function with different values till one succeeds"
-
The Icon programming language ended up having the exact construct I was looking for:https://twitter.com/Ceasar_Bautista/status/1173663478105526278 …
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.