switch case for constants-only?
Steven E. Harris
seh at panix.com
Sat Dec 5 17:24:18 PST 2009
BCS <none at anon.com> writes:
> Lisp has something that workd like this.
Did you mean the "case" family¹ of forms?
,----
| CL-USER> (case 3
| (1 "foo")
| (2 "bar")
| (otherwise "baz"))
| "baz"
| CL-USER> (case 4
| (1 "foo")
| ((2 4) "bar")
| (otherwise "baz"))
| "bar"
`----
There's also the similar "typecase" family².
Footnotes:
¹ http://www.lispworks.com/documentation/HyperSpec/Body/m_case_.htm
² http://www.lispworks.com/documentation/HyperSpec/Body/m_tpcase.htm
--
Steven E. Harris
More information about the Digitalmars-d
mailing list