Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I search for special characters in Clojure?

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?

like image 744
Alan Thompson Avatar asked May 22 '18 04:05

Alan Thompson


People also ask

What does ->> mean in Clojure?

->> is the "thread-last" macro. It evaluates one form and passes it as the last argument into the next form. Your code is the equivalent of: (reduce str (interpose ", " (map :subject scenes)))

What are symbols in Clojure?

In Common Lisp, a "symbol" is a location in memory, a place where data can be stored. The "value" of a symbol is the data stored at that location in memory. In Clojure, a "symbol" is just a name. It has no value.

How do you define a list in Clojure?

List is a structure used to store a collection of data items. In Clojure, the List implements the ISeq interface. Lists are created in Clojure by using the list function.

What is def Clojure?

def is a special form that associates a symbol (x) in the current namespace with a value (7). This linkage is called a var . In most actual Clojure code, vars should refer to either a constant value or a function, but it's common to define and re-define them for convenience when working at the REPL.


2 Answers

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.

like image 110
Alan Thompson Avatar answered Oct 18 '22 19:10

Alan Thompson


They're all described here:

https://clojure.org/guides/weird_characters

You can also add more by contributing:

https://clojure.org/community/contributing_site

like image 1
ClojureMostly Avatar answered Oct 18 '22 20:10

ClojureMostly