|kwertii||Is it a bad idea to write a macro that macroexpands CCASE and substitutes EQUAL for every instance of EQL as a way of getting a CCASE that works on strings?|
I'm thinking some implementations might use EQL somewhere besides the direct comparisons I'm interested in. Is that likely to be a problem?
|froydnj||"somewhere besides the direct comparisons"?|
|action||froydnj slams his encoding changes|
|froydnj||slams his encoding changes|
|kwertii||froydnj: Looking at the macroexpand of ccase on SBCL, it only uses EQL when comparing the forms. But there's other boilerplate code to construct the error message. I can imagine some other implementation might use EQL in there.|
|alastair37||why are you macroexpanding ccase and not writing your own separate macro that's distinct from ccase?|
(which just does similar things to ccase)
|kwertii||alastair37: To avoid duplicating the functionality of ccase, if I can|
|alastair37||i think i'd rather duplicate a bit of functionality than worry about deep eql vs. equal issues.|
|kwertii||alastair37: that's probably best ...|
|alastair37||i mean, you don't lose any efficiency, and it makes things clearer and more under your control.|
|msingh||hm is there a nice way to do this: "a bc d e f" -> ("a" "bc" "d" "e" "f")|
|slyrus||yes, it is odd that they lift things like regular expressions to the library developer but included a nifty roman numeral printing facility in the CL standard.|
|alastair37||msingh: (mapcar #'symbol-name (read-from-string <your-string>))|
not direct, but certainly concise.
probably causes some overhead from reading and interning the symbols, if they aren't already in the current package.
but in 99.99% of cases, you don't care
|kwertii||msingh: cl-utilities includes a split-sequence function that does that: http://common-lisp.net/project/cl-utilities/doc/split-sequence.html|
|alastair37||whoops; need to append parens at the beginning and end of your string.|
little mental flatulence.
|msingh||alastair37, ah thats no good. i want to avoid brackets in my little interpreter|
|alastair37||no, you'd append them in the function|
as in: (mapcar #'symbol-name (read-from-string (concatenate 'string "(" your-string ")")))
that works; i just tested it.
|msingh||what did you test with?|
|alastair37||(mapcar #'symbol-name (read-from-string (concatenate 'string "(" "a bc d" ")")))|
=> ("A" "BC" "D")
|msingh||sweet.. that looks good|
ah. ya gotta love latex: "\z@ is shorthand for 0pt"
cuz, ya know, typing \z@ is so much easier than typing 0pt
|asbjxrn||\z@ inserts 0pt in the text, or sets the text size to 0pt?|
|slyrus||I assume the former|
|beach||is that LaTeX, or was it inherited from TeX?|
|slyrus||who knows. tex, latex, a bazillion latex packages, etc... makes lisp look downright clean.|