Thursday, April 28, 2016

Cartesian pairs multiplication in Clojure.

Cartesian pairs multiplication in Clojure. It's working !!! Very useful function.
(all code here  on GitHub: csv-statistic)


(ns clojure.examples.cartesian_pair
 (:gen-class))
(println (class 1) )
(println (class "S") )
(defn test [arg1 arg2]
  {:pre [(number? arg1) (number? arg2)]}
  (+ arg1 arg2))
( println (number? 2))
(defn bias-colls
"Function read col and return list of all possible pairs [ [x1 x2] .. [xi xj] ] where xi not = xj and xi not number   "
[ coll ]
(for [x coll  y coll  :when (not= x y) :when (not (number? x)) ]
 [x y])
)
(def my-coll ['a 'b  'c 'd  'd "Bank Of America" "HSBC Bank" 123 1234 4534] )
(->>
my-coll
bias-colls
println
)

No comments: