https://github.com/kubapod/meh
Control flow utilities
https://github.com/kubapod/meh
error-handling failure flow-control mathematica utilities
Last synced: 4 months ago
JSON representation
Control flow utilities
- Host: GitHub
- URL: https://github.com/kubapod/meh
- Owner: kubaPod
- Created: 2018-07-04T10:55:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-08T09:36:33.000Z (over 5 years ago)
- Last Synced: 2025-10-23T07:59:53.969Z (9 months ago)
- Topics: error-handling, failure, flow-control, mathematica, utilities
- Language: Mathematica
- Size: 93.8 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Meh
Control flow utilities.
It happens that for more complicated or interactive applications solutions offered by native `Messages` and related functions are not enough.
There was an attempt to address this problem by developers of ``GeneralUtilities` `` but it is still undocumented and not polished.
This package is meant to provide solutions for easier exceptions handling and keep it idiomatic/ natural to regular WL experience.
It also comes with few minor utilities that I found to be used by me quite frequently.
It is still under development, there is a brief [documentation in WIKI](https://github.com/kubaPod/Meh/wiki/Symbols-Guide)
## Installation
### Manual
Go to 'releases' tab and download appropriate .paclet file.
Run `PacletInstall @ path/to/the.paclet` file
### Via ``MPM` ``
If you don't have ``MPM` `` yet, run:
Import["https://raw.githubusercontent.com/kubapod/mpm/master/install.m"]
and then:
Needs @ "MPM`"
MPM`MPMInstall["kubapod", "meh"]
## Usage teaser
```Mathematica
MCatch[
MThrowAll["500", General::appname, "1asd"]
]
```
> `General::appname`: The name 1asd is not valid for the application. A valid name starts with a letter and is followed by letters and digits.
> ```
> Failure["500", <| "MessageTemplate" :> General::appname, "MessageParameters" -> {"1asd"}]]
> ```
```Mathematica
foo // ClearAll
$fooPatt = KeyValuePattern[{"a" -> _Integer, "c" -> _String}];
foo // MValidateByDefault[ $fooPatt ]
foo[ in: $fooPatt]:= in["a"]
foo @ <|"a" -> 1, "c" -> "c"|>
foo @ <|"b" -> 1, "c" -> {1}|>
```
> `1`
> `foo::InvalidArg`: Argument No. 1 has invalid structure at:
> {Key[c]} List
> {Key[a]} Missing[]
> It needs to match:
> <|a -> _Integer, c -> _String|>
> ```Failure[...]```