在Clojure中的mapcat和Scala中的flatMap之间有什么区别?

编程入门 行业动态 更新时间:2024-10-28 11:28:23
本文介绍了在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 flatMaps 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.

更多推荐

在Clojure中的mapcat和Scala中的flatMap之间有什么区别?

本文发布于:2023-11-25 07:42:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628904.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   mapcat   Clojure   flatMap   Scala

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!