2017-09-06 10:13 GMT+02:00 dennis zhuang <killme2...@gmail.com>:

> 1.Maybe you can use :pre metadata:
>
> (defn create-pin
>   ([] (create-pin 8))
>   ([n]
>    {:pre [(<= n 16)
>           (>= n 4)]}
>    (let [chars (map char (range (int \0) (inc (int \9))))]
>      (reduce str (repeatedly n #(rand-nth chars))))))
>
> (create-pin 3)
> AssertionError Assert failed: (>= n 4)  user/create-pin (NO_SOURCE_FILE:27)
>
>
> and clojure.spec is great too.
>

​For the moment I will go for :pre, but I will also look into clojure.spec.

​


> 2. you can use concat
>
> (concat seq1 seq2)
>

​I should have wait a little longer with asking. I already found it. But
thanks anyway.
​

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to