ANN: Hildebrand 0.2.2

2015-06-01 Thread Moe Aboulkheir
First time caller.

Hildebrand is an asynchronous pure-Clojure (i.e. no Java AWS dependencies, 
etc.) DynamoDB client written on top of httpkit.  I've been developing it 
for a while now, and have used it in production, but hadn't gotten around 
to telling anyone about it. 

http://github.com/nervous-systems/hildebrand

I wrote a circuitous blog post about 
it: https://nervous.io/clojure/aws/dynamo/hildebrand/2015/06/08/hildebrand/ 
(apparently in the future), which is more informative.

 As this is the first public release, I'll just rattle off some high points:

 - Intuitive, consistent and total data representation of Dynamo schemas, 
items, filters, update specifications, etc.
 - Support for arbitrarily nested lists and maps in Dynamo items, has 
support for set types
 - Paginated/stepped query & scan with core.async channels
 - It could possibly perform decently

Take care,
Moe

-- 
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: Hildebrand 0.2.2

2015-06-02 Thread Moe Aboulkheir
Thanks!  There was a high effort/clause also.  I'm working on a couple more
Clojure posts today.

Take care,
Moe

On Tue, Jun 2, 2015 at 9:37 AM, Tj Gabbour  wrote:

> Slightly OT, but wow, slowly reading your blogpost because it's terribly
> pleasant to read! :) Like, a high amusement-to-clause ratio.
>
> (I think this should influence my own tech writing.)
>
>
>
> On Tuesday, June 2, 2015 at 2:20:59 AM UTC+2, Moe Aboulkheir wrote:
>>
>> First time caller.
>>
>> Hildebrand is an asynchronous pure-Clojure (i.e. no Java AWS
>> dependencies, etc.) DynamoDB client written on top of httpkit.  I've been
>> developing it for a while now, and have used it in production, but hadn't
>> gotten around to telling anyone about it.
>>
>> http://github.com/nervous-systems/hildebrand
>>
>> I wrote a circuitous blog post about it:
>> https://nervous.io/clojure/aws/dynamo/hildebrand/2015/06/08/hildebrand/
>> (apparently in the future), which is more informative.
>>
>>  As this is the first public release, I'll just rattle off some high
>> points:
>>
>>  - Intuitive, consistent and total data representation of Dynamo schemas,
>> items, filters, update specifications, etc.
>>  - Support for arbitrarily nested lists and maps in Dynamo items, has
>> support for set types
>>  - Paginated/stepped query & scan with core.async channels
>>  - It could possibly perform decently
>>
>> Take care,
>> Moe
>>
>>  --
> 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.
>

-- 
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: Fink-Nottle 0.1.0 (async SQS + SNS client)

2015-06-15 Thread Moe Aboulkheir
https://github.com/nervous-systems/fink-nottle

Fink-Nottle is a non-blocking client for Amazon's SQS (queuing) and SNS 
(push notification) services.

There's a blog post here covering the SQS portion of its 
functionality: 
https://nervous.io/clojure/aws/async/sqs/messaging/2015/06/15/fink-nottle-sqs/
And one for 
SNS: 
https://nervous.io/clojure/aws/async/sns/messaging/2015/06/15/fink-nottle-sns/

Features:

SQS:
 - Per-queue message channels
 - Auto-batching of writes and deletes, also via channels
 - Message body pre-processing 
 - Round-tripping of byte array & number attributes

SNS:
 - Channeled pagination of topic/endpoint/subscription listing

Both:
 - Natural EDN representation of AWS permission/policy documents
 - Coverage of all API methods

Take care,
Moe

-- 
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: Clojure on AWS Lambda?

2015-07-05 Thread Moe Aboulkheir
I looked into this a little over the weekend, and wrote a small library &
lein template/plugin for deploying Clojurescript functions to Lambda:
https://github.com/nervous-systems/cljs-lambda

There's a blog post / step-by-step tutorial here:
https://nervous.io/clojure/clojurescript/aws/lambda/node/lein/2015/07/05/lambda/

Take care,
Moe

On Wed, Jun 17, 2015 at 8:28 AM, Ragnar Dahlén  wrote:

> You can get the initial startup time down by AOT compiling. I also believe
> that Lambda will re-use the same runtime and lambda function instance until
> a certain period of inactivity.
>
> For example, in the example below I invoke the function (AOT compiled this
> time) three times. First invocation takes ~7s, the two following ~1.5ms.
>
>
> START RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
> HELLO FROM CLOJURE :)
> #object[lambdainternal.api.LambdaClientContext 0x3419866c
> lambdainternal.api.LambdaClientContext@3419866c]
> END RequestId: b555c9c2-14c1-11e5-8a31-03153568534c
> REPORT RequestId: b555c9c2-14c1-11e5-8a31-03153568534c Duration: 7882.62
> ms Billed Duration: 7900 ms Memory Size: 512 MB Max Memory Used: 98 MB
> START RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
> HELLO FROM CLOJURE :)
> #object[lambdainternal.api.LambdaClientContext 0x63e31ee
> lambdainternal.api.LambdaClientContext@63e31ee]
> END RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63
> REPORT RequestId: bd876a51-14c1-11e5-94fc-f9606cb38b63 Duration: 1.66 ms
> Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB
> START RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
> HELLO FROM CLOJURE :)
> #object[lambdainternal.api.LambdaClientContext 0x68fb2c38
> lambdainternal.api.LambdaClientContext@68fb2c38]
> END RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8
> REPORT RequestId: bdf4aa6f-14c1-11e5-a6b0-e9e3f6fa14c8 Duration: 1.56 ms
> Billed Duration: 100 ms Memory Size: 512 MB Max Memory Used: 98 MB
>
>
> On Tuesday, 16 June 2015 16:46:36 UTC+1, Kyle Sexton wrote:
>>
>> Answering my own question about performance, it looks like almost 14
>> seconds for the Lambda function to run. Doing the math1
>> <#14e006bc5690cdbe_m2mvzzr704.fsf@mocker.org_fn.1> if I were to run this
>> 300 times in a month bill would be about $342.56. Probably not the
>> ideal solution for clojure in the cloud just yet. :)
>>
>> START RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
>> HELLO FROM CLOJURE :)
>> #object[lambdainternal.api.LambdaClientContext 0x26a7b76d 
>> lambdainternal.api.LambdaClientContext@26a7b76d]
>> END RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb
>> REPORT RequestId: 48614bcd-143b-11e5-b2c5-b704df8ab2eb   Duration: 
>> 13680.53 ms   Billed Duration: 13700 ms   Memory Size: 512 MB Max 
>> Memory Used: 104 MB
>>
>>  Kyle Sexton
>>
>> Footnotes:
>>  Footnotes:
>> 1 <#14e006bc5690cdbe_m2mvzzr704.fsf@mocker.org_fnr.1>
>>
>> Used http://aws.amazon.com/lambda/pricing/ and came up with (* (* (*
>> 13.7 300) (/ 512 1024.0)) 0.1667) where 300 is number of
>> times run per month, 13.7 is seconds of billable time, 512 is MB of RAM
>> allocated to the function.
>>
>  --
> 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.
>

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


Suspended var swaps in core.logic.nominal

2023-11-11 Thread Moe Aboulkheir
Afternoon,

I'm new to core.logic, and was working through the αKanren 
 paper with core.logic.nominal.  On 
page 4, there is an example which translates to:





