Re: Webassembly as a Clojure target platform

2018-07-26 Thread Bo Yao
Not true.Wasm is a a kind of assembly and it's browser runtime: 
https://webassembly.github.io/spec/. The emscripten project is doing 
compile c/c++ to wasm. There's a another team working on rust to wasm 
compiler and toolchains: https://webassembly.github.io/spec/

On Friday, September 15, 2017 at 3:08:18 AM UTC-4, Nur Azhar wrote:
>
> Correct me if I am wrong, webassembly is just a compiler currently only 
> supports C,C++ and rust and we might be able to compile clojure to 
> webassembly in the far future?
>
> On Thursday, September 14, 2017 at 5:03:25 AM UTC+8, Hlöðver Sigurðsson 
> wrote:
>>
>> https://github.com/AssemblyScript/assemblyscript
>>
>>
>> Looks like the Typescript people are attempting exactly this.
>>
>> On Monday, 4 April 2016 08:50:06 UTC+2, JvJ wrote:
>>>
>>> Is there any plan in the future to have clojure (or some dialect of 
>>> clojure) compile to webassembly?  I can't say for sure if it is the "next 
>>> big thing" for the web, but it is a very interesting concept.
>>>
>>> I suppose that, if Java bytecode could cross-compile to Webassembly, we 
>>> would essentially get this for free, but I'm not sure if that will happen.
>>>
>>

-- 
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: Webassembly as a Clojure target platform

2018-07-26 Thread Nathan Fisher
Think Rust and Golang both have the ability to target WASM now too. I'm not
sure how well Java Byte-Code to WASM would work in practise. Found this
project that seems able to transpile from Java ByteCode to JS/WASM;

http://teavm.org/

On Thu, 26 Jul 2018 at 12:34 Bo Yao  wrote:

> Not true.Wasm is a a kind of assembly and it's browser runtime:
> https://webassembly.github.io/spec/. The emscripten project is doing
> compile c/c++ to wasm. There's a another team working on rust to wasm
> compiler and toolchains: https://webassembly.github.io/spec/
>
> On Friday, September 15, 2017 at 3:08:18 AM UTC-4, Nur Azhar wrote:
>>
>> Correct me if I am wrong, webassembly is just a compiler currently only
>> supports C,C++ and rust and we might be able to compile clojure to
>> webassembly in the far future?
>>
>> On Thursday, September 14, 2017 at 5:03:25 AM UTC+8, Hlöðver Sigurðsson
>> wrote:
>>>
>>> https://github.com/AssemblyScript/assemblyscript
>>>
>>>
>>> Looks like the Typescript people are attempting exactly this.
>>>
>>> On Monday, 4 April 2016 08:50:06 UTC+2, JvJ wrote:

 Is there any plan in the future to have clojure (or some dialect of
 clojure) compile to webassembly?  I can't say for sure if it is the "next
 big thing" for the web, but it is a very interesting concept.

 I suppose that, if Java bytecode could cross-compile to Webassembly, we
 would essentially get this for free, but I'm not sure if that will happen.

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


[JOB] Senior Full-Stack Developer | Sparrho | London (Shoreditch) | On-site, Perm

2018-07-26 Thread Sybil Wong
Hi all, 

We're a small team (~12 full-time) with a big goal to transform how science 
is done and communicated to the world - check out sparrho.com and 
medium.com/sparrho.

I'm looking for an amazing all-round senior dev to join our team in London 
(Shoreditch). Someone who can take a project all the way from discussing 
requirements with the product team to managing and monitoring the 
production infrastructure. Skill and flexibility are key to this role.

Our technology is the foundation of everything we do, and we’ll use 
whatever’s available to give users a response faster than they can blink, 
even across 60 million+ pieces of content. Our core stack is 
Clojure/Clojurescript—React on the front end, GraphQL on the back end—with 
PostgreSQL and ElasticSearch to keep our data front and center, and Docker 
and Terraform to keep everything on AWS running smoothly.

Read more and apply here: about.sparrho.com/careers.htm#dev

Or email me: sybil at sparrho.com

Cheers,
Sybil

-- 
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: Webassembly as a Clojure target platform

2018-07-26 Thread Gerard Klijs
Kotlin native can also target wasm. But I don't know enough of it to know if 
it's usefull for the clojure story. Since there is very little you can do with 
wasm, it's highly dependent on interacting with JavaScript. It's possible some 
computational heavy stuff might better be done in wasm then JavaScript. But as 
wasm doesn't have baked in garbage collection, and for closure(script) we 
depend on the host for garbage collection, it will probably be a lot of work to 
pull this off.

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


removing trailing zeros in floating point formatting

2018-07-26 Thread Brian Craft
Probably more of a java question, but I'm finding that floating point 
formats with (format) are inflating data sizes enormously with meaningless 
trailing zeros, because the underlying java conversion methods don't work 
as they do on other platforms.

E.g., in C
printf("%.6g %.6g %.6g %.6g\n", 0.01, 100.1, 10.0, 100.0)

gives
1e-06 100 10 1e+06

in python:

