Monday, June 8, 2015

Riddle 3: not x~string`$x

Here’s an easy one:

When will {(10h=type x)&not x~string`$x} return true (1b)?

Slightly harder:

In cases where this is problematic, what can be done about it?

Labels: ,

1 Comments:

At June 9, 2015 at 8:04 PM , Blogger Unknown said...

1) Strings with leading/trailing whitespace:

q){(10h=type x)&not x~string`$x} " 123"
1b

2) I think where you are heading with this is - if you really must have spaces in your syms, you can generate such syms through bytecode manipulation:

q)-8!`123
0x010000000d000000f531323300
q)-9!0x010000000d000000f531323300
`123
q)-9!0x010000000e000000f52031323300
` 123

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home