*(l/run* [q]  (n/fresh [a b](l/fresh [x y]  (l/== (n/tie a (n/tie a 
x)) (n/tie a (n/tie b y)))  (l/== `(~x ~y) q *
*=> ((_0 _1))*

The example output in the paper is as follows, with the given explanation:

*susp ((a0 a1)) _0) _0) : ((a0 . _0*

*The first call to ≡ applies the swap (a b) to the unbound variable y, and 
then associates the resulting suspension (susp ((a b)) y) with x . Of 
course, the unifier could have applied the swap to x instead of y, 
resulting in a symmetric answer. The freshness constraint states that the 
nom a can never occur free within y, as required by the definition of 
binder equivalence.*

 Could somebody explain to me, as if I were a child, this discrepancy?  I 
looked at the source, and saw code that looked very much like suspensions 
being applied at creation time, rather than on var instantiation like the 
paper elsewhere indicates, but I'm out of my depth and not in a position to 
reason about strategy.

Best,
Moe

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/756b55d5-e952-4f2c-98da-ba9a43ec34c9n%40googlegroups.com.


Re: Suspended var swaps in core.logic.nominal

2023-11-11 Thread Moe Aboulkheir
According to the wiki:




*In core.logic.nominal, we implement suspensions as constraints. During
swapping of a and b, whenever we encounter a variable x, we replace it with
a fresh variable x' and add the suspension constraint swap [a b] x' x. This
swap constraint is executed under one of two conditions:x and x' both
become bound -- the swapping can resumex and x' become equal -- we enforce
a#x' and b#x' and drop the swap constraint*

I do not see how either of these conditions obtains in the quoted example —
*x * and *y* are unbound.

Best,
Moe

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CACZF%3DBG2cLMVc3Wn_v0%3DQTUZLJtDuGNoUXFdSAZ9DqzcrKYfZw%40mail.gmail.com.


Re: grouping and mapping

2016-08-12 Thread Moe Aboulkheir
As far as already existing, (grouped-map first (comp str/upper-case second)
...) or similar, with
https://github.com/plumatic/plumbing/blob/master/src/plumbing/core.cljx#L164

Take care,
Moe

On Fri, Aug 12, 2016 at 6:10 PM, Erik Assum  wrote:

> I’ve been working on a new project in java 8 at a new client where I’ve
> been able to play with streams.
> In doing so I’ve come across Collectors.groupingBy which has some
> additional features that group-by doesn’t seem to have.
>
> Example:
> Given
> (def foos [[:a "foo"]  [:b "bar"]  [:a "baz"]])
>
> (group-by first foos)
> ;=> {:a [[:a "foo"] [:a "baz"]], :b [[:b "bar"]]}
>
> but I’d like the result to be
> ;=> {:a ["FOO" "BAZ"] :b ["BAR”]}
>
> This is solved in javas stream api by something like this:
>
> List> = [["a", "foo"], ["b" "bar"], ["a", "baz"]];
>
> foos
> .stream()
> .collect(Collectors.groupingBy(e -> e.get(0),
> Collectors.mapping(e -> e.get(1).toUpperCase(),
> Collectors.toList(;
>
> Where the key point is that Collectors.groupingBy accepts a mapping
> function in which to map the values being grouped.
>
> So how would one go about writing this in Clojure? I could of-course write
> something that mapped over the grouped map,
> but I’d really like to write something like
>
> (defn mapping-group-by grouping-fn mapping-fn coll)
>
> but I have a suspicion that this already exists in some form already?
>
> Erik.
>
> --
> 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.
>

-- 
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: Why is this not considered to be in a go block?

2016-08-26 Thread Moe Aboulkheir
On Sat, Aug 27, 2016 at 12:08 AM, mond  wrote:

> Is that the same thing or have I made a(nother) / different mistake?
>
>
At a glance, it looks like the functions you're passing into map and filter
are shaped wrong - (comp (map sse-data) (filter
matching-event-client-filter)) may have been the intention.  #(fn ..) is
going to create a no-arg fn which returns the explicit (fn ...) when
called.  Both # and fn turn out to be unnecessary as you're not doing
anything on top of passing through the single argument.

I have no idea if this is the cause of your error, though.

Take care,
Moe

-- 
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: Shapeshiftr 0.1.0 - altcoin conversion

2016-09-07 Thread Moe Aboulkheir
shapeshiftr  is a
Clojure/script client for the shapeshift.io cryptocurrency/altcoin
exchange, which allows easy conversion of a variety of currencies (without
any need for registration).

The remote API is CORS-enabled - the client works in browsers as well as on
the JVM & Node.


Documentation & examples


Take care,
Moe

-- 
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: Just quick review - "idiomaticy" check (Selection sort)

2016-10-10 Thread Moe Aboulkheir
Here's an example w/ iterate & a simpler 'smallest':

(defn- smallest [xs]
  (->> xs (map-indexed vector) (sort-by second) first))

(defn selection-sort [s]
  (->> (iterate
(fn [[acc xs]]
  (let [[i x] (smallest xs)
[l r] (split-at i xs)]
[(conj acc x) (concat l (rest r))]))
[[] s])
   (drop-while (comp not-empty second))
   ffirst))

I don't think using iterate is a huge win.

Take care,
Moe

-- 
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: join* tables from csv

2016-10-18 Thread Moe Aboulkheir
(defn join* [d1 c1 d2 c2]
  (clojure.set/join (into #{} d1) (into #{} d2) {c1 c2}))

Or else look at the implementation of set/join.

Take care,
Moe

On Tue, Oct 18, 2016 at 9:41 AM,  wrote:

> Hey guys, i'm beginner and need help.
>
> I have a task:
>
> ;; (join* (join* student-subject :student_id student :id) :subject_id
> subject :id)
> ;; => [{:subject "Math", :subject_id 1, :surname "Ivanov", :year 1998,
> :student_id 1, :id 1}
> ;; {:subject "Math", :subject_id 1, :surname "Petrov", :year 1997,
> :student_id 2, :id 2}
> ;; {:subject "CS", :subject_id 2, :surname "Petrov", :year 1997,
> :student_id 2, :id 2}
> ;; {:subject "CS", :subject_id 2, :surname "Sidorov", :year 1996,
> :student_id 3, :id 3}]
> ;;
> ;; Hint: reduce, conj, merge, first, filter, get
> ;; Here column1 belongs to data1, column2 belongs to data2.
> (defn join* [data1 column1 data2 column2]
>   )
>
> so.. i'm trying to write join (defn join* [data1 col1 data2 col2] ... )
> data1 and data2 like: ({:key1 val1 :key2 val2} {:key1 val3 :key2 val4})
> after => example result.
>
> --
> 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.
>

-- 
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: Contribute Specter to Clojure core?

2017-03-04 Thread Moe Aboulkheir
On Sat, Mar 4, 2017 at 6:35 AM, Asim Jalis  wrote:

> What might be a Clojurey syntax for doing path navigation? In other words
> how could get-in be extended so that it could parse nested vectors like it
> parses nested maps? Thinking out aloud, an integer in the path when the
> data structure at that level is a vector should treat the integer as an
> index.
>

If I'm reading you correctly, that is Clojure's current behaviour - (get-in
{:a [{:b "X"}]}  [:a 0 :b]) => "X"

Take care,
Moe

-- 
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: Clojure resume tips?

2017-03-23 Thread Moe Aboulkheir
Jason,

If it were my resumé, I would consider including only the technologies I
had interest in working with professionally.  Getting involved in
collaborative open source development (i.e. contributing to established
projects) is likely to increase your confidence, as well as that of a
prospective employer - you could consider shunting off the coursework
details (or listing those as "Interests", if they're interests) if you had
some voluntary development to put in its place.  Other ways to fill out
space while improving content would be to include a generic (i.e. not
job-specific) introduction beneath the heading, or using complete sentences
for the job description at the bottom.  If you go with bullet points, using
a list indicator might make this clearer.

As far as visual feedback: it might scan better if the section headings in
the left column were kept to single words (i.e. no line breaks), and were
vertically justified with the top of corresponding piece of text in the
adjacent column (using a table with invisible borders).  The alignment of
the info icons (which are a good call) is off in a similar way, and that
block does not appear horizontally centred to me.  Some colour variation
may help also - examples would be converting the urls into links (with the
url as the link text, for printing), or using a dark shade of grey for
heading or title text.

Take care,
Moe

On Thu, Mar 23, 2017 at 5:10 PM, Jason Basanese 
wrote:

> Attached is a fairly bad resume that I am using. Any tips on how I might
> change it to appeal to more places that are looking for functional
> developers?
>
> --
> 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.
>

-- 
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: Hexing the Technical Interview

2017-04-06 Thread Moe Aboulkheir
Love it.

-- 
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: Reducing Jar file size for AWS Lambda

2017-07-20 Thread Moe Aboulkheir
Jose,

Leaving aside shrinking the jar, you could try:
 - Structuring your application so it's easier to construct plausible
inputs in the tests / REPL
 - Using https://github.com/lambci/docker-lambda locally, to get an
environment closer to the deployment target
 - Deploying to a geographically closer region, or triggering deployments
on a build slave with better network connectivity
 - Deploying manually with awscli, as your package is small enough to be
uploaded directly to lambda, rather than using S3

(With a strong bias for the first one - even if the your package was a
third of the size, it's still going to be frustrating to deploy it and then
get unexpected errors)

Take care,
Moe

On Thu, Jul 20, 2017 at 5:16 AM, Jose Trigueros 
wrote:

> Hi all,
>
> I've been using AWS Lambda for a small project. I've been leveraging the
> lein-clj-lambda  plugin to
> build and upload the compiled Jar to S3 which is then used to update my
> Lambda function. Aside from the Jar generation, a lot of the time is spent
> uploading the Jar up to S3. The resulting Jar file is only about 12mb but
> does considerably slow down the feedback loop.
>
> I have the following questions:
>
>- Does anyone have any tips for reducing the size of a jar even more?
>   - I've tried excluding dependencies until the Jar broke, saved a
>   few KBs
>   - I briefly looked into ProGuard, but the obfuscating process
>   seemed to take some time which would negate any time saved on upload.
>- Am I doing this wrong? Is there a way to mimic AWS Lambda locally?
>   - To mitigate this loop, I use the REPL to play with the individual
>   functions until they feel right, but at some point you gotta test on the
>   server, being far from perfect, I make a lot of mistakes so that's when 
> the
>   iteration happens.
>
> Here's a link to the project.clj
> 
> in question for reference.
>
>
> I will say that using the lein-clj-lambda is already a huge win (before
> plugin it was `lein uberjar`, manually upload jar to S3, manually update
> AWS Lambda), but I'm wondering if there's an even better way.
>
>
> -jvt
>
> --
> 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.
>

-- 
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: sputter, a Clojure implementation of the Ethereum VM

2017-10-18 Thread Moe Aboulkheir
I've been working on an ongoing series of blog posts documenting the
development of sputter , an
immutable EVM implementation  Today's instalment is available here
.

The first post 
contains
enough background information to get started, for those without prior
knowledge of Ethereum.

Take care,
Moe

-- 
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: State & GUIs

2017-12-02 Thread Moe Aboulkheir
It may make sense to familiarise yourself with the architecture of a
Clojurescript + React web application, if that's not something you've
recently investigated.  Regardless of whether the techniques are directly
applicable to your problem, I think the relationship between the state and
the UI is something to aspire to.

It may also be worth looking at https://github.com/halgari/fn-fx which is
trying to do something similar with JavaFX.

Take care,
Moe

-- 
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 apply multiple values to a function

2018-03-28 Thread Moe Aboulkheir
Renata,

It depends on what you want to with the results of treat-request.  If you
don't care about them, which seems like the case:

(doseq  [[x y z] [x1 y1 z1] [x2
y2 z2] [x3 y3 z3]]
  (treat-request x y z))

Is one way to accomplish it.  If you want a collection of the results,
replace doseq with for  (maybe
take a look at doall , also).

In terms of the general approach - if the goal is to end up with a sequence
containing only the specified keys from each map (i.e. the 'collection'
argument is the same for all invocations), then you can accomplish this
without an atom:

(for [[m ks] [[m1 ks1] [m2 ks2] ...]]
  (select-keys m ks))

Does just that.

Take care,
Moe

On Thu, Mar 29, 2018 at 12:27 AM, Renata Soares 
wrote:

> Good night,
>
> I have this function:
>
> (defn treat-requests [input key-request collection]
> (let [selecteds (select-keys input key-request)]
> (swap! collection conj selecteds)))
>
> and I want to execute that 3 times with 3 differents arguments
>
> How can I do to apply a list of differents arguments to a function?
>
> Instead of calling 3 times like:
>
> (treat-request x1 y1 z1)
> (treat-request x2 y2 z2)
> (treat-request x3 y3 z3)
>
> I want to call one time. For example... (apply treat-request [x1 y1 z1]
> [x2 y2 z2] [x3 y3 z3])
>
>
> --
> 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.
>

-- 
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 apply multiple values to a function

2018-03-28 Thread Moe Aboulkheir
Missed a set of parens:

On Thu, Mar 29, 2018 at 1:25 AM, Moe Aboulkheir  wrote:

> Renata,
>
> It depends on what you want to with the results of treat-request.  If you
> don't care about them, which seems like the case:
>

(doseq [[x y z] [[x1 y1 z1] [x2 y2 z2] [x3 y3 z3]]]
  (treat-request x y z))

-- 
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: Best way to unit test

2018-03-29 Thread Moe Aboulkheir
bj,

Is 'current-date' a top-level var in that file?  If so, a good start might
be a test which used with with-redefs
 to supply a contrived
value for 'current-date', and then validated dates on either side of it.
It may be less brittle to support something like this:

(defn validate-date
 ([now date-for-validation] (<= (Integer/parseInt date-for-validation)
(Integer/parseInt now)))
 ([date-for-validation] (validate-date current-date
date-for-validation)))

You'd then only test the arity which accepts an explicit current-date, and
separately test whatever is responsible for deriving 'current-date'.  A few
notes:

- Having a static current-date is going to be a problem for long-running
programs - computing it at the point of validation may be a safer approach.
- If these values (current-date, date-for-validation) are used more than
once, converting them from strings elsewhere, and passing them around as
numbers may be more convenient.  validate-date just becomes <=, in that
case, and may not require a test.

Take care,
Moe


On Thu, Mar 29, 2018 at 2:20 AM, bj  wrote:

> What is the best way to write unit test case for following situation?
>
> [date-for-validation]
> (if (>= (Integer/parseInt current-date)
> (Integer/parseInt date-for-validation)) true false))
>
> --
> 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.
>

-- 
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: Future

2018-05-19 Thread Moe Aboulkheir
(doall (pmap  (range ...))) may be a viable approach also,
depending on the behaviour you want.

On Sat, May 19, 2018 at 11:42 PM, Renata Soares 
wrote:

> It worked, thanks!
>
> Em sábado, 19 de maio de 2018 19:38:28 UTC-3, Alex Engelberg escreveu:
>>
>> Not sure what's going on with shutdown-agents, but you could call (run!
>> deref ...) to wait for all the futures to complete.
>>
>> On Sat, May 19, 2018 at 3:29 PM Renata Soares 
>> wrote:
>>
>>> Hello,
>>>
>>> I am using future this way:
>>>
>>> (doall (map #(future ()  (range 1
>>> max-size))
>>>
>>> When the max-size is small like around 6, if I don't print (println
>>> (doall (map #(future ()  (range 1
>>> max-size))), the result  becomes empty
>>>
>>> (Without print)
>>>
>>> renata@renata:~/$ lein run
>>> ranking  {}
>>>
>>> (With print)
>>> renata@renata:~/$$ lein run
>>> (#object[clojure.core$future_call$reify__6962 0x6492fab5 {:status
>>> :ready, :val {:2 0, :4 0.0, :5 0, :1 2.5}}] 
>>> #object[clojure.core$future_call$reify__6962
>>> 0x2c532cd8 {:status :ready, :val {:2 0}}] 
>>> #object[clojure.core$future_call$reify__6962
>>> 0x294e5088 {:status :ready, :val {:2 0, :4 0.0, :5 0, :1 2.5, :3 1.0}}]
>>> #object[clojure.core$future_call$reify__6962 0x51972dc7 {:status
>>> :ready, :val {:2 0, :4 0.0}}] #object[clojure.core$future_call$reify__6962
>>> 0x3700ec9c {:status :ready, :val {:2 0, :4 0.0, :5 0}}])
>>> ranking  {"1":2.5,"3":1.0,"5":0,"4":0.0,"2":0}
>>>
>>> I am using (shutdown-agents) after the doall...
>>>
>>> Any ideas why? I think it is because the futures aren't ready when
>>> (shutdown-agents) executes.
>>>
>>> (When the max-size is big, run normally)
>>>
>>> There is a way that I can wait for print the result until all futures
>>> are ready?
>>>
>>> Thanks!
>>>
>>> --
>>> 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.
>

-- 
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] Leiningen template aws-lambda-serverless

2018-06-02 Thread Moe Aboulkheir
There's some casual treatment of performance in this blog post:
https://nervous.io/clojure/clojurescript/aws/lambda/node/lein/2015/07/05/lambda/
For those interested in cljs,
https://github.com/nervous-systems/serverless-cljs-plugin permits the
deployment of cljs projects via sls.

Take care,
Moe

-- 
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: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-18 Thread Moe Aboulkheir
Christian,

Nice to have you here.  I guess a couple of things are being discussed in
parallel - a few trivial points:

 - 'you always get back a value of the concrete type you supplied for
argument X' isn't obviously less cognitively burdensome than 'you always
get back a sequence'
 - doesn't Python, in all its teachability, just throw a TypeError if you
try and concatenate differently typed collections, even in trivial cases
(e.g. (1,) + [2])?  Is there a way to do that in Python which doesn't
involve writing a concat function w/ a bunch of type checks
 - runtime list construction in Clojure is comparatively rare.  I'm not a
teacher, but in a practical educational setting I would focus on vectors as
the general-purpose ordered collection type - esp. if i were interested in
appending to them.

Take care,
Moe

On Wed, Jul 18, 2018 at 10:07 PM, Christian Seberino 
wrote:

> I'm just a Clojure beginner but it seems that the Lisp Way(TM) is to
> append and prepend one or more elements
> with a single command if possible.  The logical name for this command
> seems to be concat which led to this..
>
> (defn concat_ [a b]
>   (def c (concat a b))
>   (if (vector? a)
>   (into [] c)
>   c))
>
> (concat_ [1 2] [3 4]) => [1 2 3 4]
>
> (concat_ '(1 2) '(3 4)) => (1 2 3 4)
>
> (concat_ [1] [2 3]) => [1 2 3]
>
> Lists return lists and vectors return vectors.  Simple.
> Yes yes I know it is slow.  I also know I need to expand concat_ to handle
> other data structures.
>
> In my little newbie world, this "feels" like the ultimate "right" solution.
>
> Chris
>
> --
> 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.
>

-- 
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: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-23 Thread Moe Aboulkheir
On Mon, Jul 23, 2018 at 3:29 AM, Christian Seberino 
wrote:

>  This might surprise some but I actually think some things are more
> elegant in Clojure than Scheme!
>

Expect these revelations to continue.

-- 
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] com.walmartlabs/cond-let 1.0.0

2018-10-04 Thread Moe Aboulkheir
See https://funcool.github.io/cats/latest/#mlet for something closer to
home, in the monadic vein.


On Thu, Oct 4, 2018 at 4:10 PM Gary Trakhman 
wrote:

> These are all just sugar over monadic bind, right?
>
> Here's one way to do it in the ocaml alternate universe:
> https://github.com/janestreet/ppx_let#syntactic-forms-and-actual-rewriting
>
> But it can be made to work for async or options or whatever, too.
>
> We can put the async helpers in the same bucket:
> https://github.com/ztellman/manifold/blob/master/docs/deferred.md#let-flow
>
> The general idea is turning function application into something that looks
> less nested.
>
> On Wed, Oct 3, 2018 at 10:22 PM Mark Engelberg 
> wrote:
>
>> This looks like a case of "convergent evolution".
>>
>> Having the ability to do a :let in the middle of a cond feels like one of
>> those things that *should* be in the core language, so if it's not in
>> there, a bunch of people are naturally going to arrive at the same solution
>> and make it happen in their own utility libraries.  A bunch of us Clojure
>> programmers from the early 1.0 days had been privately passing around and
>> using a "cond that supports :let bindings" macro for years.  The first time
>> I saw the macro was in a blog post by Christophe Grand. I really hoped it
>> would make it into Clojure proper -- other functional languages like Racket
>> and F# support ways to bind local variables with "clearer, more linear
>> code, that doesn't make a march for the right margin", as Howard Lewis Ship
>> put it.  But after several years had passed without any indication that
>> CLJ-200 was ever going to be addressed, I eventually made the improved cond
>> macro into a clojars library.
>>
>> walmartlabs' cond-let addresses the most important thing (let), which is
>> the critical piece of functionality that feels like the most natural,
>> needed addition to the language.  better-cond's :let syntax is identical.
>> But as us old-school Clojurians passed around the "better cond" macro over
>> the years, it grew in functionality.  So in better-cond, I included the
>> other little improvements that had accumulated over time, which I had found
>> useful.  So better-cond also supports :when, :when-let, and :do (and will
>> soon have :when-some).  :let is the only piece that I felt really belonged
>> in the core language's cond, and if CLJ-200 had made it into the core
>> language, I would have been content to just use Clojure's own cond.  But
>> once I realized I was going to need a library to achieve the much-needed
>> :let inside of cond, I figured I might as well use that library to include
>> the other convenient cond additions as well.  So better-cond is a superset
>> of cond-let's functionality, with support for :let plus a few bonuses.
>>
>> Use whichever one strikes your fancy.  cond-let is perfect if all you
>> care about is adding :let to your cond.  If you want to experiment with
>> some of the other features beyond :let, you could use better-cond and see
>> what you think.
>>
>> Either way, I strongly encourage you to use one of these two libraries so
>> you can start using :let inside your cond.  I agree fully with Howard Lewis
>> Ship that it results in clearer code.  Try either library which supports
>> this -- it will change your life!
>>
>>
>> On Wed, Oct 3, 2018 at 5:05 PM Matching Socks 
>> wrote:
>>
>>> Is this a refinement of Mark Engelberg's "better-cond", or an
>>> alternative approach?
>>>
>>> I have not used better-cond myself, but it starts here:
>>> https://dev.clojure.org/jira/browse/CLJ-200.
>>>
>>> --
>>> 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.
>>>
>> --
>> 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...@googl

Re: The magic of Lisps

2019-05-03 Thread Moe Aboulkheir
On Sun, Apr 28, 2019 at 10:46 AM Erik Assum  wrote:

> I see, and acknowledge that eg the go-macro core.async is a wonderful
> piece of work, and that it’s really cool that it could be done in a
> library. But as an application programmer, I really don’t care if it’s a
> macro or a language feature, and I couldn’t really see myself investing
> that amount of time (nor would I have the skills to do so if I had the
> time) to solve my concurrency problems in such a general manner.
>

As an application developer, I'm betting the farm on the maintainability of
the core language, and my options are constrained by its portability.
Clojure would be a greater liability if core.async were an intrinsic
feature, and (IMHO) la little less of one if STM and agents weren't.


> 2) Pointers to blogs/articles/codebases which shows how applications
> written either with extensive use of macros or by implementing an internal
> DSL (and compiler) are significantly quicker to develop than their
> brute-force alternatives.
>

I'm not sure data of this sort yields to analysis, though I do think *speed
of development* is a suspicious yardstick. *Maintainability* is the
unseemly underbelly of syntactic flexibility, and multiple layers of
languages - each specified by implementation - is kryptonite for
maintenance and collaboration.

Take care,
Moe

-- 
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: partition-when?

2015-08-19 Thread Moe Aboulkheir
Laurens,

I don't think I've encountered an identical function I can point you to,
but here's an alternative implementation:

(defn partition-when [pred coll]
  (lazy-seq
   (when-let [[h & t] (seq coll)]
 (let [[run remains] (split-with (complement pred) t)]
   (cons (cons h run) (partition-when pred remains))

Do you like that any better?

P.S: Say Hi to Chris for me!

Take care,
Moe


On Thu, Aug 20, 2015 at 1:34 AM, Laurens Van Houtven <_...@lvh.io> wrote:

> Hi,
>
>
> I needed a function that partitions (coll a) => (coll (coll a)), starting
> a new subcoll whenever a given pred is true. Use case: I have a sequence of
> rows; these rows form groups; I want to group them. A group is started by a
> header; so I want a new coll whenever my is-header? pred returns true.
>
> I found an implementation that used partition-by on the mailing list, but
> this had some issues: if multiple elems next to each other were true under
> the pred, it wouldn’t create a new pred for each one.
>
> I came up with the following implementation.
>
> (defn ^:private partition-when
>   "Partitions the coll whenever (f elem) is true."
>   [pred coll]
>   (-> (reduce (fn [[first & rest :as groups] elem]
> (if (pred elem)
>   (conj groups [elem])
>   (conj rest (conj first elem
>   '()
>   coll)
>   reverse))
>
> It feels like this could be written a *lot* better. With Haskell’s
> Data.List.Split, this becomes:
>
> partitionWith p xs = filter (/= []) (split (whenElt p) xs)
>
> (thanks to my colleague Christopher Armstrong for the help with the
> Haskell version)
>
> It would *almost* be partitionWith p = split (whenElt p), but for some
> reason split sometimes returns empty lists. Granted, this is a specialized
> library; I’d be more than happy to get partition-when from a 3rd party.
> It’d be even nicer if it was in Clojure though :)
>
>
> thanks
> lvh
>
> --
> 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.
>

-- 
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: IteratorSequence, dead code?

2015-08-21 Thread Moe Aboulkheir
William,

https://clojuredocs.org/clojure.core/iterator-seq previously used it,
but as of this commit:
https://github.com/clojure/clojure/commit/c47e1bbcfa227723df28d1c9e0a6df2bcb0fecc1
uses RT/chunkIteratorSeq

http://dev.clojure.org/jira/browse/CLJ-1669 : "IteratorSeq will no
longer be used but is left in case of regressions for now".

Take care,
Moe

On Fri, Aug 21, 2015 at 12:02 PM, William la Forge  wrote:
> Oh! First, let me correct. I'm referring to IteratorSeq in clojure.lang. The
> constructor is package scoped, so I'll need to copy the code instead of
> subclassing. (Or convert it to Clojure.) So my question really is if the
> code is outdated? Seems to run fine for my limited tests so far. But I worry
> about using is as a starting point since the code is apparently
> unreferenced.
>
>
> On Friday, August 21, 2015 at 6:37:48 AM UTC-4, William la Forge wrote:
>>
>> I've been using Java class ItreratorSequence in package clojure.lang. But
>> then I noticed that this class is not referenced anywhere. Is this dead code
>> or otherwise not supported? I had been planning on subclassing this code.
>
> --
> 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.

-- 
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: Why I'm getting NPE with zipper/next?

2015-08-21 Thread Moe Aboulkheir
Hussein,

The println inside (recur) will return nil.

Take care,
Moe

On Fri, Aug 21, 2015 at 4:35 PM, Hussein B.  wrote:
> Hi,
>
> I have this structure:
>
> (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4 "children"
> []}]} {"n" {"id" "b"} "d" 3 "children" []}])
>
>
>
> And I wrote a function with zippers to traverse it:
>
>  (defn traverse [col]
>   (loop [z col]
> (if (= (z/next z) z)
> z
> (if (z/branch? z)
>   (recur (z/next z))
>   (recur (-> z println z/next))
>
>
> But I'm getting: NullPointerException   clojure.zip/next (zip.clj:236)
>
> Any ideas?
>
> Thanks for help.
>
> --
> 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.

-- 
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: Why I'm getting NPE with zipper/next?

2015-08-21 Thread Moe Aboulkheir
Hussein,

How are you constructing your zipper, before passing it to traverse?
Note that clojure.zip doesn't work on arbitrary data structures
without being given some information about how to descend
into/construct nodes, etc. - i.e. z/next expects a zipper, and your
data structure isn't a zipper, but an input to a zipper.  Unless
you've written a zipper you omitted from your post, zipping over maps,
in particular, may not be as convenient as you're imagining.
https://clojuredocs.org/clojure.zip/zipper has helpful examples in it.

Take care,
Moe

On Fri, Aug 21, 2015 at 5:06 PM, Hussein B.  wrote:
> Hi,
>
> I changed println to z/node , this time I'm getting:
>
> NullPointerException   clojure.zip/branch? (zip.clj:73)
>
> On Friday, August 21, 2015 at 5:56:10 PM UTC+2, Moe Aboulkheir wrote:
>>
>> Hussein,
>>
>> The println inside (recur) will return nil.
>>
>> Take care,
>> Moe
>>
>> On Fri, Aug 21, 2015 at 4:35 PM, Hussein B.  wrote:
>> > Hi,
>> >
>> > I have this structure:
>> >
>> > (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4
>> > "children"
>> > []}]} {"n" {"id" "b"} "d" 3 "children" []}])
>> >
>> >
>> >
>> > And I wrote a function with zippers to traverse it:
>> >
>> >  (defn traverse [col]
>> >   (loop [z col]
>> > (if (= (z/next z) z)
>> > z
>> > (if (z/branch? z)
>> >   (recur (z/next z))
>> >   (recur (-> z println z/next))
>> >
>> >
>> > But I'm getting: NullPointerException   clojure.zip/next (zip.clj:236)
>> >
>> > Any ideas?
>> >
>> > Thanks for help.
>> >
>> > --
>> > 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.

-- 
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: Why I'm getting NPE with zipper/next?

2015-08-21 Thread Moe Aboulkheir
Hussein,

I don't get an NPE passing that to traverse, but nothing much
interesting happens either.  The top-level data structure (and the
vectors within "children") aren't associative, and so don't pass the
branch? test (contains? % "children").

You could certainly extend the zipper to cover both cases, but there
may well be a more compact way to accomplish your goal.  What do you
want to do with the piece of data?

Take care,
Moe

On Fri, Aug 21, 2015 at 5:57 PM, Hussein B.  wrote:
> Here is my zipper:
>
>  (z/zipper #(contains? % "children") #(get % "children")  (fn [_ c] c) s)
>
> On Friday, August 21, 2015 at 6:49:25 PM UTC+2, Moe Aboulkheir wrote:
>>
>> Hussein,
>>
>> How are you constructing your zipper, before passing it to traverse?
>> Note that clojure.zip doesn't work on arbitrary data structures
>> without being given some information about how to descend
>> into/construct nodes, etc. - i.e. z/next expects a zipper, and your
>> data structure isn't a zipper, but an input to a zipper.  Unless
>> you've written a zipper you omitted from your post, zipping over maps,
>> in particular, may not be as convenient as you're imagining.
>> https://clojuredocs.org/clojure.zip/zipper has helpful examples in it.
>>
>> Take care,
>> Moe
>>
>> On Fri, Aug 21, 2015 at 5:06 PM, Hussein B.  wrote:
>> > Hi,
>> >
>> > I changed println to z/node , this time I'm getting:
>> >
>> > NullPointerException   clojure.zip/branch? (zip.clj:73)
>> >
>> > On Friday, August 21, 2015 at 5:56:10 PM UTC+2, Moe Aboulkheir wrote:
>> >>
>> >> Hussein,
>> >>
>> >> The println inside (recur) will return nil.
>> >>
>> >> Take care,
>> >> Moe
>> >>
>> >> On Fri, Aug 21, 2015 at 4:35 PM, Hussein B.  wrote:
>> >> > Hi,
>> >> >
>> >> > I have this structure:
>> >> >
>> >> > (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4
>> >> > "children"
>> >> > []}]} {"n" {"id" "b"} "d" 3 "children" []}])
>> >> >
>> >> >
>> >> >
>> >> > And I wrote a function with zippers to traverse it:
>> >> >
>> >> >  (defn traverse [col]
>> >> >   (loop [z col]
>> >> > (if (= (z/next z) z)
>> >> > z
>> >> > (if (z/branch? z)
>> >> >   (recur (z/next z))
>> >> >   (recur (-> z println z/next))
>> >> >
>> >> >
>> >> > But I'm getting: NullPointerException   clojure.zip/next
>> >> > (zip.clj:236)
>> >> >
>> >> > Any ideas?
>> >> >
>> >> > Thanks for help.
>> >> >
>> >> > --
>> >> > 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 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 opt

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Moe Aboulkheir
Hussein,

I'm not super comfortable with zippers, and probably wouldn't use them for
something like this - but I had a go.

If you define a zipper like this:

(z/zipper #(get % "children") #(get % "children") (fn [_ x ] x) {"children"
data})

Note the top-level vector is being wrapped in a map, so it resembles its
descendants.  And then define this utility function:

(defn edit-parents [editable? edit loc]
  (loop [loc loc]
(if (z/end? loc)
  (z/root loc)
  (if (editable? (z/node loc))
(recur (-> loc z/up (z/edit edit) z/up z/next))
(recur (z/next loc))

On Mon, Aug 24, 2015 at 10:40 AM, Hussein B.  wrote:

> Hi Moe,
>
> I have this structure:
>
> [{"a" {"b" 1 "c" 2}
>"children" [{"a" {"b" 3 "c" 4} "children" []}]}
>   {"a" {"b" 5 "c" 6} "children" []}
>   {"a" {"b" 7 "c" 8}
> "children" [{"a" {"b" 9 "c" 10} "children" []} {"a" {"b" 10 "c" 10} 
> "children" []}]}]
>
> That is only a sample, the actual data is bigger is properly more one or
> two nesting in the children attribute.
>
> I need to find a map by a criteria, say where b = 10 ({"a" {"b" 10 "c" 10}
> "children" []})
>
> Once it is found, I need to change its position within its parent. The
> parent is {"a" {"b" 7 "c" 8}
>
> I know that zippers are for editing data structures but I'm not sure how
> to do it.
>
> Thanks for help and time.
>
> On Friday, August 21, 2015 at 7:14:13 PM UTC+2, Moe Aboulkheir wrote:
>>
>> Hussein,
>>
>> I don't get an NPE passing that to traverse, but nothing much
>> interesting happens either.  The top-level data structure (and the
>> vectors within "children") aren't associative, and so don't pass the
>> branch? test (contains? % "children").
>>
>> You could certainly extend the zipper to cover both cases, but there
>> may well be a more compact way to accomplish your goal.  What do you
>> want to do with the piece of data?
>>
>> Take care,
>> Moe
>>
>> On Fri, Aug 21, 2015 at 5:57 PM, Hussein B.  wrote:
>> > Here is my zipper:
>> >
>> >  (z/zipper #(contains? % "children") #(get % "children")  (fn [_ c] c)
>> s)
>> >
>> > On Friday, August 21, 2015 at 6:49:25 PM UTC+2, Moe Aboulkheir wrote:
>> >>
>> >> Hussein,
>> >>
>> >> How are you constructing your zipper, before passing it to traverse?
>> >> Note that clojure.zip doesn't work on arbitrary data structures
>> >> without being given some information about how to descend
>> >> into/construct nodes, etc. - i.e. z/next expects a zipper, and your
>> >> data structure isn't a zipper, but an input to a zipper.  Unless
>> >> you've written a zipper you omitted from your post, zipping over maps,
>> >> in particular, may not be as convenient as you're imagining.
>> >> https://clojuredocs.org/clojure.zip/zipper has helpful examples in
>> it.
>> >>
>> >> Take care,
>> >> Moe
>> >>
>> >> On Fri, Aug 21, 2015 at 5:06 PM, Hussein B. 
>> wrote:
>> >> > Hi,
>> >> >
>> >> > I changed println to z/node , this time I'm getting:
>> >> >
>> >> > NullPointerException   clojure.zip/branch? (zip.clj:73)
>> >> >
>> >> > On Friday, August 21, 2015 at 5:56:10 PM UTC+2, Moe Aboulkheir
>> wrote:
>> >> >>
>> >> >> Hussein,
>> >> >>
>> >> >> The println inside (recur) will return nil.
>> >> >>
>> >> >> Take care,
>> >> >> Moe
>> >> >>
>> >> >> On Fri, Aug 21, 2015 at 4:35 PM, Hussein B. 
>> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > I have this structure:
>> >> >> >
>> >> >> > (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4
>> >> >> > "children"
>> >> >> > []}]} {"n" {"id" "b"} "d" 3 "children" []}])
>&

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Moe Aboulkheir
Went off half-cocked there.  The remainder:

(edit-parents
  #(= 10 (get-in % ["a" "b"]))
  #(update % "children" reverse),
  data-zipper)

Would have the effect of reversing the order of the children in each node
which possesses a child having a "b" attribute set to 10.  You could
probably express this much better with a library which allows locations in
data structures to be described in an XPath-like way (and your data
actually looks a lot like it is the result of parsing markup - see
clojure.data.xml and xml-zip if so) -- or there's probably some better
zipper approach that somebody who's really into zippers could come up with.

If you don't want to depend on an external library, and you lose your
enthusiasm for zippers, you could write a function which goes over the
structure and returns pairs of [[path] attributes], where path is a
sequence of keys/indices suitable for passing to update-in/assoc-in etc.,
and attributes is the value of the "a" key at each level.

In general, if there aren't multiple keys similar to "a" in each map (i.e.
it's always some value pointing to some map, and the value is not always
"a"), this kind of layout may be easier (e.g. to destructure)

{:tag "a" :attrs {:b 10} :children [...]}}

Take care,
Moe

-- 
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: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Moe Aboulkheir
Hussein,


On Mon, Aug 24, 2015 at 5:40 PM, Hussein B.  wrote:

> But now the updated children is using list notation, not vector. Is it ok or
> it is for displaying purposes?

The collection type is now different, as the example I gave uses
"reverse" as the transform, which is a generic sequence function - it
doesn't care that it was passed a vector.  It may not matter - it
depends on how you're using the sequences.  In this specific case,
modifying the transform in the example to #(update % "children" (comp
vec reverse)) will result in a vector, though there are more general
ways of doing this without baking the collection type in everywhere
(into (empty x) (reverse x)).

Take care,
Moe

-- 
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: map over a Map with conditional conj

2015-08-25 Thread Moe Aboulkheir
Sven,

To me, the keep version would be a lot more readable if it were creating a
literal map in a fn.

I think (for) is almost always the right thing.  It's not as fun to write,
but much easier to read:

(for [i (range 1 11)
  :let [id (keyword (str "answer_correct_" i))]
  :when (params id)]
  {:question_id q-id :user_id user-id :answer_id (params id)})

It's possible to shrink the reduce, but I prefer the above.

(reduce
 (fn [acc i]
   (let [id-correct (->> i (str "answer_correct_) keyword params)]
 (cond-> acc id-correct
   (conj {:question_id q-id :user_id user-id :answer_id id-correct}
 [] (range 1 11))

Take care,
Moe

On Tue, Aug 25, 2015 at 9:42 AM, Sven Richter 
wrote:

> Hi,
>
> I find myself repeating a certain pattern from time to time.
>
> I have a map like this:
> {:answer_correct_1 2 :answer_correct_3 4 :foo "bar"}
>
> There is a hidden index answer_correct_idx which might range from 1 to x.
> So, what I want is to "iterate" over the map and produce a vec of maps
> given some other fields like this:
> [{:id 123 :answer_correct_1 2} {:id 123 :answer_correct_3 4} ...]
>
> The pattern that I use then is reduce like this:
> (reduce
>   (fn [a b]
> (let [id-correct (keyword (str "answer_correct_" b))]
>   (if (id-correct params)
> (conj a {:question_id q-id :user_id user-id :answer_id (id-correct
> params)})
> a)))
>   [] (range 1 11))
>
> If have an if condition inside the reduce and then either conj or return
> the unchanged vec. This works. But I wondered if there is a higher
> abstraction for it and a very nice guy on slack proposed this:
>
> (let [->id (comp keyword (partial str "answer_correct_"))]
> (map
>   (partial hash-map :question_id q-id :user_id user-id :answer_id)
>   (keep
> (partial get params)
> (map ->id (range 1 11)
>
> It also works, but, regarding readibility I don't think it's easier to get
> (this is subjective of course).
>
> Are there other ways to achieve the same? Maybe something a bit more dense?
>
> Thanks,
> Sven
>
> --
> 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.
>

-- 
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: Fink-Nottle 0.1.0 (async SQS + SNS client)

2015-08-26 Thread Moe Aboulkheir
Matthias,

On Wed, Aug 26, 2015 at 9:31 AM, Matthias Diehn Ingesman
 wrote:

> That looks really useful, and as far as I can tell yours is the only library
> for SNS. I'm considering using your library in a production app, are there
> any pitfalls I should be aware of?

Nothing comes to mind - what are you planning on doing with it?  If
you're curious, there are integration tests for the underlying SNS
stuff here: 
https://github.com/nervous-systems/eulalie/blob/master/test/eulalie/test/sns.cljc

> From quickly browsing the sources, it is not clear to me what the functions
> declared by the defissuers macro return. From your blog post on SNS I'm
> guessing it's core.async channels for single-! functions, but a comment on
> the function would be nice. :-)

Yeah, the nonexistent docstrings aren't much help.  The consolation
prize is that there's documentation here:

https://github.com/nervous-systems/fink-nottle/wiki

which describes the API at a high level.   The more involved (i.e.
streaming response) functions are documented here:

https://github.com/nervous-systems/fink-nottle/wiki/sns.channeled

(Apologies if you've seen these)

Unfortunately, fink-nottle.sns is the only namespace not documented
function-by-function.  If "Pushing Messaging on EC2 ..." was the blog
post you saw, these other two also touch on SNS:

https://nervous.io/clojure/async/sns/eb/docker/2015/06/22/sns-beanstalk-chat/
https://nervous.io/clojure/clojurescript/node/aws/2015/08/09/chemtrails/

The latter lightly, but using the post 0.4.0 API.  The biggest change
from the earlier (outdated) posts is the credential-retrieval stuff,
which is described at
https://github.com/nervous-systems/eulalie/wiki/eulalie.creds

Take care,
Moe

-- 
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: My Zipper isn't deleting what I thought is going to delete

2015-08-27 Thread Moe Aboulkheir
Hussein,

Making this change to the zipper definition:

(z/zipper #(get % "children") #(get % "children") (fn [p c] (assoc p
"children" c)) {"children" z})

looks like it'll do the right thing here.

Take care,
Moe

On Thu, Aug 27, 2015 at 11:03 AM, Hussein B.  wrote:
> The modify function
>
> (defn modify [loc]
>  (-> loc z/remove))
>
>
> On Thursday, August 27, 2015 at 11:58:31 AM UTC+2, Hussein B. wrote:
>>
>> Hi,
>>
>> I'm trying to remove an element from nested data structure (nesting in
>> unknown, so I'm trying to come up with a generic solution:
>>
>>  (def z [
>>   {"a" {"b" 1 "c" 2}
>>"children" [{"a" {"b" 3 "c" 4}
>> "children" []}]}
>>   {"a" {"b" 5 "c" 6}
>>"children" []}
>>   {"a" {"b" 7 "c" 8}
>>"children" [{"a" {"b" 9 "c" 10}
>> "children" []}
>>{"a" {"b" 11 "c" 12}
>> "children" [{"a" {"b" 13 "c" 14} "children" []}
>> {"a" {"b" 15 "c" 16} "children" []}]}]}])
>>
>>
>>
>>
>> (def loz (z/zipper #(get % "children") #(get % "children") (fn [_ x ] x)
>> {"children" z}))
>>
>>
>>
>> (defn to-change? [loc]
>>  (if (= 11 (get-in (z/node loc) ["a" "b"]))
>>  true
>>  false))
>>
>>
>> (loop [loc loz]
>> (if (z/end? loc)
>>   (z/root loc)
>>   (recur (z/next
>>   (cond (to-change? loc)
>> (modify loc)
>> :else loc)
>>
>>
>> That gives a very wrong output:
>>
>> ({"a" {"b" 1, "c" 2}, "children" [{"a" {"b" 3, "c" 4}, "children" []}]}
>> {"a" {"b" 5, "c" 6}, "children" []} ({"a" {"b" 9, "c" 10}, "children" []}))
>>
>>
>>
>> Parent {"a" {"b" 7 "c" 8} is getting deleted which is wrong.
>>
>> What I'm doing wrong?
>>
>> Thanks for help and time.
>
> --
> 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.

-- 
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: My Zipper isn't deleting what I thought is going to delete

2015-08-27 Thread Moe Aboulkheir
Hussein,

The previous example (from your other thread) worked, as it happened
to involve removing the parents of nodes which match the predicate -
the make-node function I'd given you worked more or less by accident
in that one specific case, but not here.  Apologies if you lost time
due to my mistake.

To explain what's happening, let's look at the two interesting
functions we pass to clojure.zip/zipper - "children", which is
required to return a seq of a branch's children, and "make-node",
described as "a fn that, given an existing node and a seq of children,
returns a new branch node with the supplied children."   When you do
what amounts to (z/remove {a {b 11 c 12}}), clojure.zip needs some way
to accomplish that, without having a perfect understanding of exactly
how your data is structured.  When combined with the navigation
functions exposed by the library, children & make-node are enough to
get us there.

In this instance, calling z/remove on a grandchild of the root
triggers calls to make-node in order to reconstruct the parent ({b 7 c
8}) of the removed node with a new child seq not containing the node.
And, in turn, needs to be called on the removed node's grandparent
(the root - {children []}) -to reconstruct it with a node seq
containing the modified {b 7 c 8} node from the previous step.

The correct make-node implementation (assoc p "children" c) attaches
the sequence of children to the given parent node, in the place we
expect it.

Take care,
Moe

On Thu, Aug 27, 2015 at 1:59 PM, Hussein B.  wrote:
> Thanks a lot Moe for your help. I always appreciate your patience and
> skills.
>
> Would you explain why your zipper works in this case?
>
> Thanks again.
>
> On Thursday, August 27, 2015 at 12:11:14 PM UTC+2, Moe Aboulkheir wrote:
>>
>> Hussein,
>>
>> Making this change to the zipper definition:
>>
>> (z/zipper #(get % "children") #(get % "children") (fn [p c] (assoc p
>> "children" c)) {"children" z})
>>
>> looks like it'll do the right thing here.
>>
>> Take care,
>> Moe
>>
>> On Thu, Aug 27, 2015 at 11:03 AM, Hussein B.  wrote:
>> > The modify function
>> >
>> > (defn modify [loc]
>> >  (-> loc z/remove))
>> >
>> >
>> > On Thursday, August 27, 2015 at 11:58:31 AM UTC+2, Hussein B. wrote:
>> >>
>> >> Hi,
>> >>
>> >> I'm trying to remove an element from nested data structure (nesting in
>> >> unknown, so I'm trying to come up with a generic solution:
>> >>
>> >>  (def z [
>> >>   {"a" {"b" 1 "c" 2}
>> >>"children" [{"a" {"b" 3 "c" 4}
>> >> "children" []}]}
>> >>   {"a" {"b" 5 "c" 6}
>> >>"children" []}
>> >>   {"a" {"b" 7 "c" 8}
>> >>"children" [{"a" {"b" 9 "c" 10}
>> >> "children" []}
>> >>{"a" {"b" 11 "c" 12}
>> >> "children" [{"a" {"b" 13 "c" 14} "children" []}
>> >> {"a" {"b" 15 "c" 16} "children" []}]}]}])
>> >>
>> >>
>> >>
>> >>
>> >> (def loz (z/zipper #(get % "children") #(get % "children") (fn [_ x ]
>> >> x)
>> >> {"children" z}))
>> >>
>> >>
>> >>
>> >> (defn to-change? [loc]
>> >>  (if (= 11 (get-in (z/node loc) ["a" "b"]))
>> >>  true
>> >>  false))
>> >>
>> >>
>> >> (loop [loc loz]
>> >> (if (z/end? loc)
>> >>   (z/root loc)
>> >>   (recur (z/next
>> >>   (cond (to-change? loc)
>> >> (modify loc)
>> >> :else loc)
>> >>
>> >>
>> >> That gives a very wrong output:
>> >>
>> >> ({"a" {"b" 1, "c" 2}, "children" [{"a" {"b" 3, "c" 4}, "children" []}]}
>> >> {"a" {"b" 5, "c" 6}, "children" []} ({"a" {"b" 9, "c" 10},

Re: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali  wrote:

> This does work, but it's a bit of whammy.
> Anyone with suggestions for improvement?

It doesn't appear to work for simple cases (where the expressions
aren't function calls w/ additional arguments), e.g. (-> 1 inc)

Take care,
Moe

-- 
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: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali 
wrote:

>
> This does work, but it's a bit of whammy.
> Anyone with suggestions for improvement?
>

I went over this quickly, though it seems to work OK:

(defn threading [x first? forms]
  (reduce
   (fn [x form]
 (if (seq? form)
   (let [[op & args] form
 args (conj (cond-> args (not first?) vec) x)]
 (apply list op args))
   (list form x)))
   x forms))

(defmacro -> [x & forms]
  (threading x true forms))

(defmacro ->> [x & forms]
  (threading x false forms))

Take care,
Moe

-- 
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: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
The function is actually shorter without cond->: (conj (if first? args (vec
args)) x)

Take care,
Moe

On Fri, Aug 28, 2015 at 1:59 PM, Akhil Wali 
wrote:

> That's pretty neat!
> But then -> will be implemented using cond->, which is slightly off.
>
> On Friday, August 28, 2015 at 6:07:46 PM UTC+5:30, Moe Aboulkheir wrote:
>>
>> On Fri, Aug 28, 2015 at 12:37 PM, Akhil Wali 
>> wrote:
>>
>>>
>>> This does work, but it's a bit of whammy.
>>> Anyone with suggestions for improvement?
>>>
>>
>> I went over this quickly, though it seems to work OK:
>>
>> (defn threading [x first? forms]
>>   (reduce
>>(fn [x form]
>>  (if (seq? form)
>>(let [[op & args] form
>>  args (conj (cond-> args (not first?) vec) x)]
>>  (apply list op args))
>>(list form x)))
>>x forms))
>>
>> (defmacro -> [x & forms]
>>   (threading x true forms))
>>
>> (defmacro ->> [x & forms]
>>   (threading x false forms))
>>
>> Take care,
>> Moe
>>
>> --
> 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.
>

-- 
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: Generalizing -> and ->> forms

2015-08-28 Thread Moe Aboulkheir
On Fri, Aug 28, 2015 at 11:51 PM, Alan Thompson  wrote:

> I have become very partial to a simple adaptation of as-> from the Tupelo
> Core  library.  I almost always like
> to be explicit about the location the previous value, since either -> or
> ->> can sometimes be difficult if the threading forms don't always want the
> arg as the first or last parameter.
>

You've likely seen it, but https://github.com/rplevy/swiss-arrows has -<>
and -<>>, which capture "<>" for placement, and default to either the first
or last position when not present in an expression.  IIRC they don't
require wrapping all expressions in lists, a difference from it-> - e.g.
(-<> 1 inc (* 5) (/ 4 <> 3)).  I haven't used the library, but would expect
readability to be improved by allowing the placeholder to be omitted except
when needed.  I was/am an enthusiast of the "cut" macro from SRFI-26 (which
uses <>) - I think cut-> and cut->> scan much better than -<>>.


>   Copying the pattern of Groovy/Ruby, I almost always name the threading
> placeholder "it".  Since I don't like repetition (& I would argue that the
> as-> form has its params backwards!)
>

The parameter ordering seems awkward, but enables embedding within
thread-first.  The example above becomes (-> 1 inc (* 5) (as-> it (/ 4 it
3)))

(2/15, in case you were curious)

Take care,
Moe

-- 
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: book [clojure programming] confuse

2015-09-08 Thread Moe Aboulkheir
Johnny,

On Tue, Sep 8, 2015 at 11:32 AM, Johnny Wong 
wrote:
>
> why " deliver a @b is going to fail " ?  1 and 2  are just two
> independent threads , "deliver a 42" will unblock thread 2 , and then
> thread 1 will be unblocked .
>
Thread 1 is waiting on delivering a result to "a", though, which has
already happened with the outer (deliver a 42) - one result per promise.

> what is the pointer of function sync-fn ? what is the execution sequence
> of  functions such as sync-fn,call-servervice, and callback-fn ?
>  statement "((sync-fn call-service) 8 7) ", where is the callback-fn
> parameter ?
>
After the apply, call-service ends up being invoked as (call-service 8 7
#(deliver result %&)) - the callback-fn is that final anonymous function
which delivers the "result" promise a sequence of its arguments (%&).
 sync-fn is geared towards multiple invocations - a named example may be
very slightly clearer:

(def call-service-sync (sync-fn call-service))
(call-service-sync 8 7) ;; => (15 1)

The sequence is:
 - Invoke (sync-fn call-service), which returns a wrapper around
call-service, using a callback-fn which is internal to the wrapper
(consumers of sync-fn are trying to ignore callback-fn)
 - Invoke the returned function/wrapper with the arguments to the wrapped
(call-service) function (8 7), minus callback-fn
 - The wrapper forwards these arguments to call-service, plus a callback-fn
which delivers its arguments to a promise
 - The wrapper blocks on dereferencing the promise
 - The outermost caller receives the value delivered to the promise

Take care,
Moe

-- 
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: Why (memoize (fn [_#] (gensym "node")) in rhizome?

2015-09-12 Thread Moe Aboulkheir
On Sat, Sep 12, 2015 at 1:58 AM, Sam Ritchie  wrote:

> Seems like a good use of “delay”, yeah? Slightly different calling
> semantics, of course, but still:
>
> user> (def f (delay (gensym "node")))
> #'user/f
> user> @f
> node3330
> user> @f
> node3330
>

The original code wanted different behaviour - a distinct gensym for each
distinct input.  Memoize takes the ignored argument into account when
associating the inputs with outputs.

user> (def mapped-gensym (memoize (fn [_] (gensym "alias"

user> (mapped-gensym "HI")
alias29367
user> (mapped-gensym "HI")
alias29367
user> (mapped-gensym "NOT HI")
alias29372

Take care,
Moe

-- 
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: Testing concurrency/async features with clojure.test

2015-09-26 Thread Moe Aboulkheir
Jonathon,

Blocking at read time, within the test (via 
wrote:

> If I have code in a go block or a future call, what is the best way to
> automate test coverage of that code?
>
> --
> 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.
>

-- 
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: 4clojure count problem

2015-10-03 Thread Moe Aboulkheir
Roelof,

Unless supplied with an initial value, reduce will use the first value from
the collection you supply - every sequence which doesn't start with "1"
will give you the wrong answer.

Take care,
Moe

On Sat, Oct 3, 2015 at 9:40 PM, Roelof Wobben 
wrote:

> Hello,
>
> I have to make a function which counts a collection without using count.
>
> So I came up with this :
>
> (fn [coll]  (reduce (fn [counter _ ] (inc counter)) coll)))
>
> it works well with coll is [ 1 2 3]
>
> but it fails with "Hello World"
>
> How can I improve my code to work in both cases.
>
> Please , do not only give the answer but rather explain how I can make
> this work.
> So I learn a lot and not do only a copy/paste.
>
> Roelof
>
> --
> 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.
>

-- 
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: 4clojure count problem

2015-10-04 Thread Moe Aboulkheir
Roelof,

The function you're passing to reduce still wants to accept two arguments.
See the documentation: https://clojuredocs.org/clojure.core/reduce

Take care,
Moe

On Sun, Oct 4, 2015 at 8:40 AM, Roelof Wobben 
wrote:

> Oke, then I hve to find out where to put the initial value.
>
> These two do not work :
>
> (reduce (fn [counter] (inc counter)) 0  [1,2,3])
> (reduce (fn [counter] (inc counter) 0 )   [1,2,3])
>
> Op zaterdag 3 oktober 2015 23:34:20 UTC+2 schreef Moe Aboulkheir:
>>
>> Roelof,
>>
>> Unless supplied with an initial value, reduce will use the first value
>> from the collection you supply - every sequence which doesn't start with
>> "1" will give you the wrong answer.
>>
>> Take care,
>> Moe
>>
>> On Sat, Oct 3, 2015 at 9:40 PM, Roelof Wobben 
>> wrote:
>>
>>> Hello,
>>>
>>> I have to make a function which counts a collection without using count.
>>>
>>> So I came up with this :
>>>
>>> (fn [coll]  (reduce (fn [counter _ ] (inc counter)) coll)))
>>>
>>> it works well with coll is [ 1 2 3]
>>>
>>> but it fails with "Hello World"
>>>
>>> How can I improve my code to work in both cases.
>>>
>>> Please , do not only give the answer but rather explain how I can make
>>> this work.
>>> So I learn a lot and not do only a copy/paste.
>>>
>>> Roelof
>>>
>>> --
>>> 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.
>

-- 
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: palingdrome problem (4 clojure)

2015-10-07 Thread Moe Aboulkheir
Roelof,

Something like this:

(defn palindrome [x]
  (if (string? x)
(clojure.string/reverse x)
(into (empty x) (reverse x

Alternatively, you may want to consider explicitly using seq on your inputs
when you get them, and using that of the basis of comparison & input to
reverse.  If you don't actually care about the concrete sequence type (i.e.
you only want sensible equality semantics after reversing something),
dropping it as soon as possible may be a better strategy.

Take care,
Moe

On Wed, Oct 7, 2015 at 6:51 PM, Roelof Wobben 
wrote:

> Hello,
>
> I try to solve a problem for 4clojure where I have to make a palingdrome
> detector.
>
> So for trying I did this :
>
> (ns fourclojure.core
>   (:gen-class))
>
>
> (defn palingdrome [string]
>   ( reverse string))
>
> (apply str (palingdrome '( 1 2 3) ))  '321'
> (apply str (palingdrome "Roelof" )) "foleoR"
>
> (defn palingdrome2 [string]
>   ( reverse string))
>
> (palingdrome2 '( 1 2 3) )  ( 3 2 1 )
> (palingdrome2  "Roelof" )  (\f \o \l \e \o \R)
>
> So it works for a map or for a string.
>
> Is there a way I can make it work for both ?
>
> Roelof
>
>
>
> --
> 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.
>

-- 
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: Trying to understand Clojure/Java concurrency performance?

2015-10-07 Thread Moe Aboulkheir
Nick,

(There's a lot to understand about those benchmarks, and I haven't really
spent time with them, or wrk2, so feel free to ignore)

On Wed, Oct 7, 2015 at 2:13 AM, Nick Pavlica  wrote:

> After looking at the numbers in the benchmark, I was a little disappointed
> to see that they were only serving 60K connections
>

I don't see that in those results.  There are definitely a lot of numbers
bigger than 60k here:
https://github.com/ptaoussanis/clojure-web-server-benchmarks/blob/master/results/60k-keepalive/20150217-13-18-table.txt
- and in the http-kit link you included.


> as compared to other solutions like Erlang which seem to be capable of
> 1-2+ million connections on similar hardware.
>

Do you have a reference for that outside of the video you linked?  I
haven't watched it, but the description mentions "tuning and patching the
BEAM emulator and FreeBSD kernel".

Take care,
Moe
"60k ought to be enough for anybody"

-- 
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: palingdrome problem (4 clojure)

2015-10-07 Thread Moe Aboulkheir
Roelof,

As you noted, reverse doesn't preserve the variety of collection which was
passed in - it returns a sequence.  (into A B) appends the items in B onto
A, and will return a collection of the same type as A. (empty A) returns a
collection of the same type as A, with no items in it.  So with (into
(empty A) (reverse A)) we're saying "give me a sequence containing the
items in A in reverse order, then conjoin them onto an empty collection
having the same type as A".

References:
-  https://clojuredocs.org/clojure.core/empty
-  https://clojuredocs.org/clojure.core/into

Take care,
Moe

On Wed, Oct 7, 2015 at 7:33 PM, Roelof Wobben 
wrote:

> Thanks , that did the trick.
>
> Apperent; string/reverse works different from reverse
>
> One question : what does into do  and does (empty x) means if x is empty
> or do you make a empty copy of x.
>
> Roelof
>
>
> Op woensdag 7 oktober 2015 20:07:00 UTC+2 schreef Moe Aboulkheir:
>>
>> Roelof,
>>
>> Something like this:
>>
>> (defn palindrome [x]
>>   (if (string? x)
>> (clojure.string/reverse x)
>> (into (empty x) (reverse x
>>
>> Alternatively, you may want to consider explicitly using seq on your
>> inputs when you get them, and using that of the basis of comparison & input
>> to reverse.  If you don't actually care about the concrete sequence type
>> (i.e. you only want sensible equality semantics after reversing something),
>> dropping it as soon as possible may be a better strategy.
>>
>> Take care,
>> Moe
>>
>> On Wed, Oct 7, 2015 at 6:51 PM, Roelof Wobben 
>> wrote:
>>
>>> Hello,
>>>
>>> I try to solve a problem for 4clojure where I have to make a palingdrome
>>> detector.
>>>
>>> So for trying I did this :
>>>
>>> (ns fourclojure.core
>>>   (:gen-class))
>>>
>>>
>>> (defn palingdrome [string]
>>>   ( reverse string))
>>>
>>> (apply str (palingdrome '( 1 2 3) ))  '321'
>>> (apply str (palingdrome "Roelof" )) "foleoR"
>>>
>>> (defn palingdrome2 [string]
>>>   ( reverse string))
>>>
>>> (palingdrome2 '( 1 2 3) )  ( 3 2 1 )
>>> (palingdrome2  "Roelof" )  (\f \o \l \e \o \R)
>>>
>>> So it works for a map or for a string.
>>>
>>> Is there a way I can make it work for both ?
>>>
>>> Roelof
>>>
>>>
>>>
>>> --
>>> 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.
>

-- 
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: Trying to understand Clojure/Java concurrency performance?

2015-10-07 Thread Moe Aboulkheir
On Wed, Oct 7, 2015 at 8:40 PM, Nick Pavlica  wrote:

>
>   I'm not currently planning on 1-2 million connections on a single server
> at the moment.  I really wish I had those problems, but I would like to
> count on being able to achieve 100-200K on a single reasonably sized
> server.  Even if I could achieve 1-2 million connections on a server, I'm
> not sure it's the best idea to do so.  It seems like allot of coupling of
> the service to a single endpoint.  I sounds like Elxir/Erlang+x, or
> possibly Go, may be better at handling the concurrency components of my app
> until the JVM ships with a GC that's better suited to this kind of work.  I
> know that they are going to ship a new GC in 1.9, but I don't know if it
> will help out.
>

Whether GC is going to be a problem for you for other reasons, your post
contained a link to a benchmark which surpassed the number you quoted by an
order of magnitude - 600,000.  Disregarding whether http-kit is a
sensible/safe library choice, its benchmark is readily understandable.  The
github webserver benchmarks also contain many numbers above 200,000 qps,
for a variety of other webservers - right?

http://www.http-kit.org/600k-concurrent-connection-http-kit.html

I don't think the problem exists as you're describing it.

Take care,
Moe

-- 
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: Trying to understand Clojure/Java concurrency performance?

2015-10-07 Thread Moe Aboulkheir
On Wed, Oct 7, 2015 at 7:47 PM, Moe Aboulkheir  wrote:

> Nick,
>
> (There's a lot to understand about those benchmarks, and I haven't really
> spent time with them, or wrk2, so feel free to ignore)
>
> On Wed, Oct 7, 2015 at 2:13 AM, Nick Pavlica  wrote:
>
>> After looking at the numbers in the benchmark, I was a little
>> disappointed to see that they were only serving 60K connections
>>
>
> I don't see that in those results.  There are definitely a lot of numbers
> bigger than 60k here:
> https://github.com/ptaoussanis/clojure-web-server-benchmarks/blob/master/results/60k-keepalive/20150217-13-18-table.txt
> - and in the http-kit link you included.
>

This was a mistake on my part - the tests are bound at 60k *connections.  *The
numbers I am talking about here are queries/second.

Take care,
Moe

-- 
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: Examples of core.async usage in production?

2015-10-26 Thread Moe Aboulkheir
I've used core.async in production a bunch with AWS.

On Mon, Oct 26, 2015 at 7:24 PM, Robin Heggelund Hansen
 wrote: There are
> postgres.async for async db, and fink-nottle for sending sms/push
> notifications/email etc. using core.async.

In addition to those services (i.e. RDS, SNS, SQS), there are
core.async-friendly libraries you can use with Redis/ElastiCache
(redis-async), Lambda & Dynamo.  So you shouldn't have to rewrite too
much bytecode if you're interested running on EC2.  I'm sure there are
plenty of alternatives for other environments.

Take care,
Moe

-- 
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: channels 1:1, callbacks many:many ?

2015-11-25 Thread Moe Aboulkheir
On Wed, Nov 25, 2015 at 6:42 AM,  wrote:
>
> So how does one use channels if one is accustomed to registering several
> callbacks to a single event? Do you have an intermediary which takes one
> value from the source channel and then puts the value on as many other
> channels as there are subscribers?
>

There is a construct specifically for this - mult/tap (create a mult of the
source channel/s, tap the relevant ones onto a channel per listener).  The
pub/sub functions can also be used, if there is more complicated
dispatching logic.  Further, if the events aren't coming in streams (i.e.
one event per channel), the most recent release of core.async includes a
promise-chan function, which supports single write, multiple read.  mult
sounds like the right way to go, though.


> And as for hooking up a single function to more than one channel, is that
> where you'd use alts! ? But does that mean you have to know all the
> channels you're interested in vs having the freedom to take the same
> function and have it take from any additional channel?
>

If each the consumers has their own channel, you don't need to know within
the consumer about the details of where the events are coming from.

Take care,
Moe

-- 
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: Questions about channels

2016-01-06 Thread Moe Aboulkheir
On Wed, Jan 6, 2016 at 9:48 PM,  wrote:

> I'm using ClojureScript and nodejs and I'd like to spawn a child process
> and deal with the result (stderr, stdout, exit code).
>
> Here's a short gist
>  showing an
> approach that spawns the process and routes all output to a channel. My
> goal is to allow the calling code to be written in a straightforward manner
> instead of having a lot of callbacks.
>

I made some changes which you may find useful:
https://gist.github.com/moea/6871166bb1fdb462efe4
 - Close channel rather than :exit message
 - Have "exec" add timeout functionality only - the accumulation can be
done via async/into.
 - Modify "exec" and "exec-chan" to take in optional channels, to enable
higher order-transformations.  This complicates the implementation, but is
likely to be useful if you plan on using the code.

I haven't run it or anything, hope it's helpful.

Take care,
Moe

-- 
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: Questions about channels

2016-01-06 Thread Moe Aboulkheir
I just noticed you were actually using the exit code.  In that case, you
probably want something like

(.on p "close" (fn [exit] (put! c [:exit exit]) (a/close! c))

Take care,
Moe

-- 
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] kvlt 0.1.0: JVM/Node/browser HTTP client

2016-02-27 Thread Moe Aboulkheir
kvlt is an HTTP client library which runs on the JVM, Node & in browser,
including support for server-sent events and websockets.

Github project page 
Documentation & examples 

*Motivation*: while there exist dual-targeted HTTP clients, Node
compatibility doesn't appear to be a concern.  Further, related
functionality - websockets & server-sent events - isn't available uniformly
across clj+cljs, and the Clojurescript implementations are tied to APIs
which don't exist on Node out of the box.

kvlt uses Aleph  on the JVM, and Google
Closure's XHR abstraction
 in
Clojurescript, with a third-party Node module providing an XHR
implementation when running off-browser.  The same pattern is used for
websockets/SSE (emulating browser APIs with third-party modules).

Responses can be consumed using either promises (via promesa
), or core.async, with the latter being
used to represent websocket connections/SSE streams.

Take care,
Moe

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