johnlcox / Motif
Licence: apache-2.0
Scala-like pattern matching for Java 8
Stars: ✭ 149
Labels
Projects that are alternatives of or similar to Motif
Aws Lambda List
A list of hopefully useful AWS lambdas and lambda-related resources.
Stars: ✭ 130 (-12.75%)
Mutual labels: lambda
Moonmail
Email marketing platform for bulk emailing via Amazon SES (Google Cloud Platform and Azure coming soon)
Stars: ✭ 1,766 (+1085.23%)
Mutual labels: lambda
Refunc
A lib make building AWS Lambda compatible layer easily
Stars: ✭ 144 (-3.36%)
Mutual labels: lambda
Scelta
(experimental) Syntactic sugar for variant and optional types.
Stars: ✭ 134 (-10.07%)
Mutual labels: lambda
Aws Data Wrangler
Pandas on AWS - Easy integration with Athena, Glue, Redshift, Timestream, QuickSight, Chime, CloudWatchLogs, DynamoDB, EMR, SecretManager, PostgreSQL, MySQL, SQLServer and S3 (Parquet, CSV, JSON and EXCEL).
Stars: ✭ 2,385 (+1500.67%)
Mutual labels: lambda
Rosie Pattern Language
Rosie Pattern Language (RPL) and the Rosie Pattern Engine have MOVED!
Stars: ✭ 146 (-2.01%)
Mutual labels: pattern-matching
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (-4.03%)
Mutual labels: lambda
Aws Maintenance Lambda
A lambda function to send alerts (to Slack, HipChat) on AWS maintenance events.
Stars: ✭ 133 (-10.74%)
Mutual labels: lambda
Gofn
Function process via docker provider (serverless minimalist)
Stars: ✭ 134 (-10.07%)
Mutual labels: lambda
Fluentvalidation.blazor
Fluent Validation-powered Blazor component for validating standard <EditForm> 🌌 ✅
Stars: ✭ 140 (-6.04%)
Mutual labels: lambda
Designing Cloud Native Microservices On Aws
Introduce a fluent way to design cloud native microservices via EventStorming workshop, this is a hands-on workshop. Contains such topics: DDD, Event storming, Specification by example. Including the AWS product : Serverless Lambda , DynamoDB, Fargate, CloudWatch.
Stars: ✭ 131 (-12.08%)
Mutual labels: lambda
Aws Secrets Manager Rotation Lambdas
Contains Lambda functions to be used for automatic rotation of secrets stored in AWS Secrets Manager
Stars: ✭ 128 (-14.09%)
Mutual labels: lambda
Flogo
Project Flogo is an open source ecosystem of opinionated event-driven capabilities to simplify building efficient & modern serverless functions, microservices & edge apps.
Stars: ✭ 1,891 (+1169.13%)
Mutual labels: lambda
Stumpy
STUMPY is a powerful and scalable Python library for modern time series analysis
Stars: ✭ 2,019 (+1255.03%)
Mutual labels: pattern-matching
Motif
A pattern matching library for Java 8. Motif provides scala-like pattern matching in Java 8.
Examples
FizzBuzz
IntStream.range(0, 101).forEach(
n -> System.out.println(
match(Tuple2.of(n % 3, n % 5))
.when(tuple2(eq(0), eq(0))).get(() -> "FizzBuzz")
.when(tuple2(eq(0), any())).get(y -> "Fizz")
.when(tuple2(any(), eq(0))).get(x -> "Buzz")
.orElse(String.valueOf(n))
.getMatch()
)
);
Optional
Optional<Person> personOpt = getPerson();
match(personOpt)
.when(some(any())).then(person -> doStuff(person))
.when(none()).then(() -> System.out.println("Person not found"))
.doMatch();
Factorial
public long factorial(long i) {
return match(i)
.when(eq(0)).get(() -> 1l)
.when(any()).get(x -> x * factorial(x - 1))
.getMatch();
}
Nested Matching
Optional<Tuple2<String, String>> opt = Optional.of(Tuple2.of("first", "second"));
match(opt)
.when(some(tuple2(eq("third"), any()))).then(b -> doStuff(b))
.when(some(tuple2(any(), eq("second")))).then(a -> doStuff(a))
.when(none()).then(() -> System.out.println("Tuple not found"))
.doMatch();
List Cons Matching
List<String> list = Arrays.asList("a", "b", "c", "d");
match(list)
.when(nil()).then(() -> System.out.println("Empty List"))
.when(headNil(eq("b"))).then(() -> System.out.println("Singleton List of 'b'"))
.when(headNil(any())).then(head -> System.out.println("Singleton List of " + head))
.when(headTail(any(), any())).then(
(head, tail) -> System.out.println("head: " + head + " Remaining: " + tail))
.doMatch();
Download
Download the latest JAR via Maven:
<dependency>
<groupId>com.leacox.motif</groupId>
<artifactId>motif</artifactId>
<version>0.1</version>
</dependency>
License
Copyright 2015 John Leacox
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].