This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-26
Channels
- # adventofcode (15)
- # beginners (7)
- # cider (2)
- # clojure (42)
- # clojure-austin (1)
- # clojure-europe (4)
- # clojure-nl (2)
- # clojurescript (19)
- # core-typed (1)
- # cursive (1)
- # datomic (10)
- # fulcro (30)
- # graphql (8)
- # hoplon (28)
- # hyperfiddle (16)
- # jobs (1)
- # off-topic (2)
- # philosophy (1)
- # re-frame (1)
- # shadow-cljs (30)
- # vim (3)
hi guys
can i do recursive binding ?
(let [x (fn [] (do (something x) "hello"))]) ?
You could either bind the name of the function to x
or use letfn
.
(let [x (fn x [] (do (something x) "hello"))])
;; or
(letfn [(x [] (do (something x) "hello"))])
(something x) maybe function to save x itself somewhere
my question here, is the internal x equivalent to the outer x ?
hey guys. I am writing a DB lib in Clojure.
- I defined a protocol for the API IClient
I want to expose.
- I also want to give 2 kind of implementations to this protocol. one for a SimpleClient
and one for a ShardedClient
.
- I want the logic to sit in a single place (i.e. not repeated for each concrete implementation) and be dependant on a polymorphic function (get-client [index])
, that will return the right client in each case: on the sharded one it will return the right shard, and on the simple one, just return the only client.
How can I arrange the logic in an open way?
I feel like more information about what functionality you need in each client might be helpful
starting a bigger, open source project that will most probably be made in Clojure, at least the initial prototype (https://github.com/ipfs-shipyard/cube/) Any handy references/guides on tips & tricks for larger application architecture and possible gotchas? Would be greatly appreciated!
If you want a single polymorphic function you can always use a protocol with a single method or a defmulti
@victorbjelkholm429 That seems interesting, lmk if you need an extra pair of hands. I don't have any particular pointers on large applications because im a bit of an idiot
Thanks for the offer! Start watching the repo on GitHub and you'll get notified when new issues gets opened, then just jump in where you feel like 🙂
Yeah, a +1
for Component to make it easier to swap pieces in and out, as well as managing any system "state" that has a lifecycle (can be started and stopped).
Architecturally, try to separate pure business logic from any I/O and/or persistence as much as possible -- makes testing easier and can improve reuse.
@victorbjelkholm429 Also, how big do you consider "large(r)"? We have about 86K lines of Clojure at work -- including test code -- and we have it organized in a monorepo with a dozen or so subprojects that can be tested and built independently, as well as being combined into a set of small monoliths. That's helped us develop clear "layers" of reusable functionality around caching, persistence, searching, etc.
(and we use clj
/`deps.edn` for all of that, with a small shell script to act as a "smart driver" for that)
@victorbjelkholm429 I'd suggest checking out https://github.com/juxt/edge - which sort of acts as both example project and scaffolding tool showing the way juxt approaches organizing fullstack clj(s) apps, including some nifty modular sdk-type stuff they use/made. Folks who know way more about it than I do can likely answer any questions about it over in #juxt
what I find particularly neat in there is the way they built it all around the clj
tool and a combo of scripts in the repo and small libraries
Not yet - mostly because I don't (yet) do much in the way of clojure at work (I'm still in the phase of restricting it to clearly defined, small services/tools until I get the team working with it), so how much clojure I do depends on time for personal stuff. I've been using it to inform my thoughts on organization and minimalist/modular build tooling though and have edge (or at least a personalized/modified edge) in mind for a couple upcoming projects
That would be wonderful. Right now it is just a distillation of my observations of our client work. More feedback is crucial to making edge great I think 😊
sure, though even if it remains mostly based on what you and others in juxt have found to be deal (and why), IMO that's a very useful thing to have from a prolific studio since it's an easy way for someone like me to spot the gotchas I know are coming but not exactly where they'll hit, if that makes sense, particularly with the advent of clj
and the "multiple approaches built on minimalist thing" that inevitably comes with something like that
which is why I signal-boost edge when relelvant 😉. But yes i do need to spend enough time with it in the context of a real, nontrivial project before I can have cogent feedback
thanks a lot @emccue, @seancorfield and @jesse.wertheim, lots of nice advice! Will dive deeper and ask more specific questions when they arise. Unsure of the large-ness of the whole thing, depends on how the prototype goes. Love the idea of having smaller subprojects in the same repository, will try that out
Given that REBL is closed source, it would require someone rebuilding all of that from scratch and creating a JavaFX-based editor as well which seems like a lot of work and not likely to get much traction, given how the editor space is already... or am I misunderstanding your question?
I'm currently doing some experimentation getting a vscode WebView REPL with REBL like viewing, although it's very prototype and early days currently. Full code editing would require literally throwing out vscode's editor and using a custom one however, since it's quite strict about what you can do within a vanilla text editor.
This is definitely a path I feel needs pursuing to it's fullest though, even if it means dropping vscode and building a dedicated electron application.
Ancient Interlisp-D machines had data browsing that REBL is reminding me of, and code editing was integrated with this, and it was lovely.
I never saw the Interlisp version of that, though I've read many times how friendly it was considered to be. The only experience I have with lispms is mid-90's Symbolics machines, are there any emulators, videos, or perhaps surviving documentation that describe it?
@lspector I want to say there were hints of it in the REBL talk from conj but I could be making that up based on having watched https://www.youtube.com/watch?v=c52QhiXsmyI while multitasking 😉
at any rate as datafy support increases that seems like a more and more likely possibility
it's a neat idea. I have yet to see a super convincing fully structural/graphical editor but as a "mode" you can add to stuff it could be awesome (and just because I haven't seen it doesn't mean it doesn't exist)
Given that REBL is closed source, it would require someone rebuilding all of that from scratch and creating a JavaFX-based editor as well which seems like a lot of work and not likely to get much traction, given how the editor space is already... or am I misunderstanding your question?
I have a workflow (with Atom, but it should be possible with <insert your favorite editor here>) that lets me run REBL and connect my editor to it, so I can use a hotkey in my editor to evaluate code into REBL and have the results displayed in the data browser, and it's easy enough to have both editor and browser visible side-by-side.
My question is coming from a place of dissatisfaction with all of the current editor options. Many are near misses (Gorilla REPL and Visual Studio Code + Calva are currently closest IMHO), but none quite nail the sweet spot of ease of setup, ease of use, and implementation of a few key features, specifically bracket matching and auto-re-indentation. Having to use 2 things and make them talk to each other is already out of the sweet spot. REBL seems to be well-enough thought out that it seemed to me that if it supported code editing, with bracket matching and auto-re-indentation, then it might be one-stop shopping for editing and browsing code and data.
Ah, right, I remember we've had this discussion before. Yeah, I can't imagine Cognitect adding any sort of editing to REBL -- they're not in the editor-writing business -- so someone would have to write an editor that satisfies your criteria and write a REBL clone as an integrated part of it.