Skip to content

Commit 7c708d0

Browse files
committed
re-namespace
1 parent 4fc74f6 commit 7c708d0

File tree

8 files changed

+92
-92
lines changed

8 files changed

+92
-92
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
spec-alpha2
1+
alpha.spec
22
========================================
33

44
spec is a Clojure library to describe the structure of data and functions. Specs can be used to validate data, conform (destructure) data, explain invalid data, generate examples that conform to the specs, and automatically use generative testing to test functions.
@@ -8,13 +8,13 @@ For more information:
88
* Rationale - https://clojure.org/about/spec
99
* Guide - https://clojure.org/guides/spec (for spec.alpha, note namespaces and other differences below)
1010

11-
spec.alpha was released with Clojure 1.9 and can be found at https://github.com/clojure/spec.alpha. spec-alpha2 incorporates feedback from spec.alpha as well as work towards several new features. Please note that spec-alpha2 is not 100% API-compatible with spec.alpha (although it is similar).
11+
spec.alpha was released with Clojure 1.9 and can be found at https://github.com/clojure/spec.alpha. This library is an evolution from spec.alpha as well as work towards several new features. Please note that alpha.spec is not 100% API-compatible with spec.alpha (although it is similar).
1212

1313
Namespaces to load:
1414

15-
(require '[clojure.spec-alpha2 :as s]
16-
'[clojure.spec-alpha2.gen :as gen]
17-
'[clojure.spec-alpha2.test :as test])
15+
(require '[clojure.alpha.spec :as s]
16+
'[clojure.alpha.spec :as gen]
17+
'iclojure.alpha.spec.test :as test])
1818

1919
Also see: [Differences from spec.alpha](https://github.com/clojure/spec-alpha2/wiki/Differences-from-spec.alpha)
2020

@@ -24,12 +24,12 @@ Releases and Dependency Information
2424

2525
Development release:
2626

27-
During development, you can use the git dep to try spec-alpha2:
27+
During development, you can use the git dep to try alpha.spec:
2828

29-
clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
29+
clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
3030
org.clojure/test.check {:mvn/version "0.9.0"}
31-
org.clojure/spec-alpha2 {:git/url "https://github.com/clojure/spec-alpha2.git"
32-
:sha "<SHA>"}}}'
31+
org.clojure/alpha.spec {:git/url "https://github.com/clojure/spec-alpha2.git"
32+
:sha "<SHA>"}}}'
3333

3434
Where the latest SHA can be found with:
3535

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
<artifactId>spec-alpha2</artifactId>
4+
<artifactId>alpha.spec</artifactId>
55
<version>0.2.177-SNAPSHOT</version>
6-
<name>spec-alpha2</name>
6+
<name>alpha.spec</name>
77
<description>Specification of data and functions</description>
88

99
<scm>
@@ -74,11 +74,11 @@
7474
<argument>-classpath</argument>
7575
<classpath />
7676
<argument>clojure.lang.Compile</argument>
77-
<argument>clojure.spec-alpha2.protocols</argument>
78-
<argument>clojure.spec-alpha2</argument>
79-
<argument>clojure.spec-alpha2.impl</argument>
80-
<argument>clojure.spec-alpha2.gen</argument>
81-
<argument>clojure.spec-alpha2.test</argument>
77+
<argument>clojure.alpha.spec.protocols</argument>
78+
<argument>clojure.alpha.spec</argument>
79+
<argument>clojure.alpha.spec.impl</argument>
80+
<argument>clojure.alpha.spec.gen</argument>
81+
<argument>clojure.alpha.spec.test</argument>
8282
</arguments>
8383
</configuration>
8484
</execution>

