Awesome
MLStyle.jl
<p align="center"> <img width="250px" src="https://raw.githubusercontent.com/thautwarm/MLStyle.jl/master/docs/favicon.ico"/> </p>Providing intuitive, fast, consistent and extensible functional programming infrastructures, and metaprogramming facilities.
Check everything in the documentation website.
Preview
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 Base.@enum
than MLStyle.@data
, you need this to pattern match on Julia Base.@enum
.
Benchmarks
Arrays
Tuples
Data Types
Extracting Struct Definitions
Misc
An Example from Match.jl Documentation
Acknowledgements
Thanks to all individuals referred in Acknowledgements!