Re: Understanding GraalVM and Clojure

2018-04-29 Thread Khalid Jebbari
I've read it, it's really interesting. Alex Miller mentioned on Twitter
that they'll work on removing some limitations over time. @Alex, can you
confirm and expand a bit more ?

Le sam. 28 avr. 2018 à 23:14, Nathan Fisher  a
écrit :

> Another interesting post on Clojure and Graal
>
> https://www.innoq.com/en/blog/native-clojure-and-graalvm/
> On Sat, Apr 28, 2018 at 10:01 AM, Khalid Jebbari 
> wrote:
>
>> Thank you for the link.
>>
>> Le sam. 28 avr. 2018 à 00:35, Egg Syntax  a écrit :
>>
>>> Karin Meier has done some experimentation using Clojure on GraalVM to
>>> call R and Python, and has a blog post
>>> 
>>>  and repo
>>> 
>>>  that
>>> you may find interesting.
>>>
>>>
>>> On Thursday, April 19, 2018 at 6:00:14 AM UTC-4, Khalid Jebbari wrote:

 Hello,

 Oracle has just announced GraalVM 1.0 release candidate:
 https://blogs.oracle.com/developers/announcing-graalvm

 It mentions a few JVM-based language but not Clojure (maybe just
 because of popularity).
 - Does it mean Clojure is not "compatible" with GraalVM ?
 - Does it mean Clojure needs to be reimplemented in terms of GraalVM's
 Truffle framework ?
 - Does it mean Clojure can be run as a native binary with fast startup
 time and minimized memory footprint ?

 If someone with some knowledge could explain to me the relationships
 between Clojure and GraalVM ? Bonus points if Alex Miller answers and share
 the plans, if any, about their integration/interaction.

 Thanks a lot in advance. really curious to understand more.

>>> --
>>> 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 a topic in the
>>> Google Groups "Clojure" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/clojure/iBY6hwqqp5c/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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.
>>
> --
> - sent from my mobile
>
> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/iBY6hwqqp5c/unsubscribe.
> To unsubscribe from this group and all its topics, 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.


Key must be integer error

2018-04-29 Thread Renata Soares
Hi,

How can I update the atom accounts in the field of operations?

(def accounts (atom [{:id "7512a15b-0770-4a9b-a74b-389374b46461", :balance 
0.0, :operations nil, :blocked false} 
  {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994", :balance 0.0, :operations 
nil, :blocked false} 
  {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9", :balance 0.0, :operations 
nil, :blocked false} 
  {:id "2dc20615-f1f7-4637-9602-ae9494689166", :balance 0.0, :operations 
nil, :blocked false}
  {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd", :balance 0.0, :operations 
nil, :blocked false}]))

I tried this:

