fn和fn *之间有什么区别? [英] What is the difference between fn and fn*?

查看:268
本文介绍了fn和fn *之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Clojure中,fn和fn *之间的区别是什么?我看到fn *当我的语法引用使用#宏创建的函数。例如,在REPL中:

  user => `#(inc%)
(fn * [p1__342__343__auto__](clojure.core / inc p1__342__343__auto__))


$ b

解决方案

这是否仅用于调试目的,以识别函数是由#而不是由fn直接创建的?根据 Google群组上的此信息 fn * 是创建函数的原始表单, fn 是一个构建在它顶部的宏,用于实现更高级的功能,如解构。

In Clojure, what is the difference between fn and fn*? I see fn* when I syntax quote a function created with the # macro. For example, in the REPL:

user=> `#(inc %)   
(fn* [p1__342__343__auto__] (clojure.core/inc p1__342__343__auto__))

Is this simply used for debugging purposes to identify that the function was created by # rather than fn directly?

解决方案

According to this post on google groups fn* is a primitive form to create functions and fn is a macro built on top of it to implement higher-level features like destructuring.

这篇关于fn和fn *之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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