How do I search for special characters in Clojure?

怎甘沉沦 提交于 2019-12-10 17:37:24

问题


Clojure uses a number of special characters such as

  • ^String
  • #(xyz ...)
  • %&
  • #_(some form here)
  • >!

and many more. How can I search for documentation for these special characters, given that Google et al mostly ignore special characters in web pages and search strings?


回答1:


This question and others have raised an important topic: it can often be difficult and frustrating to find documentation on special characters used in Clojure source code.

The first place to look is the Clojure docs themselves. There is even a special page devoted to this topic:

  • https://clojure.org/guides/weird_characters

Many of the special characters are known as Reader Literals, which also have a documentation page:

  • https://clojure.org/reference/reader

You can also find hints regarding special chars & their usage on:

  • The Clojure CheatSheet
  • ClojureDocs.org
  • Clojure-Doc.org

Finally, the search engine SymbolHound.com can search for special symbols that Google & others ignore. For example, consider this Clojure code:

(defn lines
  "Given an open reader, return a lazy sequence of lines"
  [^java.io.BufferedReader reader]
  (take-while identity (repeatedly #(.readLine reader))))

How could we search for the meaning of ^java.io.BufferedReader on the 3rd line? If we go to SymbolHound and use the search string clojure ^ we get back:


270 results found for clojure ^

  • What are the usages for ^ and how can I get more information on it?
  • Clojure syntax question re: #^
  • How do I dynamically find metadata for a Clojure function?

and many more answers.




回答2:


They're all described here:

https://clojure.org/guides/weird_characters

You can also add more by contributing:

https://clojure.org/community/contributing_site



来源:https://stackoverflow.com/questions/50460044/how-do-i-search-for-special-characters-in-clojure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!