Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you construct a symbol in clojure?

I want to construct a macro that, given a symbol 'foo, creates a method called foo*. How can I concatenate 'foo and '*?

like image 927
Nick Orton Avatar asked Jun 03 '10 11:06

Nick Orton


People also ask

What is a symbol in Clojure?

There may be some confusion here from the different usages of the term "symbol" in Common Lisp and 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.

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 Clojure form?

Clojure (/ˈkloʊʒər/, like closure) is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system.

What is a keyword in Clojure?

[00:34] Keywords are a basic data type in Closure, just like strings, numbers, Booleans, or symbols. Symbols are what's often called identifiers in other languages. Keywords look like symbols except that they begin with a colon. [00:49] For example, greeting would be a symbol whereas :greeting would be a keyword.


2 Answers

(let [s (symbol 'test)] 
  (symbol (str s "*")))
like image 57
Hamza Yerlikaya Avatar answered Sep 26 '22 11:09

Hamza Yerlikaya


(symbol (str 'foo "*"))
like image 28
Alin Avatar answered Sep 23 '22 11:09

Alin