In clojure, how can I undef a var from a namespace?

If I understand you correctly, ns-unmap should do what you want: user=> foo java.lang.Exception: Unable to resolve symbol: foo in this context (NO_SOURCE_FILE:1) user=> (def foo 1) #’user/foo user=> foo 1 user=> (ns-unmap (find-ns ‘user) ‘foo) nil user=> foo java.lang.Exception: Unable to resolve symbol: foo in this context (NO_SOURCE_FILE:1)

Is Clojure object-oriented at its heart? (Polymorphism in seqs)

Idiomatic Clojure favors defining independent functions that operate on a very small set of core data structures; this unbundling of methods and data is a strong statement against object orientation and in favour of a functional style. Rich Hickey (creator of Clojure) has repeatedly stated the importance of this; for example here: “Clojure eschews the … Read more

= and == in Clojure

== is for comparing numbers. If either of its arguments is not a number, it will always return false: (== :a :a) ; => false As you can see by saying (clojure.contrib.repl-utils/source ==) at the REPL (with repl-utils require‘d, of course), == calls the equiv method of clojure.lang.Numbers. The relevant bit of clojure/lang/Numbers.java (from the … Read more

clojure when macro

core.clj is built from top to bottom, starting with just what Java provides and building up all the requirements for Clojure as it goes. When when is defined the syntax quote does not yet exist. The when macro is defined on line 456 of core.clj and the requirements for syntax-quote are not available until line … Read more

Generalized Threading Macro in Clojure

There is now a generalized threading macro in Clojure since 1.5 called as->. This tweet gives an example of how it works: https://twitter.com/borkdude/status/302881431649128448 (as-> “/tmp” x (java.io.File. x) (file-seq x) (filter (memfn isDirectory) x) (count x)) First ‘x’ is bound to “/tmp” and a file is made out of it. ‘x’ is rebound again to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)