Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Elm-Lang what does the \_ -> statement (symbol, operator, pattern) mean?

Tags:

elm

I came across what I thought was a pattern in test code. At first glanced it looked to me like a pattern I had never seen before, but what exactly is it?

I am adding this entry for folks who may run into same issue.

like image 322
KK. Avatar asked Mar 10 '23 22:03

KK.


1 Answers

\_ -> is an anonymous function that takes one argument, but it does not use the argument in the function body, so instead of naming it like \a -> is just discards the argument using _.

like image 157
Charles Maria Avatar answered Mar 22 '23 23:03

Charles Maria