Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure #= reader macro

Tags:

macros

clojure

I just "discovered" the #= reader macro from a post on Stackoverflow and it solves a problem. How likely is this reader macro to become an official (documented) part of the language? How about deprecated or changed behavior?

The #= reader macro causes the following s-expression to be evaluated by the Lisp reader (before macro expansion).

like image 991
Ralph Avatar asked Jun 21 '11 15:06

Ralph


People also ask

What is Clojure used for?

Clojure is designed to be a hosted language, sharing the JVM type system, GC, threads etc. All functions are compiled to JVM bytecode. Clojure is a great Java library consumer, offering the dot-target-member notation for calls to Java. Clojure supports the dynamic implementation of Java interfaces and classes.

Is Clojure better than Java?

Clojure enables you to write programs that are better and more flexible, and above all makes you much more productive than using Java. By now the language has proven itself in the industry.

Why is Clojure not popular?

Clojure may not find much popularity since it lacks sufficient Clojure-based libraries and frameworks, compared to other applications worth consideration. The lisp syntax of Clojure is also more difficult to read, and therefore could stir being unfamiliar with the tool.

Is Clojure still used?

The Clojure community is growing stronger In fact, 25 percent of current developers have been using Clojure for a year or less, which is a great sign of the health of Clojure looking at 2022 and beyond.


2 Answers

It is used by the core language when something is printed with *print-dup* true, so I'd wager that it is going to stay. No idea why it is not documented.

user=> (binding [*print-dup* true] (prn {:foo 1 :bar 2}))
#=(clojure.lang.PersistentArrayMap/create {:foo 1, :bar 2})
nil
like image 96
Jouni K. Seppänen Avatar answered Sep 20 '22 00:09

Jouni K. Seppänen


It's not documented because it could go away / be replaced with something else. I wouldn't recommend using it in your programs.

like image 22
solussd Avatar answered Sep 21 '22 00:09

solussd