Talk:Character codes: Difference between revisions

shorten verbs
mNo edit summary
(shorten verbs)
Line 11:
One such predicate might be "is the input literal?", and so the full solution might look like:
 
isLiteral =. 2 = 3!:0
cc =: {&a.^:(_1^isLiteral) f.
 
But this, too, has its limitations. For example, it still doesn't address Unicode. While I don't know enough about Unicode to be confident that it covers every case, we might make this more general (and longer), with:
 
isLiteral =. 21 204811 13107217 e.~ 2^.3!:0
cc =: (8 u: 4 u: ])^:(_1^isLiteral) f.
 
But since the task doesn't require handling Unicode, either verb will suffice. Both are symmetric, and both have the satisfying property of being self-inverse (obviously), so that <code>cc^:2</code> is the identity, and <code>-: cc^:2</code> a tautology.
Line 23:
--[[User:DanBron|DanBron]] 21:31, 5 January 2009 (UTC)
 
:PS: If we make this change, my personal preference is that we give the solution(s) succinctly, as <code>{&a.^:(_1^2=3!:0)</code> or <code>(8 u:4 u:])^:(_1^21 204811 13107217 e.~2^.3!:0)</code>, rather than the two-liners above.
Anonymous user