(swap! accounts (fn [x] (update-in x [:operations]  #(if (= (:id %) 
account-id) new-value

and returns "key must be integer" because of [:operations]

Thanks.

-- 
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: Key must be integer error

2018-04-29 Thread Axel Katerbau
Hi Renata,

> How can I update the atom accounts in the field of operations?
> 
> (def accounts (atom [{:id "7512a15b-0770-4a9b-a74b-389374b46461", :balance 
> 0.0, :operations nil, :blocked false} 
>   {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994", :balance 0.0, :operations nil, 
> :blocked false} 
>   {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9", :balance 0.0, :operations nil, 
> :blocked false} 
>   {:id "2dc20615-f1f7-4637-9602-ae9494689166", :balance 0.0, :operations nil, 
> :blocked false}
>   {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd", :balance 0.0, :operations nil, 
> :blocked false}]))
> 
> I tried this:
> 
> (swap! accounts (fn [x] (update-in x [:operations]  #(if (= (:id %) 
> account-id) new-value
> 
> and returns "key must be integer" because of [:operations]

the atom hold and array of accounts. In swap! you are trying to access one (!) 
value in a key-path [:operations] but access to elements of an array is not 
valid via a key-path but by using indexes.

What you are seemingly trying to do is to map over the contents of the array in 
the atom which is not what you coded here.

- Axel

-- 
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: Key must be integer error

2018-04-29 Thread Tim Visher
Hi Renata,

```
user=> (clojure.pprint/pprint (swap! accounts #(map (fn [a] (if (= (:id a)
"3136860d-ab7f-4814-8f3b-2d18048db9b9") (assoc a :operations :foo) a)) %)))
({:id "7512a15b-0770-4a9b-a74b-389374b46461",
  :balance 0.0,
  :operations nil,
  :blocked false}
 {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994",
  :balance 0.0,
  :operations nil,
  :blocked false}
 {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9",
  :balance 0.0,
  :operations :foo,
  :blocked false}
 {:id "2dc20615-f1f7-4637-9602-ae9494689166",
  :balance 0.0,
  :operations nil,
  :blocked false}
 {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd",
  :balance 0.0,
  :operations nil,
  :blocked false})
```

Your swapping function will have to be map since you're trying to update
some matching component of a vector. Then you can test if the current item
is your target `(if (= (:id a) …)` at which point you can change it `(assoc
a :operations …)`. Otherwise, you need to return it so you don't lose any
data.

Note that in this case it might make some sense to transform your data to a
map since that allows for simple key lookups and would allow for the use of
`assoc-in`:

```
user=> (clojure.pprint/pprint @accounts)
{"7512a15b-0770-4a9b-a74b-389374b46461"
 {:id "7512a15b-0770-4a9b-a74b-389374b46461",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "7446cfe6-882c-4f25-bad1-5ed8c9aea994"
 {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "3136860d-ab7f-4814-8f3b-2d18048db9b9"
 {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "2dc20615-f1f7-4637-9602-ae9494689166"
 {:id "2dc20615-f1f7-4637-9602-ae9494689166",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "c6dccf4a-535c-4eba-8cfc-0554408de8bd"
 {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd",
  :balance 0.0,
  :operations nil,
  :blocked false}}
nil
user=> (clojure.pprint/pprint (swap! accounts #(assoc-in %
["3136860d-ab7f-4814-8f3b-2d18048db9b9" :operations] :bar)))
{"7512a15b-0770-4a9b-a74b-389374b46461"
 {:id "7512a15b-0770-4a9b-a74b-389374b46461",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "7446cfe6-882c-4f25-bad1-5ed8c9aea994"
 {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "3136860d-ab7f-4814-8f3b-2d18048db9b9"
 {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9",
  :balance 0.0,
  :operations :bar,
  :blocked false},
 "2dc20615-f1f7-4637-9602-ae9494689166"
 {:id "2dc20615-f1f7-4637-9602-ae9494689166",
  :balance 0.0,
  :operations nil,
  :blocked false},
 "c6dccf4a-535c-4eba-8cfc-0554408de8bd"
 {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd",
  :balance 0.0,
  :operations nil,
  :blocked false}}
```


On Sun, Apr 29, 2018 at 10:12 AM, Axel Katerbau  wrote:

> Hi Renata,
>
> > How can I update the atom accounts in the field of operations?
> >
> > (def accounts (atom [{:id "7512a15b-0770-4a9b-a74b-389374b46461",
> :balance 0.0, :operations nil, :blocked false}
> >   {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994", :balance 0.0,
> :operations nil, :blocked false}
> >   {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9", :balance 0.0,
> :operations nil, :blocked false}
> >   {:id "2dc20615-f1f7-4637-9602-ae9494689166", :balance 0.0,
> :operations nil, :blocked false}
> >   {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd", :balance 0.0,
> :operations nil, :blocked false}]))
> >
> > I tried this:
> >
> > (swap! accounts (fn [x] (update-in x [:operations]  #(if (= (:id %)
> account-id) new-value
> >
> > and returns "key must be integer" because of [:operations]
>
> the atom hold and array of accounts. In swap! you are trying to access one
> (!) value in a key-path [:operations] but access to elements of an array is
> not valid via a key-path but by using indexes.
>
> What you are seemingly trying to do is to map over the contents of the
> array in the atom which is not what you coded here.
>
> - Axel
>
> --
> 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 th

Re: Clojure/flutter

2018-04-29 Thread Estevo U. C. Castro
This was apropos two points made in this thread:

- Clojure needing X from the runtime; my point here is that some Schemes 
may provide the things you'd demand from a native implementation: fast 
startup time, smallish binaries, etc., and even tail call optimization as a 
bonus, but also the drawbacks of a native implementation: mainly that you'd 
start with few libraries in comparison with the Java and JS implementations.

- A question about what would it take to make something like Clojurescript 
over again.  This implementation illustrates that you can reuse a lot of 
the work that was put into Clojurescript for new implementations.

IIRC this particular project petered out basically because the author 
didn't perceive much interest in this kind of thing from the Clojure 
community.  If that ever changes this project or something similar could be 
a good starting point for native-ish implementations.

domingo, 29 de Abril de 2018 às 03:56:27 UTC+2, Gregg Reynolds escreveu:
>
>
>
> On Sat, Apr 28, 2018 at 6:50 PM, Estevo U. C. Castro  > wrote:
>
>> Just in case you hadn't heard of this:
>>
>> https://github.com/takeoutweight/clojure-scheme
>>
>> Thanks. Alas, most recent update seems to be 5 years ago. :(
>
> I know there have been some efforts along these lines but AFAIK they have 
> all petered out.  Anybody have the latest dope? 
>

-- 
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: [Q] Transparently call functions remotely via nREPL?

2018-04-29 Thread henrik42
Hi,

I ended up using https://github.com/technomancy/robert-hooke -- like this:

,,,(:require [clojure.tools.nrepl :refer :all])

(defn remote-eval [conn code]
  (let [{:keys [value err]} (-> (client conn 1000)
(message {:op :eval
  :code code})
(combine-responses))]
(if err (throw (RuntimeException. err))
(read-string (last value)

(defn remote-wrapper [conn-fn v]
  (fn [_ & args]
(remote-eval
 (conn-fn)
 (format "(apply %s/%s [%s])"
 (-> v meta :ns) (-> v meta :name)
 (apply pr-str args)

(defn -main [& args]
  (let [conn-fn ,,,]
(hooke/add-hook #'a-fn
(remote-wrapper conn-fn #'a-fn))
(hooke/add-hook #'b-fn
(remote-wrapper conn-fn #'b-fn))
,,,


Cheers Henrik

-- 
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/flutter

2018-04-29 Thread Didier
Honestly, I doubt any project will have more backing then Graal's native image.

So I think its the best shot at Clojure native we've ever had, and probably the 
ideal one at that, since it'll boast all existing libraries.

What could help is to then look at compiler options for Clojure that could help 
leverage native image, and lower the restrictions imposed by native image.

-- 
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/flutter

2018-04-29 Thread Gregg Reynolds
On Sun, Apr 29, 2018, 5:24 PM Didier  wrote:

> Honestly, I doubt any project will have more backing then Graal's native
> image.
>

Looking at Graal.  Indistinguishable from magic AFAIK.

>
> So I think its the best shot at Clojure native we've ever had, and
> probably the ideal one at that, since it'll boast all existing libraries.
>
> What could help is to then look at compiler options for Clojure that could
> help leverage native image, and lower the restrictions imposed by native
> image.
>
> --
> 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] Stu: a lib for understanding CLJS builds via CI

2018-04-29 Thread Steve Buikhuizen
It's the first version so lots more work to do:

https://github.com/stevebuik/Stu

It's also a good example of how to use "react-faux-dom" with D3 in CLJS. 
It's a useful technique.

Comments and contributions are welcome.

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