>>> "%.6g %.6g %.6g %.6g" % (0.01, 100.1, 10.0, 100.0)
'1e-06 100 10 1e+06'



while clojure will produce this:

> (format "%.6g %.6g %.6g %.6g" 0.01, 100.1, 10.0, 100.0)
"1.0e-06 100.000 10 1.0e+06"

The desired behavior is to set the max significant digits & get the minimal 
decimal representation. I've been through docs for Formatter, NumberFormat, 
and others, but can't find anything that both 1) supports setting 
significant digits (vs. fractional digits), and 2) doesn't pad meaningless 
zeros on the end.

Is there a standard solution?

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


refactor clojure.core/destructure

2018-07-26 Thread 冯忠孝


(defn gen-pvec [pb]
  (fn [bvec b val]
(let [gvec (gensym "vec__")
  gseq (gensym "seq__")
  gfirst (gensym "first__")
  has-rest (some #{'&} b)]
  (loop [ret (let [ret (conj bvec gvec val)]
   (if has-rest
 (conj ret gseq (list `seq gvec))
 ret))
 n 0
 bs b
 seen-rest? false]
(if (seq bs)
  (let [firstb (first bs)]
(cond
  (= firstb '&) (recur (pb ret (second bs) gseq)
   n
   (nnext bs)
   true)
  (= firstb :as) (pb ret (second bs) gvec)
  :else (if seen-rest?
  (throw (new Exception "Unsupported binding form, only :as 
can follow & parameter"))
  (recur (pb (if has-rest
   (conj ret
 gfirst `(first ~gseq)
 gseq `(next ~gseq))
   ret)
 firstb
 (if has-rest
   gfirst
   (list `nth gvec n nil)))
 (inc n)
 (next bs)
 seen-rest?
  ret
  )
(defn gen-bes [b]
  (let [transforms
(reduce1
  (fn [transforms mk]
(if (keyword? mk)
  (let [mkns (namespace mk)
mkn (name mk)]
(cond (= mkn "keys") (assoc transforms mk #(keyword (or mkns 
(namespace %)) (name %)))
  (= mkn "syms") (assoc transforms mk #(list `quote (symbol 
(or mkns (namespace %)) (name %
  (= mkn "strs") (assoc transforms mk str)
  :else transforms))
  transforms))
  {}
  (keys b))]
(reduce1
  (fn [bes entry]
(reduce1 #(assoc %1 %2 ((val entry) %2))
 (dissoc bes (key entry))
 ((key entry) bes)))
  (dissoc b :as :or)
  transforms))
  )
(defn gen-pmap [pb]
  (fn [bvec b v]
(let [gmap (gensym "map__")
  gmapseq (with-meta gmap {:tag 'clojure.lang.ISeq})
  defaults (:or b)]
  (loop [ret (-> bvec (conj gmap) (conj v)
 (conj gmap) (conj `(if (seq? ~gmap) 
(clojure.lang.PersistentHashMap/create (seq ~gmapseq)) ~gmap))
 ((fn [ret]
(if (:as b)
  (conj ret (:as b) gmap)
  ret
 bes (gen-bes b)]
(if (seq bes)
  (let [bb (key (first bes))
bk (val (first bes))
local (if (instance? clojure.lang.Named bb) (with-meta (symbol 
nil (name bb)) (meta bb)) bb)
bv (if (contains? defaults local)
 (list `get gmap bk (defaults local))
 (list `get gmap bk))]
(recur (if (ident? bb)
 (-> ret (conj local bv))
 (pb ret bb bv))
   (next bes)))
  ret
  )
(defn pb []
  (fn pb [bvec b v]
(let [pvec (gen-pvec pb)
  pmap  (gen-pmap pb)]
  (cond
(symbol? b) (-> bvec (conj b) (conj v))
(vector? b) (pvec bvec b v)
(map? b) (pmap bvec b v)
:else (throw (new Exception (str "Unsupported binding form: " b))
  )
(defn destructure [bindings]
  (let [bents (partition 2 bindings)
pb (pb)
process-entry (fn [bvec b] (pb bvec (first b) (second b)))]
(if (every? symbol? (map first bents))
  bindings
  (reduce1 process-entry [] bents

(fact "重构clojure destructure" :destructure
  (destructure '[a 3]) => '[a 3]
  (destructure '[[a b] ["a" "b"]]) => 2
  )


the refactor clojure.core/destructure It's a bit big 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.


Best way to use Lein only as a build tool?

2018-07-26 Thread Didier
What's the best way to use Lein only as a build tool? If I want to do my own 
dependency resolutions. Or say use tools.deps for dependency resolution, but 
Lein for all other build tasks?

-- 
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 use Lein only as a build tool?

2018-07-26 Thread 'Alan Forrester' via Clojure
On 27 Jul 2018, at 06:39, Didier  wrote:

> What's the best way to use Lein only as a build tool? If I want to do my own 
> dependency resolutions. Or say use tools.deps for dependency resolution, but 
> Lein for all other build tasks?

There’s a leiningen plugin for using tools.deps:

https://github.com/RickMoynihan/lein-tools-deps

Alan

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