I sometimes find it convenient to be able to specify the "short-circuiting" of the "or" operator in the reverse order.
This happens in particular when I use the "and-let*" form, and I want to provide the default alternative:
Instead of
(or
(and-let* (...)
...)
default-value)
it might be preferable to write:
(otherwise default-value
(and-let* (...)
...))
where "otherwise" is defined trivially as
(define-syntax otherwise
(syntax-rules ()
((_) #false)
((_ expression) expression)
((_ expression . expressions)
(or (otherwise . expressions) expression))))
(so it effectively reverses the order of arguments to "or")
Do you think "otherwise" is a good name for this?
Or are there any alterantives that you'd recommend?
I sometimes find it convenient to be able to specify the
"short-circuiting" of the "or" operator in the reverse order.
This happens in particular when I use the "and-let*" form, and I
want to provide the default alternative:
Instead of
(or
(and-let* (...)
...)
default-value)
it might be preferable to write:
(otherwise default-value
(and-let* (...)
...))
where "otherwise" is defined trivially as
(define-syntax otherwise
(syntax-rules ()
((_) #false)
((_ expression) expression)
((_ expression . expressions)
(or (otherwise . expressions) expression))))
(so it effectively reverses the order of arguments to "or")
Do you think "otherwise" is a good name for this?
Or are there any alterantives that you'd recommend?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 376 |
Nodes: | 16 (2 / 14) |
Uptime: | 24:54:40 |
Calls: | 8,035 |
Calls today: | 5 |
Files: | 13,034 |
Messages: | 5,829,138 |