经过一些操作,我得到了这个数据结构:
(((((([3844 4465 6555 5551 5192 9211]
[3844 4465 6555 5551 5192 9296]
[3844 4465 6555 5551 5192 9216])
([3844 4465 6555 5551 5151 5192] [3844 4465 6555 5551 5151 5184])
([3844 4465 6555 5551 5184 8464]))
(([3844 4465 6555 5565 6561 6112] [3844 4465 6555 5565 6561 6175])
([3844 4465 6555 5565 6533 3367]
[3844 4465 6555 5565 6533 3321]
[3844 4465 6555 5565 6533 3364])))
((([3844 4465 6561 6112 1281 8177] [3844 4465 6561 6112 1281 8128])
([3844 4465 6561 6112 1296 9633])
([3844 4465 6561 6112 1225 2556] [3844 4465 6561 6112 1225 2512])
([3844 4465 6561 6112 1247 4774]
[3844 4465 6561 6112 1247 4720]
[3844 4465 6561 6112 1247 4761]
[3844 4465 6561 6112 1247 4753])
([3844 4465 6561 6112 1275 7526] [3844 4465 6561 6112 1275 7569])
([3844 4465 6561 6112 1288 8855] [3844 4465 6561 6112 1288 8836]))
(([3844 4465 6561 6175 7526 2625]
[3844 4465 6561 6175 7526 2640]
[3844 4465 6561 6175 7526 2673]
[3844 4465 6561 6175 7526 2628])
([3844 4465 6561 6175 7569 6943])))
((([3844 4465 6533 3367 6786 8646]
[3844 4465 6533 3367 6786 8614]
[3844 4465 6533 3367 6786 8640]
[3844 4465 6533 3367 6786 8626]
[3844 4465 6533 3367 6786 8649])
([3844 4465 6533 3367 6724 2485]
[3844 4465 6533 3367 6724 2465]
[3844 4465 6533 3367 6724 2415]))
(([3844 4465 6533 3321 2133 3367] [3844 4465 6533 3321 2133 3364])
([3844 4465 6533 3321 2145 4558]
[3844 4465 6533 3321 2145 4510]
[3844 4465 6533 3321 2145 4560])
([3844 4465 6533 3321 2147 4774]
[3844 4465 6533 3321 2147 4720]
[3844 4465 6533 3321 2147 4761]
[3844 4465 6533 3321 2147 4753])
([3844 4465 6533 3321 2116 1653]
[3844 4465 6533 3321 2116 1617]
[3844 4465 6533 3321 2116 1651]
[3844 4465 6533 3321 2116 1680]
[3844 4465 6533 3321 2116 1681]))
(([3844 4465 6533 3364 6441 4186]
[3844 4465 6533 3364 6441 4187]
[3844 4465 6533 3364 6441 4141])
([3844 4465 6533 3364 6426 2625]
[3844 4465 6533 3364 6426 2640]
[3844 4465 6533 3364 6426 2673]
[3844 4465 6533 3364 6426 2628]))))
(((([3844 4485 8515 1520 2059 5985]
[3844 4485 8515 1520 2059 5922]
[3844 4485 8515 1520 2059 5929]
[3844 4485 8515 1520 2059 5995])
([3844 4485 8515 1520 2035 3553]
[3844 4485 8515 1520 2035 3570]
[3844 4485 8515 1520 2035 3577])
([3844 4485 8515 1520 2025 2556] [3844 4485 8515 1520 2025 2512])
([3844 4485 8515 1520 2080 8037])
([3844 4485 8515 1520 2016 1653]
[3844 4485 8515 1520 2016 1617]
[3844 4485 8515 1520 2016 1651]
[3844 4485 8515 1520 2016 1680]
[3844 4485 8515 1520 2016 1681]))
(([3844 4485 8515 1596 9633 3367]
[3844 4485 8515 1596 9633 3321]
[3844 4485 8515 1596 9633 3364]))
(([3844 4485 8515 1541 4186 8646]
[3844 4485 8515 1541 4186 8614]
[3844 4485 8515 1541 4186 8640]
[3844 4485 8515 1541 4186 8626]
[3844 4485 8515 1541 4186 8649])
([3844 4485 8515 1541 4187 8778])
([3844 4485 8515 1541 4141 4186] [3844 4485 8515 1541 4141 4187]))
(([3844 4485 8515 1521 2133 3367]
[3844 4485 8515 1521 2133 3321]
[3844 4485 8515 1521 2133 3364])
([3844 4485 8515 1521 2145 4558]
[3844 4485 8515 1521 2145 4510]
[3844 4485 8515 1521 2145 4560])
([3844 4485 8515 1521 2147 4774]
[3844 4485 8515 1521 2147 4720]
[3844 4485 8515 1521 2147 4761]
[3844 4485 8515 1521 2147 4753])
([3844 4485 8515 1521 2116 1653]
[3844 4485 8515 1521 2116 1617]
[3844 4485 8515 1521 2116 1651]
[3844 4485 8515 1521 2116 1680]
[3844 4485 8515 1521 2116 1681]))
(([3844 4485 8515 1540 4096 9633])
([3844 4485 8515 1540 4030 3081]
[3844 4485 8515 1540 4030 3015]
[3844 4485 8515 1540 4030 3010]
[3844 4485 8515 1540 4030 3025])
([3844 4485 8515 1540 4033 3367]
[3844 4485 8515 1540 4033 3321]
[3844 4485 8515 1540 4033 3364])
([3844 4485 8515 1540 4095 9560]
[3844 4485 8515 1540 4095 9591]
[3844 4485 8515 1540 4095 9517]))
(([3844 4485 8515 1525 2556 5671]
[3844 4485 8515 1525 2556 5688]
[3844 4485 8515 1525 2556 5625])
([3844 4485 8515 1525 2512 1281]
[3844 4485 8515 1525 2512 1296]
[3844 4485 8515 1525 2512 1225]
[3844 4485 8515 1525 2512 1247]
[3844 4485 8515 1525 2512 1275]
[3844 4485 8515 1525 2512 1288]))))
(((([3844 4489 8910 1071 7140 4096]
[3844 4489 8910 1071 7140 4030]
[3844 4489 8910 1071 7140 4033]
[3844 4489 8910 1071 7140 4095]))
(([3844 4489 8910 1081 8177 7740]
[3844 4489 8910 1081 8177 7750]
[3844 4489 8910 1081 8177 7744]
[3844 4489 8910 1081 8177 7756])
([3844 4489 8910 1081 8128 2882]
[3844 4489 8910 1081 8128 2850]
[3844 4489 8910 1081 8128 2821]
[3844 4489 8910 1081 8128 2839]))
(([3844 4489 8910 1080 8037 3725]
[3844 4489 8910 1080 8037 3721]
[3844 4489 8910 1080 8037 3744]
[3844 4489 8910 1080 8037 3741]))
(([3844 4489 8910 1024 2485 8515])
([3844 4489 8910 1024 2465 6555]
[3844 4489 8910 1024 2465 6561]
[3844 4489 8910 1024 2465 6533])
([3844 4489 8910 1024 2415 1520]
[3844 4489 8910 1024 2415 1596]
[3844 4489 8910 1024 2415 1541]
[3844 4489 8910 1024 2415 1521]
[3844 4489 8910 1024 2415 1540]
[3844 4489 8910 1024 2415 1525]))
(([3844 4489 8910 1089 8911 1128]
[3844 4489 8910 1089 8911 1156]
[3844 4489 8910 1089 8911 1176]
[3844 4489 8910 1089 8911 1177]
[3844 4489 8910 1089 8911 1162]
[3844 4489 8910 1089 8911 1160])
([3844 4489 8910 1089 8965 6555]
[3844 4489 8910 1089 8965 6561]
[3844 4489 8910 1089 8965 6533]))
(([3844 4489 8910 1045 4558 5886])
([3844 4489 8910 1045 4510 1071]
[3844 4489 8910 1045 4510 1081]
[3844 4489 8910 1045 4510 1080]
[3844 4489 8910 1045 4510 1024]
[3844 4489 8910 1045 4510 1089]
[3844 4489 8910 1045 4510 1035])
([3844 4489 8910 1045 4560 6084]))
(([3844 4489 8910 1035 3553 5356]
[3844 4489 8910 1035 3553 5329]
[3844 4489 8910 1035 3553 5370])
([3844 4489 8910 1035 3570 7056] [3844 4489 8910 1035 3570 7021])
([3844 4489 8910 1035 3577 7740]
[3844 4489 8910 1035 3577 7750]
[3844 4489 8910 1035 3577 7744]
[3844 4489 8910 1035 3577 7756])))
((([3844 4489 8911 1128 2882 8281] [3844 4489 8911 1128 2882 8256])
([3844 4489 8911 1128 2850 5017]
[3844 4489 8911 1128 2850 5041]
[3844 4489 8911 1128 2850 5050])
([3844 4489 8911 1128 2821 2133]
[3844 4489 8911 1128 2821 2145]
[3844 4489 8911 1128 2821 2147]
[3844 4489 8911 1128 2821 2116])
([3844 4489 8911 1128 2839 3916]
[3844 4489 8911 1128 2839 3969]
[3844 4489 8911 1128 2839 3940]))
(([3844 4489 8911 1156 5671 7140])
([3844 4489 8911 1156 5688 8855] [3844 4489 8911 1156 5688 8836])
([3844 4489 8911 1156 5625 2556] [3844 4489 8911 1156 5625 2512]))
(([3844 4489 8911 1176 7626 2625]
[3844 4489 8911 1176 7626 2640]
[3844 4489 8911 1176 7626 2673]
[3844 4489 8911 1176 7626 2628]))
(([3844 4489 8911 1177 7740 4096]
[3844 4489 8911 1177 7740 4030]
[3844 4489 8911 1177 7740 4033]
[3844 4489 8911 1177 7740 4095])
([3844 4489 8911 1177 7750 5017]
[3844 4489 8911 1177 7750 5041]
[3844 4489 8911 1177 7750 5050])
([3844 4489 8911 1177 7744 4465] [3844 4489 8911 1177 7744 4485])
([3844 4489 8911 1177 7756 5671]
[3844 4489 8911 1177 7756 5688]
[3844 4489 8911 1177 7756 5625]))
(([3844 4489 8911 1162 6241 4186]
[3844 4489 8911 1162 6241 4187]
[3844 4489 8911 1162 6241 4141])
([3844 4489 8911 1162 6256 5671]
[3844 4489 8911 1162 6256 5688]
[3844 4489 8911 1162 6256 5625])
([3844 4489 8911 1162 6216 1653]
[3844 4489 8911 1162 6216 1617]
[3844 4489 8911 1162 6216 1651]
[3844 4489 8911 1162 6216 1680]
[3844 4489 8911 1162 6216 1681]))
(([3844 4489 8911 1160 6084 8464])))
((([3844 4489 8965 6555 5551 5192]
[3844 4489 8965 6555 5551 5151]
[3844 4489 8965 6555 5551 5184])
([3844 4489 8965 6555 5565 6561] [3844 4489 8965 6555 5565 6533]))
(([3844 4489 8965 6561 6112 1281]
[3844 4489 8965 6561 6112 1296]
[3844 4489 8965 6561 6112 1225]
[3844 4489 8965 6561 6112 1247]
[3844 4489 8965 6561 6112 1275]
[3844 4489 8965 6561 6112 1288])
([3844 4489 8965 6561 6175 7526] [3844 4489 8965 6561 6175 7569]))
(([3844 4489 8965 6533 3367 6786] [3844 4489 8965 6533 3367 6724])
([3844 4489 8965 6533 3321 2133]
[3844 4489 8965 6533 3321 2145]
[3844 4489 8965 6533 3321 2147]
[3844 4489 8965 6533 3321 2116])
([3844 4489 8965 6533 3364 6441]
[3844 4489 8965 6533 3364 6426]))))))
如您所见,向量嵌入在不同的级别。我想像这样获得向量的总集合(单层):
([3844 4465 6555 5551 5192 9211]
[3844 4465 6555 5551 5192 9296]
[3844 4465 6555 5551 5192 9216]
[3844 4465 6555 5551 5151 5192]
[3844 4465 6555 5551 5151 5184]
[3844 4465 6555 5551 5184 8464]
[3844 4465 6555 5565 6561 6112]
[3844 4465 6555 5565 6561 6175]
[3844 4465 6555 5565 6533 3367]
[3844 4465 6555 5565 6533 3321]
[3844 4465 6555 5565 6533 3364]
[3844 4465 6561 6112 1281 8177]
[3844 4465 6561 6112 1281 8128]
[3844 4465 6561 6112 1296 9633]
[3844 4465 6561 6112 1225 2556]
[3844 4465 6561 6112 1225 2512]
[3844 4465 6561 6112 1247 4774]
:...and-so-on...)
我不要嵌套的序列。
最简单的方法是什么?
答案 0 :(得分:4)
这是许多方法中的两种。如果您要在项目中做很多类似的事情(或想要使数据以更易于使用的形状输出),可能值得添加对specter的依赖:
user> (require '[com.rpl.specter :refer [select walker]])
nil
user> (select (walker vector?) data)
[[3844 4465 6555 5551 5192 9211]
[3844 4465 6555 5551 5192 9296]
[3844 4465 6555 5551 5192 9216]
[3844 4465 6555 5551 5151 5192]
[3844 4465 6555 5551 5151 5184]
[3844 4465 6555 5551 5184 8464]
[3844 4465 6555 5565 6561 6112]
[3844 4465 6555 5565 6561 6175]
[3844 4465 6555 5565 6533 3367]
[3844 4465 6555 5565 6533 3321]
[3844 4465 6555 5565 6533 3364]
[3844 4465 6561 6112 1281 8177] ...]
或者如果这是一次性的,那么只需用tree-seq击中它并按照leetwinski的建议过滤结果:
user> (filter vector?
(tree-seq (complement vector?) seq data))
([3844 4465 6555 5551 5192 9211]
[3844 4465 6555 5551 5192 9296]
[3844 4465 6555 5565 6561 6175] ...)