如何输入提示 [英] How to type hint

查看:126
本文介绍了如何输入提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何输入提示,以摆脱剩余的反映电话?

How would I type hint this to get rid of the remaining reflection calls?

(def B 
     (amap ^"[[D" A i ^"[[D" B 
          (amap ^doubles (aget A (int i)) j ^doubles row 
             (* 2 (aget row (int j))))))

有两个反射调用,但我不知道如何摆脱

There's two reflection calls left, but I don't know how to get rid of them.

推荐答案

您不会显示完整的代码或反射警告,但如果他们是我认为他们,您需要:

You don't show your complete code or the reflection warnings, but if they are what I think they are, you'll need to:


  1. 提示A:(def ^[[DA ... )无论你定义它

  2. 将最内层表达式的返回值转换为double:(double(* 2 ...)

  1. hint A: (def ^"[[D" A ...) wherever you define it
  2. cast the return value of the innermost expression to double: (double (* 2 ...))

解决这些问题的过程是对宏执行宏展开,运行该版本,看看什么表达式导致反射警告,修复它们,并希望您可以将提示改进到原始宏,在这种情况下是可能的。我仍然建议更直接的解决方案。

The process to come up with these fixes is to perform macroexpand on the macro, run that version, see what expressions are causing the reflection warnings, fix them, and hope that you can retrofit the hints into the original macro, which in this case is possible. I still recommend the more straightforward solution.

这篇关于如何输入提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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