This is also something I want and have thought about for some time. My main
use case is for functions that I want to accept an arbitrary sequence, but
coerce the sequence to a list/set/etc. if it's not already a list/set/etc.
I think one viable approach would be to do the following:
1. Add
Would this give part of what you're looking for?
#lang racket
(define (my-string-length s)
((or/c (and/c (or/c symbol? string?) (compose1 string-length ~a))
(curry raise-arguments-error 'my-string-length "invalid arg"
"arg"))
s))
(my-string-length "foo")
(my-string-length 'foo)
2 matches
Mail list logo