[ANN] duct-lacinia 0.1.0 (a duct moudle for lacinia)

2019-04-16 Thread Eunmin Kim
Hi~!

I'm happy to announce duct-lacinia(https://github.com/kakao/duct-lacinia).

duct-lacinia is a duct(https://github.com/duct-framework/duct) module for 
lacinia(https://github.com/walmartlabs/lacinia) graphQL library. It 
provides schema and resolver key for lacinia in duct configuration.

I look forward to being able to make it better together. Feedback welcome!

Cheers!

-- 
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.


ANN: Parallel let macro!

2017-11-28 Thread Eunmin Kim
Hi, folks

This is small piece of code that is inspired by haxl, 
muse(https://github.com/kachayev/muse), 
urania(https://github.com/funcool/urania). Not a library.

(defn remote-req [result]
  (Thread/sleep 1000)
  result)

(defmacro plet [bindings & body]
  (let [bents (partition 2 (destructure bindings))
smap (into {} (map (fn [[b _]]
 [b `(deref ~b)])
   bents))
bindings (vec (mapcat (fn [[b v]]
[b `(future ~(postwalk-replace smap v))])
  bents))]
`(let ~bindings
   ~@(postwalk-replace smap body

(time
 (let [{:keys [a]} (remote-req {:a 1 :x 2})
   b (remote-req 1)
   c (+ a b)
   d (remote-req 1)
   e (remote-req 1)
   f (+ d e)]
   (+ c f)));; "Elapsed time: 4007.60237 msecs"

(time
 (plet [{:keys [a]} (remote-req {:a 1 :x 2})
b (remote-req 1)
c (+ a b)
d (remote-req 1)
e (remote-req 1)
f (+ d e)]
   (+ c f)));; "Elapsed time: 1003.733416 msecs"


https://github.com/eunmin/plet

Thanks!

- Eunmin

-- 
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.


Re: How to check type of generic parameter with spec?

2016-11-16 Thread Eunmin Kim
Thanks for the reply. :)

On Wednesday, November 16, 2016 at 11:44:50 PM UTC+9, Alex Miller wrote:
>
>
>
> On Tuesday, November 15, 2016 at 10:11:34 PM UTC-6, Eunmin Kim wrote:
>>
>> Hi! I had a question while reading Functional Programming in Scala book.
>>
>> The following code is Exercise 2:
>>
>> // Exercise 2: Implement a polymorphic function to check whether
>> // an `Array[A]` is sorted
>>
>> def isSorted[A](as: Array[A], gt: (A,A) => Boolean): Boolean = {
>>   @annotation.tailrec
>>   def go(n: Int): Boolean =
>> if (n >= as.length-1) true
>> else if (gt(as(n), as(n+1))) false
>> else go(n+1)
>>
>>   go(0)
>> }
>>
>> In the above code, Generic typ parameter(A) is displayed. How should I 
>> express it in clojure spec?
>>
>
> Because Clojure doesn't have generics, there is no direct representation 
> of A in the Clojure version. If you want to ensure that all elements of the 
> collection are of the same type, then say that.
>
> (defn same-type? [coll]
>   (or (empty? coll)
>  (let [t (class (first coll))]
>(every? #(= t (class %)) coll
>
> (s/fdef sorted-coll?
>   :args (s/cat :as (s/and (s/coll-of any?) same-type?)
>  :ordered-fn? ifn?) ;; cheating for brevity
>   :ret boolean?)
>
>  
>
>> (defn sorted-coll? [as ordered-fn?]
>>   (loop [coll (seq as)]
>> (cond 
>>   (= 1 (count coll)) true
>>
>
> just by inspection, this is broken for empty collections - should be <= 1 
> here
>  
>
>>   (not (ordered-fn? (first coll) (second coll))) false
>>   :else (recur (rest coll)
>>
>>
> And I would be remiss not to mention that 
> a) there is an existing sorted? predicate that I would use for this purpose
> b) the sorted set and map implementations in Clojure already require that 
> elements are all of the same type for the comparator to work
>  
>

-- 
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.


How to check type of generic parameter with spec?

2016-11-15 Thread Eunmin Kim
Hi! I had a question while reading Functional Programming in Scala book.

The following code is Exercise 2:

// Exercise 2: Implement a polymorphic function to check whether
// an `Array[A]` is sorted

def isSorted[A](as: Array[A], gt: (A,A) => Boolean): Boolean = {
  @annotation.tailrec
  def go(n: Int): Boolean =
if (n >= as.length-1) true
else if (gt(as(n), as(n+1))) false
else go(n+1)

  go(0)
}

In the above code, Generic typ parameter(A) is displayed. How should I 
express it in clojure spec?

(defn sorted-coll? [as ordered-fn?]
  (loop [coll (seq as)]
(cond 
  (= 1 (count coll)) true
  (not (ordered-fn? (first coll) (second coll))) false
  :else (recur (rest coll)

-- 
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.


Re: [ANN] New clojure.org!

2016-01-14 Thread Eunmin Kim
Great!!

-- 
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.


[ANN] prone-pedestal 0.1.1 - Prone for Pedestal

2016-01-07 Thread Eunmin Kim
Dear Clojurians,

I just released a pedestal interceptor of 
Prone(https://github.com/magnars/prone).

See: https://github.com/eunmin/prone-pedestal

Clojars/Leiningen dependency:

[prone-pedestal "0.1.1"]

-- 
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.


Re: Using the Undertow AJP Linstner in Immutant2

2015-02-20 Thread Eunmin Kim
Awesome! :)

2015년 2월 20일 금요일 오후 11시 12분 11초 UTC+9, Jim Crossley 님의 말:
>
> Cool. Submit a PR and we'll get it merged in. 
>
> Thanks! 
> Jim 
>
> On Fri, Feb 20, 2015 at 4:25 AM, Eunmin Kim  > wrote: 
> > Hi! 
> > I added ajp? on immutant.web/run option to use the Undertow AJP Linstner 
> in 
> > Immutant2. :) 
> > 
> > https://github.com/eunmin/immutant/tree/support_undertow_ajp 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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.


Using the Undertow AJP Linstner in Immutant2

2015-02-20 Thread Eunmin Kim
Hi!
I added ajp? on immutant.web/run option to use the Undertow AJP Linstner in 
Immutant2. :)

https://github.com/eunmin/immutant/tree/support_undertow_ajp


-- 
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.


Mocking java class for test.

2014-12-14 Thread Eunmin Kim
Hi! My question is, How can I exchange a java class for test like 
`with-redefs`?

(defn run-a
  []
  (... some logic
 (.run (AClass. )))

(deftest some-test
  (with-redefs [AClass MockAClass] ;; ???
(is (run-a)))



-- 
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.