Providing intuitive, fast, consistent and extensible functional programming infrastructures, and metaprogramming facilities.
Check everything in the documentation website.
using MLStyle @data Shape begin # Define an algebraic data type Shape Rock Paper Scissors end # Determine who wins a game of rock paper scissors with pattern matching play(a::Shape, b::Shape) = @match (a, b) begin (Paper, Rock) => "Paper Wins!"; (Rock, Scissors) => "Rock Wins!"; (Scissors, Paper) => "Scissors Wins!"; (a, b) => a == b ? "Tie!" : play(b, a) end
P.S: When preferring
MLStyle.@data, you need this to pattern match on Julia
Thanks to all individuals referred in Acknowledgements!
6 days ago