在Clojure中的mapcat和Scala中的flatMap之间有什么区别? [英] What are the differences between mapcat in Clojure and flatMap in Scala in terms of what they operate on?

查看:181
本文介绍了在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库中: 响应者 未来 ,< a href =http://www.scala-lang.org/api/current/index.html#scala.util.parsing.combinator.Parsers%24Parser =nofollow> 解析器 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之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