• Stars
    star
    334
  • Rank 126,264 (Top 3 %)
  • Language
    Common Lisp
  • License
    Other
  • Created over 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pattern Matcher Compatible with Optima

https://travis-ci.org/guicho271828/trivia.svg?branch=master

  • news! new pattern: lambda-list pattern. Contributed by akssri
  • news! new pattern: number-related patterns, e.g. >, <, =, <= …
  • news! Inline pattern implemented ! : @, @@ …
  • news!(04/02/2016) Support for fare-quasiquote is now available. See test/quasiquote for the usage
  • news!(04/22/2016) Added metabang-bind like macros if-match, when-match, unless-match, let-match, let*-match, let-match1
  • news!(05/21/2016) Added support for minor implementations: CMU, ECL, CLISP, ABCL.
  • news!(05/22/2016) Implemented ARRAY, SIMPLE-ARRAY, ARRAY-ROW-MAJOR, ARRAY-ROW-MAJOR* patterns! Multi-dimentional arrays are now more handy!
  • news!(07/21/2016) Added READ, LAST, SPLIT, SPLIT* patterns! Parsing the string is more conveninent.
  • news!(01/21/2017) Added DYNAMIC pattern! Careful use of this pattern can impact the performance sensitive code.
  • news!(04/08/2017) Added a new contrib package TRIVIA.CFFI which provides -> pattern ! Offers convenient access to foreign objects.
  • news!(05/26/2018) Added property!, which only matches when the key is present in a plist.
  • news!(09/06/2018) SPLIT symbol was exported from the trivia.ppcre package.
  • news!(02/19/2019) Added MEMBER pattern. When the argument is a constant, it also adds type declaration.
  • news!(04/24/2019) Improved the compilation of GUARD pattern. It no longer uses the internal hackery.
  • news!(04/24/2019) Balland2006 optimizer is now the default optimizer for the pattern compiler!
  • news!(04/28/2019) Added a progv pattern, which can dynamically alter the dynamic variable the value will be bound to.
  • news!(05/08/2019) Now the optimizer can be specified in the lexical environment via (declare (trivia:optimizer <name>)) (e.g. (declare (trivia:optimizer :trivial))). Implemented through cltl2 API.
  • news!(10/11/2019) The OR1 consistency checking algorithm in Level 1 no longer takes the exponential runtime. Compilation of type-r library is now 10x faster! (patch from @pfdietz)
  • news!(01/01/2021) Added HASH-TABLE-ENTRY, HASH-TABLE-ENTRIES patterns, and corresponding ! suffixed patterns for matching only if key is present in hash table.
  • news!(05/30/2021 Added support for FSet. See tests for how-to.

Trivia : Trivial Pattern Matching Compiler

Trivia is a pattern matching compiler that is compatible with Optima. It shares the same testing code with Optima and acts as a drop-in replacement for 99% usage. For the basic usage, consult our wiki. Known differences between Optima and Trivia, which are bug, are described here (7/31/2016)

(defpackage :playwithit
  (:use :cl 
-       :optima))
+       :trivia))
(in-package :playwithit)

(match '(something #(0 1 2))
  ((list a (vector 0 _ b))
   (values a b)))
;; --> SOMETHING, 2

Patterns compiled with Trivia runs faster than Optima.

runtime [sec]fibonaccigomokustring-match
optima11.539.882.5
trivia [1]9.6837.41.57

[1]: trivia is using :balland2006 optimiizer

… and Trivia is more extensible. In fact, Trivia’s defpattern is able to implement all of unmodifiable, core pattern language in Optima within itself.

