   `(let [{~@(interleave bindings [:val :next-state]) ~@[]} ~state]
      ~@body))
 
-(defn- make-result-state
+(defn- make-state
   "Auxiliary function to avoid same map creation all over the place"
   [val next-state]
   {:val val :next-state next-state})

        ;to make this working same way as in Scala/FPINS option
        nxt-rng (make-simple-rng-s nseed)
        n (.intValue (unsigned-bit-shift-right nseed 16))]
    (make-result-state n nxt-rng)))

(defn non-negative-int-fpins-s
  "FPINS variant of above function - haha - and I was thinking: Adding one is way too simple :)"
  [rng]
  (from-state (rng) :let [n nxt-rng]
            (if (< n 0)
              (make-result-state (- (inc n)) nxt-rng)
              (make-result-state n nxt-rng))))

;usage example
((state-sequence-fpins (repeat 5 non-negative-int-fpins-s)) (make-simple-rng-s 42))

  (fpinscala.strictness-and-laziness/fold-right             ;Notice that this variant is using fold-right
    (unit-state '())                                              ;Check out that "unit-produced" function is used as z value (now - it wouldn't be really
    #(map2-via-flat-map-s % %2 (fn [a b] (cons a b)))                 ;correct to say it is "initial" but rather neutral (or terminating?) element
    fs))                                                    ;UPDATE (25.11.2015) Check out wikipedia about monad, it is actually "return" also
                                                            ;called "unit" operation of a monad

(declare simple-rng-s)

