介绍
挑战在于创建一个程序/函数,以打印其自身源代码和给定字符串输入的交集。这是代码高尔夫球,更准确地说:
- 让我们
I
可以在输入设置{"a","b","c"}
- 让
S
是源代码集{"b","f"}
- 然后交集就是他们共享的东西
I ∩ S = {"b"}
输入项
输入是灵活的。它应该能够处理用于源代码的字符编码。
输出量
输出灵活。它应该是输入和源代码共享的字符集。而且,集合是不同对象的无序集合。综上所述:
- 输出是灵活的:
- 可以是任何数据结构(字符串或其他)
- 可能是无序的
- 可能有尾随
\n
- 应该与众不同
限制
与quine挑战类似,程序/功能可能无法读取其自身的源代码,并且不允许使用0字节的解决方案。
例子
- #1
functor x(I){ return I ∩ self; }
Inputs Outputs
------ -------
enter preformatted text here -> {"e","n","t","r","f","o","x"}
["Albrt"," Einstin"] -> {"l","r","t","n","s"}
- #2
(_)->_&"(_)->&\"\\"
Inputs Outputs
------ -------
"Security at the expense of -> "
usability comes at the expense
of security."
(0____0) -> (_)
- #3
ಠa益длф
Inputs Outputs
------ -------
Far out in the uncharted backwaters ->"a"
of the unfashionable end of the
Western Spiral arm of the Galaxy lies
a small unregarded yellow sun.
Orbiting this at a distance of roughly
ninety-eight million miles is an
utterly insignificant little blue-green
planet whose ape-descended life forms
are so amazingly primitive that they
still think digital watches are a pretty
neat idea.
(ノಠ益ಠ)ノ彡┻━┻ ->"ಠ益"
测试用例
Albert Einstein
\__( O__O)_/
!@#$%^&*()_+{}|:"<>?
1234567890-=[]\;',./
(ノಠ益ಠ)ノ彡┻━┻
“¤>%,oỊȤʠ“ØụĊ5D³ṃṠɼQ»j;Ç;“;}¶”
┬──┬ ノ( ゜-゜ノ)
Far out in the uncharted backwaters of the unfashionable end of the Western Spiral arm of the Galaxy lies a small unregarded yellow sun. Orbiting this at a distance of roughly ninety-eight million miles is an utterly insignificant little blue-green planet whose ape-descended life forms are so amazingly primitive that they still think digital watches are a pretty neat idea.
更新资料
- [16-08-10]:集是不同对象的无序集合
- [16-08-10]:尾随换行符是可以接受的