在Clojure中的mapcat和Scala中的flatMap之间有什么区别?
我明白等同于Scala中的 flatMap
是 mapcat
。
I understand the equivalent to flatMap
in Scala is mapcat
in Clojure.
在clojure中, mapcat
只适用于序列,不像 flatMap
在Scala中更灵活。
I have an inkling that mapcat
in clojure only works with sequences, unlike flatMap
in Scala which is more flexible.
我的问题是 - 在Clojure中的 mapcat
和 flatMap 在Scala中他们的操作方面?
My question is - what are the differences between mapcat
in Clojure and flatMap
in Scala in terms of what they operate on?
假设:
- 我理解Scala有一个丰富的类型系统和Clojure有可选的打字 - 我有兴趣知道是否是mapcat接受的参数的限制,使它只有
flatMap
的功能的一个子集。
- I understand that Scala has a rich type system and Clojure has optional typing - I'm interested to know if the is a limitation in the parameters that mapcat accepts that make it only have a subset of
flatMap
s functionality.
在标准Scala库中: 响应者
, 未来
, 解析器
, ControlContext
。它们都不是序列或特别是序列样。 中还有一些细微变化 ParseResult
。
In the standard Scala library: Responder
, Future
, Parser
, ControlContext
. None of them are sequences or particularly sequence-like. There is also a slight variation in ParseResult
.