The mcase Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The mcase Reference Manual

This is the mcase Reference Manual, version 1.2.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 05:35:14 2022 GMT+0.

Table of Contents


1 Introduction

MCASE 0.0.0

What is this?

Control frow macros with case comprehensiveness checking.

Usage

* (deftype state ()
    '(member :a :b :c))
STATE

* (mcase:mcase state :hoge
    (:a "A")
    (:b "B"))
=> ERROR Missing member (:C) :of STATE

For details, see spec file.

From developer

Product's goal

License

Public domain.

Developed with

SBCL

Tested with

Installation


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 mcase

Control frow macros with case comprehensiveness checking.

Author

SATO Shinichi

Source Control

(GIT git@github.com:hyotang666/mcase)

Bug Tracker

https://github.com/hyotang666/mcase/issues

License

Public domain

Version

1.2.1

Dependency

millet (system).

Source

mcase.asd.

Child Component

mcase.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 mcase/mcase.asd

Source

mcase.asd.

Parent Component

mcase (system).

ASDF Systems

mcase.


Previous: , Up: Lisp   [Contents][Index]

3.1.2 mcase/mcase.lisp

Source

mcase.asd.

Parent Component

mcase (system).

Packages

mcase.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 mcase

Source

mcase.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: emcase (type <target> &body clauses)

# EMCASE

## Description:
A thin wrapper for CL:ECASE to check MEMBER comprehensiveness in macro expansion time.

### syntax (EMCASE type <target> &body clauses)
=> result
type := type-specifer, otherwise implementation dependent condition.

“‘lisp
#?(emcase "not type specifier" :dummy)
:signals condition
, :lazy
“‘
<target> := Expression to generate target value.
clause* := Same with CL:ECASE.
result := T.

## Affected By:
none

## Side-Effects:
none

## Notes:

## Exceptional-Situations:
When type specifier is not expanded to (MEMBER ...) an error is signaled.

“‘lisp
#?(emcase (unsigned-byte 8) :dummy)
:signals error
, :lazy
“‘

## Examples:

“‘lisp
#?(emcase state :dummy (:a "Missing :b and :c members"))
:signals error
, :lazy
“‘

“‘lisp
#?(emcase state :dummy ((:a :b :c) "Works fine."))
:signals error
“‘

“‘lisp
#?(emcase state :dummy
((:a :b :c) "Fine but")
(:d "Ooops! Unknown member is found!"))
:signals error
, :lazy
“‘

Package

mcase.

Source

mcase.lisp.

Macro: mcase (type <target> &body clauses)

# MCASE

## Description:
A thin wrapper for CL:CASE to check MEMBER comprehensiveness in macro expansion time.

### syntax (MCASE type <target> &body clause\*)
=> result

## Arguments and Values:
type := type-specifer, otherwise implementation dependent condition.

“‘lisp
#?(mcase "not type specifier" :dummy)
:signals condition
, :lazy
“‘
<target> := Expression to generate target value.
clause* := Same with CL:CASE.
result := T.

## Affected By:
none

## Side-Effects:
none

## Notes:

## Exceptional-Situations:
When type specifier is not expanded to (MEMBER ...) an error is signaled.

“‘lisp
#?(mcase (unsigned-byte 8) :dummy)
:signals error
, :lazy
“‘
Ordinary otherwise clause is invalid because in such case you should use CASE.

“‘lisp
#?(mcase (member 0 1 2) :dummy
((0 1 2) :yes)
(otherwise :no))
:signals error
, :lazy
“‘
One exceptional situation is OTHERWISE in the MEMBER.

“‘lisp
#?(mcase (member 0 1 2 otherwise) :dummy
((0 1 2) :yes)
(otherwise :no))
=> :NO
“‘

## Examples:

“‘lisp
#?(deftype state () ’(member :a :b :c))
=> STATE
“‘

“‘lisp
#?(mcase state :dummy (:a "Missing :b and :c members"))
:signals error
, :lazy
“‘

“‘lisp
#?(mcase state :dummy ((:a :b :c) "Works fine."))
=> NIL
“‘

“‘lisp
#?(mcase state :dummy
((:a :b :c) "Fine but")
(:d "Ooops! Unknown member is found!"))
:signals error
, :lazy
“‘

Package

mcase.

Source

mcase.lisp.


5.2 Internals


Previous: , Up: Internals   [Contents][Index]

5.2.1 Ordinary functions

Function: check-exhaust (type clauses)
Package

mcase.

Source

mcase.lisp.

Function: pprint-mcase (output exp)
Package

mcase.

Source

mcase.lisp.

Function: pprint-mcase-clause (output clause &rest noise)
Package

mcase.

Source

mcase.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables