Public Vars

Back

not= (clj)

(source)

function

(not= x) (not= x y) (not= x y & more)
Same as (not (= obj1 obj2))

Examples

clojure
(deftest division
  (is (= clojure.core// /))
  (binding [*ns* *ns*]
    (eval '(do (ns foo
                 (:require [clojure.core :as bar])
                 (:use [clojure.test]))
               (is (= clojure.core// bar//))))))

(deftest Instants
  (testing "Instants are read as java.util.Date by default"
    (is (= java.util.Date (class #inst "2010-11-12T13:14:15.666"))))
  (let [s "#inst \"2010-11-12T13:14:15.666-06:00\""]
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date produces java.util.Date"
        (is (= java.util.Date (class (read-string s)))))
      (testing "java.util.Date instants round-trips"
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Date instants round-trip throughout the year"
        (doseq [month (range 1 13) day (range 1 29) hour (range 1 23)]
          (let [s (format "#inst \"2010-%02d-%02dT%02d:14:15.666-06:00\"" month day hour)]
            (is (= (-> s read-string)
                   (-> s read-string pr-str read-string))))))
      (testing "java.util.Date handling DST in time zones"
        (let [dtz (TimeZone/getDefault)]
          (try
            ;; A timezone with DST in effect during 2010-11-12
            (TimeZone/setDefault (TimeZone/getTimeZone "Australia/Sydney"))
            (is (= (-> s read-string)
                   (-> s read-string pr-str read-string)))
            (finally (TimeZone/setDefault dtz)))))
      (testing "java.util.Date should always print in UTC"
        (let [d (read-string s)
              pstr (print-str d)
              len (.length pstr)]
          (is (= (subs pstr (- len 7)) "-00:00\"")))))
    (binding [*data-readers* {'inst read-instant-calendar}]
      (testing "read-instant-calendar produces java.util.Calendar"
        (is (instance? java.util.Calendar (read-string s))))
      (testing "java.util.Calendar round-trips"
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Calendar remembers timezone in literal"
        (is (= "#inst \"2010-11-12T13:14:15.666-06:00\""
               (-> s read-string pr-str)))
        (is (= (-> s read-string)
               (-> s read-string pr-str read-string))))
      (testing "java.util.Calendar preserves milliseconds"
        (is (= 666 (-> s read-string
                       (.get java.util.Calendar/MILLISECOND)))))))
  (let [s "#inst \"2010-11-12T13:14:15.123456789\""
        s2 "#inst \"2010-11-12T13:14:15.123\""
        s3 "#inst \"2010-11-12T13:14:15.123456789123\""]
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (testing "read-instant-timestamp produces java.sql.Timestamp"
        (is (= java.sql.Timestamp (class (read-string s)))))
      (testing "java.sql.Timestamp preserves nanoseconds"
        (is (= 123456789 (-> s read-string .getNanos)))
        (is (= 123456789 (-> s read-string pr-str read-string .getNanos)))
        ;; truncate at nanos for s3
        (is (= 123456789 (-> s3 read-string pr-str read-string .getNanos))))
      (testing "java.sql.Timestamp should compare nanos"
        (is (= (read-string s) (read-string s3)))
        (is (not= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date should truncate at milliseconds"
        (is (= (read-string s) (read-string s2) (read-string s3))))))
  (let [s "#inst \"2010-11-12T03:14:15.123+05:00\""
        s2 "#inst \"2010-11-11T22:14:15.123Z\""]
    (binding [*data-readers* {'inst read-instant-date}]
      (testing "read-instant-date should convert to UTC"
        (is (= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (testing "read-instant-timestamp should convert to UTC"
        (is (= (read-string s) (read-string s2)))))
    (binding [*data-readers* {'inst read-instant-calendar}]
      (testing "read-instant-calendar should preserve timezone"
        (is (not= (read-string s) (read-string s2)))))))
clojure/core.typed
(ns clojure.core.typed.analyzer.jvm-test
  (:require [clojure.test :refer :all]
            [clojure.core.typed.analyzer.jvm.passes.emit-form :refer [emit-form]]
            [clojure.core.typed.analyzer.jvm :as ana]))

(deftest uniquify-test
  (let [ret (ast' (let [a 1]
                    (let [a 2]
                      a)))]
    (is (= (let [sym (-> ret :body :ret :bindings first :name)]
             (is (symbol? sym))
             sym)
           (-> ret :body :ret :body :ret :name)))
    (is (not= 'a (-> ret :body :ret :body :ret :name)))))
mikera/core.matrix
(ns clojure.core.matrix.test-double-array
  (:refer-clojure :exclude [==])
  (:require [clojure.core.matrix.protocols :as mp]
            [clojure.core.matrix.impl.pprint :as pprint]
            [clojure.core.matrix.dataset :as ds]
            [clojure.core.matrix.compliance-tester]
            [clojure.core.matrix :refer :all]
            [clojure.core.matrix.operators :refer [==]]
            [clojure.core.matrix.macros :refer [error]]
            [clojure.core.matrix.macros-clj :refer [error?]]
            [clojure.test :refer :all]))

(deftest test-select
  (testing "select ops"
    (let [da (double-array [1.2 3.4 5.6 7.8 9.1])]
      (let [selected (select da :all)]
        (is (= (class selected) (Class/forName "[D")))
        (is (== selected da))
        (is (not= selected da)))
      (let [selected (select da 0)]
        (is (scalar? selected))
        (is (= 1.2 selected)))
      (let [selected (select da [1 2])]
        (is (= (class selected) (Class/forName "[D")))
        (is (== selected [3.4 5.6]))))))
hraberg/deuce
(ns deuce.emacs.eval
  (:use [deuce.emacs-lisp :only (defun defvar)])
  (:require [clojure.core :as c]
            [deuce.emacs.alloc :as alloc]
            [deuce.emacs.data :as data]
            [deuce.emacs-lisp.cons :as cons]
            [deuce.emacs-lisp :as el])
  (:import [clojure.lang Var])
  (:refer-clojure :exclude [apply eval macroexpand]))

  The second optional arg ENVIRONMENT specifies an environment of macro
  definitions to shadow the loaded ones for use in file byte-compilation."
  ;; Not sure how this is supposed to work even after reading eval.c, attempts to mimic observed behavior.
  ;; It is used in conjunction with cl-macroexpand-all, and should not expand into "raw" Clojure.
  (let [shadow (into {} (map #(vector (data/car %) (data/cdr %)) environment))
        shadow #(shadow % (shadow (str %)))
        unshadowed-form ((fn shadow-walker [form]
                           (if-let [expander (shadow form)]
                             (if (= '(true) (data/cdr-safe expander))
                               (cons (first (data/car expander))
                                     (map #(list 'quote %) (rest (data/car expander))))
                               (expander form))
                             (if (and (seq? form)
                                      (not= 'quote (first form)))
                               (cons/maybe-seq (map shadow-walker form))
                               form))) form)
        expansion (if-let [m  (and (seq? form) (-> (el/fun (first form)) meta))]
                    (if (and (:macro m) (= (the-ns 'deuce.emacs-lisp) (:ns m)))
                      unshadowed-form
                      (macroexpand-1 unshadowed-form))
                    unshadowed-form)]
    ;; Protect against eq check in cl-macroexpand-all
    (if (= form expansion)
      form
      expansion)))
typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

;should be special cased
cc/not= [(t/+ t/Any) :-> t/Bool]
typedclojure/typedclojure
(ns clojure.core.typed.test.difference
  (:require [clojure.core.typed :as tc :refer []]
            [typed.clj.checker.test-utils :refer :all]
            [typed.cljc.checker.type-rep :refer :all]
            [typed.cljc.checker.type-ctors :refer :all]
            [typed.cljc.checker.cs-gen :refer :all]
            [typed.cljc.checker.cs-rep :refer :all]
            [typed.cljc.checker.subst :refer [subst-all]]
            [clojure.test :refer :all]))

  (is-clj (overlap (make-F 'x)
                   (NotType-maker (make-F 'y))))
  (is-clj (overlap (B-maker 0)
                   (NotType-maker (B-maker 1))))
  (is-clj (not (subtype? (B-maker 0)
                         (NotType-maker (B-maker 1)))))
  (is-clj (not= (In (make-F 'x)
                    (NotType-maker (make-F 'y)))
                (Un))))

;(deftest difference-type-subtype
;  (is-clj (not (sub? (Difference Any nil) nil)))
;  (is-clj (sub? (Difference Any nil) (Difference Any nil)))
;  (is-clj (overlap -any (NotType-maker -nil)))
;  (is-clj (not (sub? (Difference Any nil) (Difference Any false))))
;  (is-clj (sub? (Difference Any (U false nil)) (Difference Any false)))
;  (is-clj (sub? (Difference Any false nil) (Difference Any false)))
;  (is-clj (sub? (Difference (U Long Float) Float) Long)))
;
;(deftest Difference-combine-test
;  (is-clj (= (-difference -nil (NotType-maker -nil))
;             (Un)))
;  (is-clj (clj
;            (= (-difference (RClass-of Integer) (RClass-of Number))
;               (Un))))
;
;  (is-clj (not (overlap (RClass-of Integer) (-difference -any (RClass-of Number)))))
;  (is-clj (clj (overlap (RClass-of Number) (-difference -any -nil))))
;
;  (is-clj (overlap (-difference -any (RClass-of Number))
;                   (-difference -any (RClass-of Integer))))
;
;  (is-clj (not (overlap (-difference -any (RClass-of Number))
;                        (RClass-of Integer))))
;
;  (is-clj (= (-difference (RClass-of Number) -nil)
;             (RClass-of Number)))
;
;  (is-clj (= (-difference (Un (RClass-of Number) -nil) -nil)
;             (RClass-of Number)))
;  (is-clj (= (-difference (RClass-of Number) -nil)
;             (RClass-of Number)))
;
;  (is-clj (clj (= (-difference (Un -nil (RClass-of Number)) (Un -false -nil))
;                  (RClass-of Number))))
;
;  (is-clj (overlap (Un -nil (RClass-of Number)) 
;                   (-difference -any (Un -false -nil))))
;
;  (is-clj (= (-difference (Un -nil (RClass-of Number)) -nil)
;             (RClass-of Number)))
;  (is-clj (= (Un (-difference -nil -nil)
;                 (-difference (RClass-of Number) -nil))
;             (RClass-of Number)))
;
;  (is-clj (= (In (-difference -any (RClass-of Number))
;                 (-difference -any (RClass-of Integer)))
;             (-difference -any (RClass-of Number))))
;
;  (is-clj (subtype? (RClass-of Number) (-difference -any -nil)))
;  (is-clj (subtype? (RClass-of Number) (-difference -any (RClass-of Integer))))
;  (is-clj (not (subtype? (RClass-of Integer) (-difference -any (RClass-of Number)))))
;  (is-clj (not (subtype? (-difference -any -nil) (RClass-of Number))))
;
;  (is-clj (= (let [i (subst-all {'x (->t-subst (Un (RClass-of Number) -nil) no-bounds) 
;                                 'y (->t-subst -nil no-bounds)} 
;                                (-difference (make-F 'x) (make-F 'y)))
;                   _ (assert (Intersection? i))]
;               (apply In (:types i)))
;             (RClass-of Number)))
;
;  (is-clj (overlap (make-F 'x)
;                   (-difference -any (make-F 'y))))
;  (is-clj (overlap (B-maker 0)
;                   (-difference -any (B-maker 1))))
;  (is-clj (not (subtype? (B-maker 0)
;                         (-difference -any (B-maker 1)))))
;  (is-clj (not= (-difference (make-F 'x)
;                             (make-F 'y))
;                (Un))))
;
;(deftest negative-filter-test
;  (is-tc-e ;need to instantiate negative types for now
;         (fn [a] 
;           ((inst a (U nil Number) nil)
;            (inst identity (U nil Number)) 
;            [1 nil]))
;         :expected
;         [(All [x y]
;               [[x -> Any :filters {:then (! y 0)}]
;                (Seqable x) -> (Seq (Difference x y))])
;          -> (Seqable Number)]))
  #_(is-tc-e (let [filter (ann-form filter
                                  (All [x y]
                                       [[x -> Any :filters {:then (! y 0)}] 
                                        (U nil (Seqable x)) -> (Seq (Difference x y))]))]
             (filter (inst identity (U nil Number)) [1 nil]))
           :expected (Seqable Number))