On Fri, Apr 29, 2011 at 2:49 PM, bill lam <[email protected]> wrote: > Thanks, this seems fix \\ trains. > > it raises index error on an empty string. > evalbs '' > |index error: splitbs > | evalbs''
This seems to be a "feature" of ;: Despite the dictionary's claim to the contrary, in current implementations of J, x ;: '' does not produce the result produced by ;: '' when x is defined as specified at http://www.jsoftware.com/help/dictionary/d332.htm A workaround would be to add ^:(*@#) to the definition or use of splitbs. > or should it just return the empty string? > > this seems correct, > evalbs '\a\"' > \a" > but is the following expected? > evalbs '\a\\' > \a\\ That's a bug. I think I know why it's happening. I'll try to look into it soon. > BTW json mandates strings should be enclosed by double quotes so that > literal true and false is different from "true" and "false", also the first > character is always ascii for auto-detecting character encoding. Yes, I stumbled across this issue recently -- previously I had been happily using valid-for-javascript property names in some of my serialized data. On the other hand evalbs does not really make sense when applied to json as a whole. Consider, for example: evalbs '{"a\"b:":"c\"d"}' {"a"b:":"c"d"} It would be best to extract the contents of the quotes before using evalbs. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
