Talk:Character codes: Difference between revisions
Content added Content deleted
mNo edit summary |
(shorten verbs) |
||
Line 11: | Line 11: | ||
One such predicate might be "is the input literal?", and so the full solution might look like: |
One such predicate might be "is the input literal?", and so the full solution might look like: |
||
isLiteral =. 2 |
isLiteral =. 2=3!:0 |
||
cc =: {&a.^:(_1^isLiteral) |
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: |
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 =. |
isLiteral =. 1 11 17 e.~2^.3!:0 |
||
cc =: (8 u: |
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. |
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: | Line 23: | ||
--[[User:DanBron|DanBron]] 21:31, 5 January 2009 (UTC) |
--[[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^ |
: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^1 11 17 e.~2^.3!:0)</code>, rather than the two-liners above. |