Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexknauth/cond-strict
cond: what it should have been
https://github.com/alexknauth/cond-strict
Last synced: about 1 month ago
JSON representation
cond: what it should have been
- Host: GitHub
- URL: https://github.com/alexknauth/cond-strict
- Owner: AlexKnauth
- License: mit
- Created: 2016-09-28T04:21:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-07T14:55:54.000Z (almost 3 years ago)
- Last Synced: 2024-12-02T01:54:50.049Z (about 1 month ago)
- Language: Racket
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
cond-strict
===
A version of [`cond`][cond] that raises an error when all the clause
conditions return false, instead of returning `#````racket
> (require cond-strict)
> (cond/strict
[else 5])
5
> (cond/strict
[#false 42]
[else 5])
5
> (cond/strict
[#false 42])
;cond: all clause conditions were false
> (cond/strict
[(positive? -5) (error "doesn't get here")]
[(zero? -5) (error "doesn't get here, either")]
[(positive? 5) 'here])
'here
> (cond/strict
[(member 2 '(1 2 3)) => (lambda (l) (map - l))])
(list -2 -3)
> (cond/strict
[(member 2 '(1 2 3))])
(list 2 3)
> (cond/strict
[(member 9.75 '(1 2 3)) 42])
;cond: all clause conditions were false
```[cond]: http://docs.racket-lang.org/reference/if.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._cond%29%29