简体   繁体   English

如何在REPL中找到函数定义?

[英]How could I found the function definition in REPL?

After experiencing several times, finally, I got a function works. 经过几次尝试,终于,我得到了一个功能正常的作品。 After a few tests, I believe I could put this function to the source code file. 经过几次测试,我相信我可以将此功能放到源代码文件中。 But now the function definition is a long way burred in the REPL. 但是现在,函数定义在REPL中是很长的路要走。 I tryed 我试过了

(source my-function)

Unfortunately, it doesn't work. 不幸的是,它不起作用。 It only work on the functions in the lib. 它仅适用于lib中的功能。

So I have to scroll back, and search (within Cider-nrepl,Emacs). 因此,我必须向后滚动并搜索(在Cider-nrepl,Emacs中)。

Is there a better way? 有没有更好的办法?

Assuming you're function definition starts with defn , within Cider/Emacs, you can type (defn at the REPL and hit Mp (Meta-p or Esc-p). This will find any previous input to the REPL that started with (defn . Hitting Mp multiple times will allow you to go backwards through history, ie it will find all input starting with (defn . 假设您的函数定义以defn ,在Cider / Emacs中,您可以键入(defn在REPL处定义defn Mp (Meta-p或Esc-p)。这将找到以(defn 。多次击中Mp可以让您(defn历史,即它将找到以(defn

This of course works also for all other input to the REPL. 当然,这也适用于REPL的所有其他输入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM