This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-19
Channels
- # aleph (8)
- # announcements (43)
- # babashka (43)
- # beginners (62)
- # calva (8)
- # cider (27)
- # clj-kondo (18)
- # cljs-dev (25)
- # cljsrn (16)
- # clojure (51)
- # clojure-europe (6)
- # clojure-nl (14)
- # clojure-spec (7)
- # clojure-uk (39)
- # clojurescript (17)
- # cursive (9)
- # datascript (12)
- # datomic (16)
- # events (1)
- # fulcro (7)
- # funcool (1)
- # graalvm (2)
- # graphql (5)
- # jobs (1)
- # juxt (6)
- # kaocha (9)
- # leiningen (11)
- # luminus (1)
- # malli (1)
- # off-topic (80)
- # other-languages (2)
- # overtone (3)
- # pedestal (5)
- # quil (1)
- # re-frame (6)
- # reagent (1)
- # reitit (4)
- # rewrite-clj (5)
- # shadow-cljs (207)
- # spacemacs (1)
- # specter (4)
- # sql (1)
- # vim (14)
- # xtdb (7)
Protocols and multimethods do have "global" semantics, making them appropriate only when creating abstractions IMHO. You can make the namespace(s) with said abstractions private limiting the scope to "an organization" or a subsystem but in their essential nature, they are global. Passing fns in for local stuff is better.
Did anyone build an generative testing system, that tests fns only if the code changed (via the form itself, or via deps)? If I were to store a value which indicates the exact version of the function that has been tested, what would that include. I'm thinking a hash of the form itself, and a map of the deps.edn coords of the libraries the function depends on. Am I right here? Or is this totally wrong because I'm using the artifacts (deps.edn coords) and not talking about the code itself?
I have and maybe some day I’ll finish and actually release it. It’s based on stripping white space and hashing. There are some interesting choices when dealing with macro expansion (whether to expand, and what to do about gensyms, which are not repeatable)
100% me too. But Alex Miller might not want to release unbaked stuff, so to speak.
Eventually, I'm hoping something like this (the sha calc. part) ends up in a blessed lib like tools.deps
, and that combined with something like sgepigon/piggy
enhanced with requirement/provision checking as well, backed by codeq
will just put the Clojure ecosystem light years ahead of pretty much everyone else in dep. management (barring experimental stuff like Unison ofc.)
Perhaps a better thing would be, assuming (in a recursive sense), I have a hash for each of the dependencies my fn uses (maybe other fns, values or macros), I can just take all those hashes, assoc-in the form of my fn/macro in that map, and hash that. I can't really think of where that would bottom out though considering Java Interop. Because if there was no Java Interop. It could eventually bottom out to the Clojure version (which could be treated specially) Considering Java(script) Interop makes it extremely hard for my brain 🤯 If anyone has done something like this (in other language ecosystems, even), would love pointers to explore that...
Did you see that? https://plasma-umass.org/doppio-demo/ .. Clojure in browser. JVM written in JS, is that possible with CLJS too? What do you think? (not so new project)
This also worked:
/home $ clojure
Please be patient; this command may need to download resources from the network.
Clojure 1.7.0
user=> (+ 1 2 3)
6
They said.. need to install on the server openjdk.. if not .. that is cool (I need to test)
@U04V15CAJ what do you think, we can create similar solution with clojurescript (Im not advanced CLJS developer) or what is the limitation?
I'm not entirely sure what you want to create. Something like: https://clojurescript.io/ or http://app.klipse.tech/
Yes, I know. Just run Clojure.. without openjdk dependency, eg http://ish.app.
You can already use self-hosted CLJS for this. E.g. https://apps.apple.com/us/app/replete/id1013465639?ls=1 is doing this.
Yes, I installed. Just Im thinking about run from CLJS part the CLJ part too and connect. Maybe that is a strange idea.. so not just macros
ah right. I'm not sure if doppio is fast enough for that, it seems more like an educational project? GraalVM polyglot might give you that ability: https://nextjournal.com/kommen/clojure-berlin-prosemirror-transforms-with-graalvm-and-clojure
I would like to test later .. create a fake layerFS (Alpine image) with openjdk and that compile into binary.. to any kind of architecture, like recovery shell programs. In this case without Java you can run clojure on any kind of architecture. (I work on IoT things)
If you want some kind of evaluation of Clojure expressions in GraalVM native there is also https://github.com/borkdude/sci/ For example this project is created with it: https://github.com/borkdude/babashka
does anyone know of good resources for building an app that works over a mesh network?
I basically am interested in exploring an app that communicates device->device via bluetooth or other ad-hoc methods
you could start by playing with local ip multicast communication, no hardware or drivers are needed and you'll be able to broadcast data to others on the same local network
I am interested in communication between devices that aren’t necessarily connected to the same LAN
the annoying thing with that is an ip stack is seen as a standard thing exposed in a standard way pretty much everywhere, the same is not true of bluetooth and access to bt radios
so you will need to start by figuring out the bluetooth stack for your given environment / device
I have two use cases I’m interested in right now: 1. where a network needs to be established between devices that is in a degraded connectivity area. think: a large gymnasium where the wi-fi is super spotty 2. an app that works based on proximity of it’s users, without needing to share information with a master server
Gotenna is something I've been looking at, it's an encrypted mesh network over radio. They provide a radio device that connects to your own device over bluetooth. They have an SDK for developing your own apps. I was going to get a set for music festivals, and had poked around the SDK stuff as a curiousity. https://gotenna.com/pages/sdk
and I am not sure if bluetooth has a true peer to peer mode, I vaguely recall maybe a new standard for it in the last few years that lots of low power devices use
I know that there are apps that have solved this problem multiple times. I wonder what they had to build to enable this kind of ad-hoc message passing
the thing that immediately come to mind is this app: https://scuttlebutt.nz/
incidentally watching all the udp broadcasts on your home network can be really interesting. most set top boxes broadcast stuff, lots of home automation stuff does
there are adhoc wifi modes, so in theory if you work over udp broadcast, you work over that
Is this real? In the german Amazon, Programming Clojure
paperback is cheaper to buy it new than used, also is cheaper than the kindle edition.
@lilactown we used this simulator at the university https://www.nsnam.org/docs/manual/html/python.html There’s some academic resaerch on mesh networks, competing protocols, etc. And a few successful apps, their names escaping me now. But I think they use them in the HK protests, for example.
Probably not very helpful, if your are looking for something more akin to a readymade SDK.
I suppose you’ve seen https://en.wikipedia.org/wiki/Wireless_mesh_network
on daily programming, which is preferable?
λx.z + λy.z
or λxy.z
keeping in mind the latter is more complex to implement ....
I am not sure I understand the question. Is the first thing intended to mean "write two functions, each taking one input value, each returning a value, and then add their results together after both of them return", and the second is intended to mean "write a function with two parameters, which internally does the same work as the two independent functions of the first approach, then add their results and return that"? If so, I don't understand why the second would be more complex to implement.
And if I have misinterpreted your question, then I don't know what is intended.
yes, you understand well, that's exactly what i mean
i say the 2nd is more complex because the 1st option simply takes as input an item (number, string, whatever) and the 2nd option takes as input a group of items. and that in practice (input as group) is a bit more difficult to implement
You could write a function that takes a single input and returns the desired value, call it f-on-one
, then write (defn f-on-many [coll] (reduce + (map f-on-one coll)))
, couldn't you? I don't see f-on-many as complex at all, if there is no interaction between the calls of f-on-one
on each element.
agreed, the complexity difference is trivial
but which option should be preferred?
would do you prefer the 2nd for readability?
Why not implement both, and let the caller decide which they want?
Or, if you implement only the first, then most Clojure programmers can bang out the second in a minute or so, if they want it.
yea, understood
my question was more theorical, than a given real problem. i just was wandering about best practices
I think it is generally considered a bad idea to make a single function that takes either one element, or a collection, and if given a collection it behaves like f-on-many
, but if not given a collection it behaves like f-on-one
.
Because then you disallow a collection as a single element of another collection.
To me, it seems that if f-on-many
is really only doing what is shown in the definition above, then I would provide f-on-one
, and let the caller write f-on-many
if they want.
Unless for some reason f-on-one
was almost never what the caller wanted, and they really always wanted f-on-many
ok. very gentle for your explanation thanks