src/main/clojure/clojure/spec_alpha2.clj renamed to src/main/clojure/clojure/alpha/spec.clj

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
1414
Rationale: https://clojure.org/about/spec
1515
Guide: https://clojure.org/guides/spec"}
16-
clojure.spec-alpha2
16+
clojure.alpha.spec
1717
(:refer-clojure :exclude [+ * and assert or cat def keys merge comp])
18-
(:require [clojure.spec-alpha2.protocols :as protocols
18+
(:require [clojure.alpha.spec.protocols :as protocols
1919
:refer [conform* unform* explain* gen* with-gen* describe*]]
2020
[clojure.walk :as walk]
21-
[clojure.spec-alpha2.gen :as gen])
22-
(:import [clojure.spec_alpha2.protocols Spec Schema]))
21+
[clojure.alpha.spec.gen :as gen])
22+
(:import [clojure.alpha.spec.protocols Spec Schema]))
2323

2424
(alias 'c 'clojure.core)
2525
(alias 'sa 'clojure.spec.alpha)
@@ -235,7 +235,7 @@
235235
:else (throw (IllegalArgumentException. (str "Unknown schema op of type: " (class sform))))))
236236

237237
(defn conform
238-
"Given a spec and a value, returns :clojure.spec-alpha2/invalid
238+
"Given a spec and a value, returns :clojure.alpha.spec/invalid
239239
if value does not match spec, else the (possibly destructured) value."
240240
([spec x]
241241
(conform spec x nil))
@@ -587,7 +587,7 @@
587587
input as per re but subjects the resulting value to the
588588
conjunction of the predicates, and any conforming they might perform."
589589
[re & preds]
590-
`(resolve-spec '~(explicate (ns-name *ns*) `(clojure.spec-alpha2/& ~re ~@preds))))
590+
`(resolve-spec '~(explicate (ns-name *ns*) `(clojure.alpha.spec/& ~re ~@preds))))
591591

592592
(defmacro nest
593593
"takes a regex op and returns a non-regex op that describes a nested
@@ -597,7 +597,7 @@
597597

598598
(defmacro conformer
599599
"takes a predicate function with the semantics of conform i.e. it should return either a
600-
(possibly converted) value or :clojure.spec-alpha2/invalid, and returns a
600+
(possibly converted) value or :clojure.alpha.spec/invalid, and returns a
601601
spec that uses it as a predicate/conformer. Optionally takes a
602602
second fn that does unform of result of first"
603603
([f] `(resolve-spec '~(explicate (ns-name *ns*) `(conformer ~f))))
@@ -648,7 +648,7 @@
648648
by calling get-spec with the var or fully-qualified symbol.
649649
650650
Once registered, function specs are included in doc, checked by
651-
instrument, tested by the runner clojure.spec-alpha2.test/check, and (if
651+
instrument, tested by the runner clojure.alpha.spec.test/check, and (if
652652
a macro) used to explain errors during macroexpansion.
653653
654654
Note that :fn specs require the presence of :args and :ret specs to
@@ -665,7 +665,7 @@
665665
:sym symbol?)
666666
:ret symbol?)"
667667
[fn-sym & specs]
668-
`(clojure.spec-alpha2/def ~fn-sym (clojure.spec-alpha2/fspec ~@specs)))
668+
`(clojure.alpha.spec/def ~fn-sym (clojure.alpha.spec/fspec ~@specs)))
669669

670670
(defmacro keys
671671
"Creates and returns a map validating spec. :req and :opt are both
@@ -963,23 +963,23 @@ set. You can toggle check-asserts? with (check-asserts bool)."
963963
(list `resolve-spec (list `explicate (list `quote '~ns-name) (list `quote (cons '~op ~'sargs))))))))
964964

965965
;; Load the spec op implementations
966-
(load "/clojure/spec_alpha2/impl")
966+
(load "/clojure/alpha/spec/impl")
967967

968968
;; Derived ops
969969

