• Stars
    star
    57
  • Rank 492,841 (Top 10 %)
  • Language
    Clojure
  • License
    Eclipse Public Li...
  • Created almost 5 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Clojure library for debugging core functions

mate-clj

Mate-clj is a Clojure library that will help you to control the flow of core macros and functions and will help you debug your code out of the box.

  • The functionality of the macros and functions will remain the same.
  • Every step of the flow will be printed to the REPL.

Clojars Project

Getting Started:

Add the dependency to your project.clj:

[mate-clj "1.0.1"]

Usage Example:

user=> (require '[mate-clj.core :as mate])
user=> (def m {:body "flow test"})
user=> (mate/d-> m
                :body ;step #1
                (clojure.string/upper-case) ;step #2
                (clojure.string/reverse)) ;step #3
(:body m) => "flow test" ;step #1 result 
(clojure.string/upper-case (:body m)) => "FLOW TEST" ;step #2 result
(clojure.string/reverse (clojure.string/upper-case (:body m))) => "TSET WOLF" ;step #3 result
"TSET WOLF" ;the returned value

user=> (mate/dreduce + [1 3 5 7 9])
(#function[clojure.core/+] 1 3) => 4
(#function[clojure.core/+] 4 5) => 9
(#function[clojure.core/+] 9 7) => 16
(#function[clojure.core/+] 16 9) => 25
25 ;the returned value

user=> (mate/dcond->> 1
                      true inc
                      (= 3 2) (* 42)
                      true (+ 100)
                      (= 2 2) (* 9))
(inc 1) => 2
(+ 100 (inc 1)) => 102
(* 9 (+ 100 (inc 1))) => 918
918 ;the returned value

user=> (mate/das-> 1 n
                   (* 2 n)
                   (+ n n)
                   (+ n 2 3 4))
n => 1
(* 2 n) => 2
(+ n n) => 4
(+ n 2 3 4) => 13
13 ;the returned value

user=> (mate/dfilter even? [1  2  3  4  5  6])
#function[clojure.core/even?] 1 => false
#function[clojure.core/even?] 2 => true
#function[clojure.core/even?] 3 => false
#function[clojure.core/even?] 4 => true
#function[clojure.core/even?] 5 => false
#function[clojure.core/even?] 6 => true
(2 4 6) ;the returned value

(mate/dtake-while neg? [-2 -1 0 1 2 3])
#function[clojure.core/neg?] -2 => true
#function[clojure.core/neg?] -1 => true
#function[clojure.core/neg?] 0 => false
(-2 -1) ;the returned value

(mate/ddrop-while neg? [-1 -2 -6 -7 1 2 3 4 -5 -6 0 1])
#function[clojure.core/neg?] -1 => true
#function[clojure.core/neg?] -2 => true
#function[clojure.core/neg?] -6 => true
#function[clojure.core/neg?] -7 => true
#function[clojure.core/neg?] 1 => false
(1 2 3 4 -5 -6 0 1) ;the returned value

(mate/dsplit-with (partial > 3) [1 2 3 2 1])
#function[clojure.core/partial/fn--5824] 1 => true
#function[clojure.core/partial/fn--5824] 2 => true
#function[clojure.core/partial/fn--5824] 3 => false
#function[clojure.core/partial/fn--5824] 1 => true
#function[clojure.core/partial/fn--5824] 2 => true
#function[clojure.core/partial/fn--5824] 3 => false
[(1 2) (3 2 1)] ;the returned value

(mate/dkeep (fn [x] (if (< 0 x) x nil)) [1 2 3 4 5 -10])
#function[user/eval15658/fn--15659] 1 => 1
#function[user/eval15658/fn--15659] 2 => 2
#function[user/eval15658/fn--15659] 3 => 3
#function[user/eval15658/fn--15659] 4 => 4
#function[user/eval15658/fn--15659] 5 => 5
#function[user/eval15658/fn--15659] -10 => nil
(1 2 3 4 5)  ;the returned value

(mate/dkeep-indexed #(if (odd? %1) %2 nil) [1 2 3 4 5])
#function[user/eval15654/fn--15655] 0 1 => nil
#function[user/eval15654/fn--15655] 1 2 => 2
#function[user/eval15654/fn--15655] 2 3 => nil
#function[user/eval15654/fn--15655] 3 4 => 4
#function[user/eval15654/fn--15655] 4 5 => nil
(2 4) ;the returned value

(mate/devery? #{1 2} [1 2 3])
#{1 2} 1 => 1
#{1 2} 2 => 2
#{1 2} 3 => false
false ;the returned value

(mate/dnot-every? #{1 2} [1 2 3])
#{1 2} 1 => 1
#{1 2} 2 => 2
#{1 2} 3 => false
true ;the returned value

((mate/devery-pred number? even? pos?) 4 6 8 9)
#function[clojure.core/number?] 4 => true
#function[clojure.core/number?] 6 => true
#function[clojure.core/number?] 8 => true
#function[clojure.core/even?] 4 => true
#function[clojure.core/even?] 6 => true
#function[clojure.core/even?] 8 => true
#function[clojure.core/pos?] 4 => true
#function[clojure.core/pos?] 6 => true
#function[clojure.core/pos?] 8 => true
#function[mate-clj.core/devery-pred/ep3--9552/fn--9612] 9 => false
false ;the returned value

License

MIT

Contributing

PRs are always welcome!

More Repositories

1

go-sundheit

A library built to provide support for defining service health for golang services. It allows you to register async health checks for your dependencies and the service itself, provides a health endpoint that exposes their status, and health metrics.
Go
526
star
2

donkey

Modern Clojure HTTP server and client built for ease of use and performance
Java
288
star
3

ketu

A clojure kafka client with core.async integration.
Clojure
120
star
4

pronto

Clojure support for protocol buffers
Clojure
99
star
5

terra-crust

Terra Crust was created to allow Platform teams to expose Terraform as the main API to developers
Go
60
star
6

aerospike-clj

Clojure client for the Aerospike database.
Clojure
28
star
7

lein-protodeps

Leiningen plugin for consuming and compiling protobuf schemas
Clojure
25
star
8

kafka-mirror-tester

A tool to test the performance and correctness of kafka mirroring.
Go
23
star
9

wrk3

A golang generic benchmarking tool based mostly on Gil Tene's wrk2, only rewritten in go, and extended to allow running arbitrary protocols
Go
17
star
10

go-consul-resolver

A library of composable layers that is designed to provide client-side load balancing for (but not limited to) HTTP client-server communication, using Consul as the service discovery layer
Go
11
star
11

unleash-client-clojure

Unleash Client SDK for Clojure
Clojure
7
star
12

elb-log-replay

Replays an ELB log to a provided host
Go
6
star
13

srealip

Go package for securely extracting HTTP client's real public IP
Go
6
star
14

local-pvc-releaser

A Kubernetes controller designed to oversee Persistent Volume Claims (PVCs) associated with local storage on worker nodes. Its purpose is to enhance resilience and facilitate automatic recovery in the event of node termination.
Go
6
star
15

engineering-org-resources

List of talks, abstracts, speaker profiles, and resources from the AppsFlyer Engineering Bakery
5
star
16

go-sundheit-opentelemetry

Open telemetry metrics support for go-sundheit
3
star
17

AppsFlyerUnityPlugin

AppsFlyer Unity Plugin (iOS)
Perl
2
star
18

DevOpsDaysTLV2020Challenge

Programming challenge for DevOpsDays Tel Aviv 2020
2
star
19

appsflyer.github.io

Quick access to AppsFlyer's public & open source repos
JavaScript
1
star
20

af-sast-clojure

Clojure
1
star