(defpattern cons (a b)
  (with-gensyms (it)
    `(guard1 (,it :type cons) (consp ,it) (car ,it) ,a (cdr ,it) ,b)))

Detailed documentation is in github wiki.

Dependency & Testing

  • Level 0,1 : Alexandria only.
  • Level 2 : Additionally, lisp-namespace and closer-mop.

To run the tests, (asdf:test-system :trivia) .

To run the benchmark, (asdf:test-system :trivia.benchmark)

More Repositories

1

aaai-template

latex template for various conferences, as well as wise-man's overleaf (overleaf is terrible!)
TeX
128
star
2

inlined-generic-function

Bringing the speed of Static Dispatch to CLOS. Succeeded by https://github.com/marcoheisig/fast-generic-functions
Common Lisp
109
star
3

latplan

LatPlan : A domain-independent, image-based classical planner
Python
75
star
4

eazy-gnuplot

Super Duper Doopa Booka Lispy Gnuplot library
Common Lisp
59
star
5

sbcl-wiki

maybe-wrong sbcl internals
54
star
6

eazy-opencl

OpenCL binding for Common Lisp
Common Lisp
48
star
7

asdf-viz

ASDF system dependency visualizer
Common Lisp
37
star
8

lisp-namespace

no more discussion on lisp-1 vs lisp-2. THIS IS LISP-N.
Common Lisp
35
star
9

trivial-signal

UNIX signal handling library for Common Lisp.
Common Lisp
33
star
10

eazy-project

Boost your development!
Common Lisp
22
star
11

common-lisp-extensions

list of extensions beyond CL available in lisp implementations, and the status of its spread.
21
star
12

macroexpand-dammit

a portable code walker for Common Lisp by John Fremlin
Common Lisp
12
star
13

type-r

The complete collection of accessor functions and patterns to access the elements in a compound type specifier
Common Lisp
12
star
14

common-lisp-project-ideas

Discuss future project ideas
10
star
15

eazy-process

Yet Another Portable Library for Process Handling / Subshell Invokation
Common Lisp
9
star
16

recursive-macroexpansion

Provides another `macroexpand`
Common Lisp
8
star
17

bit-ops

Tools for writing optimized bit-vector routines
Common Lisp
8
star
18

eazy-documentation

One-shot solution to the CL library documentation generator.
Common Lisp
8
star
19

immutable-struct

Simple library that encourage the use of functional programming + pattern matching.
Common Lisp
7
star
20

ArriVAL

Yet Another Classical planning plan validator written in modern Common Lisp
Common Lisp
7
star
21

dynotune

Automated parameter tuner for CL
Common Lisp
6
star
22

hypercast

H Y P E R C A S T
Common Lisp
5
star
23

alien

Common Lisp
5
star
24

latplan-fosae

First Order State Auto Encoder implementation for Latplan
Python
5
star
25

quicklisp-project-submission

Submit to quicklisp-project/issues from your REPL!
Common Lisp
5
star
26

another-org-info

Yet Another Org-mode HTML Presentation Script
JavaScript
5
star
27

trainable-object

Provides an metaclass and APIs for the trainable funcallable instances. (WIP)
Common Lisp
5
star
28

cl-rrt

Common Lisp implementation of RRT (Rapidily exploring Random Tree), a fast probabilistic multidimentional path-plannning algorithm. Note: It will still work, but it is an old work. I think the implementation is not be very efficient because my lisp hacking has significantly improved since when I wrote this library.
Common Lisp
5
star
29

trivialib.type-unify

Unification library aimed specifically for the "polymorphic type specifiers" with type variables
Common Lisp
4
star
30

trivialib.red-black-tree

based on optima-red-black-tree
Common Lisp
4
star
31

cl-rlimit

Common lisp interface to unix rlimit -- ensure the performance of your program!
Common Lisp
4
star
32

serializable-object

An abstract class for serializable CLOS objects.
Common Lisp
4
star
33

file-local-variable

File-local variable independent from ASDF
Common Lisp
4
star
34

trivial-package-manager

A simple interface to distro-specific package managers.
Common Lisp
3
star
35

inner-conditional

Series of macros which optimizes the inner conditional jumps of looping, iterating, anything
Common Lisp
3
star
36

type-i

Type Inference Utility on unary type-checking predicates
Common Lisp
3
star
37

trivialib.bdd

BDD and ZDD
Common Lisp
3
star
38

simpath

Common Lisp
2
star
39

play-on-matrix

play with SBCL, matrix operation, VOP optimization
Common Lisp
2
star
40

dirtylogman

Command line tool for reading lots of log files
Common Lisp
2
star
41

data-structures-in-common-lisp

A survey of data structure availability / quality in common lisp
Common Lisp
2
star
42

remlic

Reimplementation of an interpretable machine learning system MLIC in Common Lisp
Common Lisp
2
star
43

dsama

Implementation of Double-Stage Action Model Acquisition
Common Lisp
2
star
44

dataloader

A universal file loader for various images/audio data formats in Common Lisp
Common Lisp
2
star
45

shibuya-posix

Provides a complete but minimum CFFI bindings to ALL posix standard header files.
Common Lisp
1
star
46

sas-parser

Fast Downward SAS parser
Common Lisp
1
star
47

structure-interface

Non-CLOS, compile-time, inlined, fast method dispatching system
Common Lisp
1
star
48

syntactic-optimization

adds context-aware optimization not available in SBCL
Common Lisp
1
star
49

ammunition

utility problem
Common Lisp
1
star
50

dd-schema

A higher-level helper library for CL-CUDD.
Common Lisp
1
star
51

goal-of-life

Goal-driven, optimal development of your life
Common Lisp
1
star
52

fast-downward-search

separate repository for Fast Downward search module
C++
1
star
53

cffi-documentation

Sample output of eazy-documentation for CFFI
HTML
1
star
54

check-throw-catch-usage

tools to download quicklisp data and investigate the source codes
Shell
1
star
55

planner-scripts

Wrapper for various planners, with resource limitations
Shell
1
star
56

aspectm

aspect-oriented hooks
Common Lisp
1
star
57

cl-pthread

Wrapper layer for POSIX pthread on common lisp.
Common Lisp
1
star