970970
(defop inst-in
971971
"Returns a spec that validates insts in the range from start
972972
(inclusive) to end (exclusive)."
973973
[start end]
974-
:gen #(clojure.spec-alpha2.gen/fmap (fn [^long d] (java.util.Date. d))
975-
(clojure.spec-alpha2.gen/large-integer* {:min (inst-ms start) :max (inst-ms end)}))
974+
:gen #(clojure.alpha.spec.gen/fmap (fn [^long d] (java.util.Date. d))
975+
(clojure.alpha.spec.gen/large-integer* {:min (inst-ms start) :max (inst-ms end)}))
976976
(and inst? #(inst-in-range? start end %)))
977977

978978
(defop int-in
979979
"Returns a spec that validates fixed precision integers in the
980980
range from start (inclusive) to end (exclusive)."
981981
[start end]
982-
:gen #(clojure.spec-alpha2.gen/large-integer* {:min start :max (dec end)})
982+
:gen #(clojure.alpha.spec.gen/large-integer* {:min start :max (dec end)})
983983
(and int? #(int-in-range? start end %)))
984984

985985
(defop double-in
@@ -990,7 +990,7 @@ set. You can toggle check-asserts? with (check-asserts bool)."
990990
:min - minimum value (inclusive, default none)
991991
:max - maximum value (inclusive, default none)"
992992
[& {:keys [infinite? NaN? min max :as m]}]
993-
:gen #(clojure.spec-alpha2.gen/double* m)
993+
:gen #(clojure.alpha.spec.gen/double* m)
994994
(and double?
995995
#(if-not infinite? (not (Double/isInfinite %)))
996996
#(if-not NaN? (not (Double/isNaN %)))
@@ -1020,7 +1020,7 @@ set. You can toggle check-asserts? with (check-asserts bool)."
10201020
(let [primary# (:primary ~'mform)
10211021
preds# (:preds ~'mform)
10221022
a# (:args ~'mform)
1023-
comp-spec# (concat (list 'clojure.spec-alpha2/and- (cons '~(explicate ns-name spec-op) a#)) preds#)]
1023+
comp-spec# (concat (list 'clojure.alpha.spec/and- (cons '~(explicate ns-name spec-op) a#)) preds#)]
10241024
(resolve-spec comp-spec#)))
10251025
(defmacro ~op-name
10261026
~@(if doc [doc] [])

src/main/clojure/clojure/spec_alpha2/gen.clj renamed to src/main/clojure/clojure/alpha/spec/gen.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
; the terms of this license.
77
; You must not remove this notice, or any other, from this software.
88

9-
(ns clojure.spec-alpha2.gen
9+
(ns clojure.alpha.spec.gen
1010
(:refer-clojure :exclude [boolean bytes cat hash-map list map not-empty set vector
1111
char double int keyword symbol string uuid delay shuffle]))
1212

@@ -196,8 +196,8 @@ gens, each of which should generate something sequential."
196196
(get @gen-builtins pred)))
197197

198198
(comment
199-
(require :reload 'clojure.spec-alpha2.gen)
200-
(in-ns 'clojure.spec-alpha2.gen)
199+
(require :reload 'clojure.alpha.spec.gen)
200+
(in-ns 'clojure.alpha.spec.gen)
201201

202202
;; combinators, see call to lazy-combinators above for complete list
203203
(generate (one-of [(gen-for-pred integer?) (gen-for-pred string?)]))

src/main/clojure/clojure/spec_alpha2/impl.clj renamed to src/main/clojure/clojure/alpha/spec/impl.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
; You must not remove this notice, or any other, from this software.
88

99
(ns ^{:skip-wiki true}
10-
clojure.spec-alpha2.impl
10+
clojure.alpha.spec.impl
1111
(:require
12-
[clojure.spec-alpha2 :as s]
13-
[clojure.spec-alpha2.protocols :as protocols
12+
[clojure.alpha.spec :as s]
13+
[clojure.alpha.spec.protocols :as protocols
1414
:refer [Spec conform* unform* explain* gen* with-gen* describe*
1515
Schema keyspecs*
1616
Select]]
17-
[clojure.spec-alpha2.gen :as gen]
17+
[clojure.alpha.spec.gen :as gen]
1818
[clojure.set :as set]
1919
[clojure.walk :as walk]))
2020

@@ -193,13 +193,13 @@
193193
(assert (and (= (count keys) (count specs)) (every? keyword? keys)) "cat expects k1 p1 k2 p2..., where ks are keywords")
194194
(cat-impl keys (mapv s/resolve-spec specs) specs))
195195

196-
(defmethod s/expand-spec 'clojure.spec-alpha2/&
196+
(defmethod s/expand-spec 'clojure.alpha.spec/&
197197
[[_ re & preds]]
198-
{:clojure.spec/op 'clojure.spec-alpha2/&
198+
{:clojure.spec/op 'clojure.alpha.spec/&
199199
:spec re
200200
:preds (vec preds)})
201201

202-
(defmethod s/create-spec 'clojure.spec-alpha2/&
202+
(defmethod s/create-spec 'clojure.alpha.spec/&
203203
[{:keys [spec preds]}]
204204
(amp-impl (s/resolve-spec spec) spec (mapv s/resolve-spec preds) (mapv #'s/unfn preds)))
205205

@@ -1441,7 +1441,7 @@
14411441
(case op
14421442
::s/accept nil
14431443
nil p
1444-
::s/amp (list* 'clojure.spec-alpha2/& (resolve-form amp) (resolve-forms forms))
1444+
::s/amp (list* 'clojure.alpha.spec/& (resolve-form amp) (resolve-forms forms))
14451445
::s/pcat (if rep+
14461446
(list `s/+ rep+)
14471447
(cons `s/cat (mapcat vector (or (seq ks) (repeat :_)) (resolve-forms forms))))

src/main/clojure/clojure/spec_alpha2/protocols.clj renamed to src/main/clojure/clojure/alpha/spec/protocols.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
; the terms of this license.
77
; You must not remove this notice, or any other, from this software.
88

9-
(ns clojure.spec-alpha2.protocols)
9+
(ns clojure.alpha.spec.protocols)
1010

1111
(defprotocol Spec
1212
:extend-via-metadata true

src/main/clojure/clojure/spec_alpha2/test.clj renamed to src/main/clojure/clojure/alpha/spec/test.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
; the terms of this license.
77
; You must not remove this notice, or any other, from this software.
88

9-
(ns clojure.spec-alpha2.test
9+
(ns clojure.alpha.spec.test
1010
(:refer-clojure :exclude [test])
1111
(:require
1212
[clojure.pprint :as pp]
13-
[clojure.spec-alpha2 :as s]
14-
[clojure.spec-alpha2.gen :as gen]
13+
[clojure.alpha.spec :as s]
14+
[clojure.alpha.spec.gen :as gen]
1515
[clojure.string :as str]))
1616

1717
(in-ns 'clojure.spec.test.check)
18-
(in-ns 'clojure.spec-alpha2.test)
18+
(in-ns 'clojure.alpha.spec.test)
1919
(alias 'stc 'clojure.spec.test.check)
2020
(alias 'sa 'clojure.spec.alpha)
2121

@@ -104,7 +104,7 @@ interpret-stack-trace-element that are relevant to a
104104
failure in instrument."
105105
[elems]
106106
(let [plumbing? (fn [{:keys [var-scope]}]
107-
(contains? '#{clojure.spec-alpha2.test/spec-checking-fn} var-scope))]
107+
(contains? '#{clojure.alpha.spec.test/spec-checking-fn} var-scope))]
108108
(sequence (comp (map StackTraceElement->vec)
109109
(map interpret-stack-trace-element)
110110
(filter :var-scope)
@@ -113,7 +113,7 @@ failure in instrument."
113113

114114
(defn- spec-checking-fn
115115
[v f fn-spec]
116-
(let [fn-spec (@#'clojure.spec-alpha2.impl/maybe-spec fn-spec)
116+
(let [fn-spec (@#'clojure.alpha.spec.impl/maybe-spec fn-spec)
117117
conform! (fn [v role spec data args]
118118
(let [conformed (s/conform spec data)]
119119
(if (= ::s/invalid conformed)

0 commit comments

Comments
 (0)