is there any interest in the community to port clojure to webassembly? I know clojure is deeply tied to java ecosystem but being able to write clojure could that compiles to wasm can drive a lot growth and opportunities for both clojure and wasm for now, rust is the go to wasm supported language and that will probably remain forever c# is coming up as the 2nd good language with blazor - the huge push from Microsoft golang will probably end up next; if Clojure can try, it could take that space! people can mention clojurescript but that will miss the whole point!!
If you are seeing 'targeting wasm' as a sacrifice and most of what wasm is about crypto and the security problems that are associated with it, I have to take that, this topic has don't have much relevance here
I thought it was mostly an interesting note about the tech -- I haven't really looked at WASM so @thegobinathโs made me curious and the links above were just the first few things that I turned up, mostly relating to suitability for Clojure. I was genuinely surprised to see that statement on the wiki! ๐
Does webassembly support garbage collection? I think there are proposals for it but I'm not sure if it's implemented
yeah.. not sure but the area seems active https://github.com/WebAssembly/gc
Perhaps of interest https://clojureverse.org/t/any-news-for-webassembly-for-clojure/5274
Also https://www.reddit.com/r/Clojure/comments/bjggh5/does_clojure_compile_to_web_assembly/
(the former initially asks about cljs/wasm interop but some of the responses speak to the more general issue of transpilation to wasm)
The main benefits to Clojure/Script (and ClojureCLR) is that they bring with them access to vast, established ecosystems of libraries โ Iโm not sure how much of that youโd end up sacrificing to target WASM?
Seems like (the lack of) multithreading and GC in WASM would be big obstacles to porting Clojure to it. Also โA June 2019 study from the Technische Universitรคt Braunschweig analyzed the usage of WebAssembly in the Alexa top 1 million websites and found the prevalent use was for malicious crypto mining, and that malware accounted for more than half of the WebAssembly-using websites studied.โ ๐ โ from https://en.wikipedia.org/wiki/WebAssembly#Security_considerations
Any good tech is always used first by criminals, this is just expected at this point. Especially if it's low cost, low risk, high potential value. If anything, that quote from the wiki is a statement about how bad the browser is that it allows installation of such software without any real help to the average person using a browser to analyse what is installed and deal with it. Of course, such tools would first have to be developed not for the browser but for the OS, and there are lots on the market, but I am not sure I can trust them to such high degree as it would be necessary here.
Hi everyone, maybe stupid question, but is there any way to force certain namespace to reload each time when using clojure.tools.namespace.repl/refresh
?
My case is: I have a edn file and I'd like that any changes in this file to force reload in namespace which reads this file.
@fmnoise I am not using tools.namespace refresh stuff, but you can force a reload using the :reload
option in require
with pure clojure.tools.namespace you can use refresh-all. But this function will unload and load back everything tracked so far.
You can try to use some library to manage dependencies (like integrant) to achieve what you want. But this will affect for sure your project structure
thanks!
thanks!
If i have a string such as "alias/keyword" how can i create a keyword with the namespace of the alias?
you can use the ns-whatever functions to resolve aliases
look it up in the map returned from ns-aliases
etc
Hi Iโm trying to create a function that does the following: input: [[1] [1 2]], output: [[1 1] [1 2]] input: [[1 2] [2] [1 2]], output: [[1 2 1] [2 2 1] [2 2 2]] input: [[1 2] [1] [1 2]], output: [[1 1 1] [1 1 2] [2 1 1] [2 1 2]] This is what I have so far:
(defn match-meta-pattern
[metapattern]
(loop [result [] metapattern metapattern]
(if (seq metapattern)
(recur
;;;;;;;;;;;;
(do (prn "meta" (first metapattern))
(prn "->" result)
(if-not (seq result)
[[(nth (first metapattern) 0)]]
(map (fn [next-pattern] (map (fn [running-pattern]
(conj running-pattern next-pattern)) result))
(first metapattern))))
;;;;;;;;;;;;
(rest metapattern))
result)))
can you explain the logic?
Each subvector represents the various values of the branch
you list a single input for each example, but your function takes 2 arguments
i did not understand the logic explanation ๐
yeah, that too, and I don't see a pattern between input and output at all, so hard to say
i see the pattern
[[a b c] [d e]] -> [[a d] [a e] [b d] [b e] [c d] [c e]]
terminology is wierd though
this is a combinatorics thing
it's just a cross product?
none of the inputs have a 3 element vector as the first element
oh yeah, it's just a cross product
@dpsutton itโs not a cross product because a cross b is defined only when length a = length b
cross product with padding
that's not true
๐ดร๐ต={(๐ฅ,๐ฆ)|๐ฅโ๐ด,๐ฆโ๐ต}
@dpsutton thatโs the operation, but itโs not called cross product
a cross join
cartesian product is the technical term i guess. maybe i misremembered but i thought there were largely interchangeable
vectors and sets
i went back to halmos naive set theory to check. been a while since my set theory days. i was wrong and apologies
(defn cartesian [set & sets]
(if (seq sets)
(for [x set
tail (apply cartesian sets)]
(conj tail x))
(for [x set]
(list x))))
(cartesian [1] [1 2])
(cartesian [1 2] [2] [1 2])
(cartesian [1 2] [1] [1 2])
I'm trying to set my m2 repo location using profiles.clj
, what is the difference between the :local-repo
and the :repositories "local"
here? https://wiki.archlinux.org/title/Clojure#m2_repo_location