Clojure Programming by Chas Emerick & Brian Carper & Christophe Grand
Author:Chas Emerick & Brian Carper & Christophe Grand [Chas Emerick]
Language: eng
Format: epub
Tags: COMPUTERS / Programming Languages / LISP
ISBN: 9781449394745
Publisher: O'Reilly Media
Published: 2012-03-29T16:00:00+00:00
Note
refer is rarely used directly, but its effects and options are available through use, which is widely used.
require and use. When some code needs to make use of functions or data defined in public vars in another namespace, require and use are used to:
Ensure that the namespaces in question are loaded.
Optionally establish aliases for those namespaces’ names.
Trigger the implicit use of refer to allow code to refer to other namespaces’ vars without qualification.
require provides (1) and (2); use is built on top of it and refer to provide (3) in a succinct way.
Let’s start with a new REPL, where we’d like to use the union function in the clojure.set namespace:
(clojure.set/union #{1 2 3} #{4 5 6}) ;= #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>
Wait, that namespace isn’t loaded yet—only clojure.core is preloaded. We can use require to load the clojure.set namespace from the classpath;[232] afterward, we can use any function within that namespace:
(require 'clojure.set) ;= nil (clojure.set/union #{1 2 3} #{4 5 6}) ;= #{1 2 3 4 5 6}
Having to use fully qualified symbols to name vars can be a pain though, especially if the libraries you are using provide namespaces that are long or have a number of segments. Thankfully, require provides a way to specify an alias for a namespace:
(require '[clojure.set :as set]) ;= nil (set/union #{1 2 3} #{4 5 6}) ;= #{1 2 3 4 5 6}
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12571)
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8298)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7079)
Microservices with Go by Alexander Shuiskov(6846)
Practical Design Patterns for Java Developers by Miroslav Wengner(6767)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6705)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6414)
Angular Projects - Third Edition by Aristeidis Bampakos(6111)
The Art of Crafting User Stories by The Art of Crafting User Stories(5641)
NetSuite for Consultants - Second Edition by Peter Ries(5575)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5379)
Kotlin in Action by Dmitry Jemerov(5064)
