This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-03
Channels
- # announcements (11)
- # aws (1)
- # beginners (57)
- # calva (14)
- # cider (22)
- # clara (23)
- # cljdoc (21)
- # cljs-dev (14)
- # clojure (76)
- # clojure-austin (3)
- # clojure-europe (32)
- # clojure-finland (1)
- # clojure-gamedev (5)
- # clojure-italy (3)
- # clojure-nl (17)
- # clojure-poland (4)
- # clojure-spec (23)
- # clojure-uk (29)
- # clojurescript (72)
- # cursive (6)
- # data-science (4)
- # datomic (2)
- # dirac (10)
- # duct (3)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (86)
- # jackdaw (5)
- # juxt (2)
- # kaocha (2)
- # leiningen (16)
- # off-topic (47)
- # pathom (46)
- # protorepl (2)
- # reagent (4)
- # reitit (14)
- # ring-swagger (5)
- # shadow-cljs (43)
- # spacemacs (13)
- # sql (13)
- # tools-deps (6)
I am trying to build some basic functions to manipulate polynomials. Is there a conventional way to implement a function that map
s over collections but pads shorter ones with a fill value? Or just one that is perhaps more clever or concise or elegant than this? ↓ Just feel like I’m apply
ing all over the place.
Maybe you could represent polynomials as maps rather than sequences? Then your polynomial add just becomes merge-with +
Ah, I like that. With the powers as keywords? Like (merge-with + {:0 1 :1 4 :3 19} {:1 7 :3 2 :5 3})
?
Hi, I'm trying to use the follow java library https://github.com/robert-bor/aho-corasick in clojure
I added (:import [org.ahocorasick.trie Trie Emit]
to my code, but I don't understand how to actually build a Trie. I tried (.builder Trie)
, or (-> Trie .builder)
and others
@UGH9KH1DF the builder is a static method in the class and can be accessed like this:
(Trie/builder)
(-> (Trie/builder) (.addKeyword "hers") ... (.build))
@jarvinenemil Thanks for the offer, thought I managed to track it down myself
@twaima if you execute lein repl
you will see smth like this:
nREPL server started on port 35043 on host 127.0.0.1 -
copy that port and lein repl :connect localhost:35043
to connect to that replyou can connect as many clients as you want to an nREPL server (within reason)
see https://nrepl.org/nrepl/0.6.0/usage/server.html#_embedding_nrepl for launching an nrepl server from within your app
it's not unheard of although I don't think it's common practice. I find it useful for debugging production issues
just don't expose it to the internet 😛
I'm building a toy project with Fulcro to learn clj/cljs. I'm thinking about what database to back it with. Trying out Datomic seems like to good idea to immerse myself in clojure-y thinking. The issue here is I don't really understand the difference between the free and "1 year free pro" versions. It seems the free version only has an older API that isn't recommended for use anymore. Is that accurate? What would you choose for a toy project?
For a toy project, I might consider datahike https://github.com/replikativ/datahike
it’s not datomic but it’s a datalog-based db like datomic is, so you’d get a lot of the “immerse myself in clojure-y thinking” bit.
Thanks for the link! Looks interesting and potentially a lot easier to set up and work with. My other option is to just go with monger as I already have a mongo database with some real world data in it. That might be a pain due to the data being designed for a different app however. In your opinion is it worth it to spend time learning datomic/datalog?
I would say so, but I’m biased in favor of learning new stuff all the time 😉
also, there’s value in learning the Mongo/Clojure interface too, so :man-shrugging:
I'm with you on the learning new stuff all the time 😀 I got started on this clojure(script) kick while searching for solutions to problems in my large typescript project
That’s one of my favorite talks.
also, this is paid but i think worth the $3 or $4 a month: https://tbaldridge.pivotshare.com/ He has 21 core.async videos there
Is this the best way to append an element to a sequence?
(concat sequence [element])
The confusing part for me is why there isn’t a way to append a single element to the end of a sequence so that I don’t have to wrap the element in a vector to use concat
.
The code I’m using this in is my implementation of map
and filter
defined in terms of reduce
:
(defn reduce-map
[function collection]
(reduce
(fn [accumulator element]
(concat accumulator [(function element)]))
'()
collection))
(defn reduce-filter
[predicate collection]
(reduce
(fn [filtered element]
(if (predicate element)
(concat filtered [element])
filtered))
'()
collection))
that's basically mapv...
yep, point taken, I’ll remove the snippet to reduce confusion!
oh, I was actually helping :’). The question was implementing map
& filter
in terms of reduce
haha, OK - context!
haha, you made me feel real stupid :’)
oh ... not trying to do that to anybody
oh no not implying that! Nuance gets lost over the internet ^^!
uhh yeah you are right — I was solving the question instead of the problem ^^
so in that particular case it would be (mapv (fn [element] (function element)) collection)
. That said, its still valuable to know that conj
uses the most sensible insertion order.
Slack usage/code of conduct question, if there is a subject specific channel but it is very infrequently in use, should you still wait for responses there or can you ping the main clojure or this channel with one off questions
I know I've found out about some channels because people posted "Hey, I have a question about Fooness over in the #fooness channel, could someone have a look?"
I wouldn't cut and paste the question back into the main channel because sometimes that fragments the discussion and makes it hard to follow, but that may be just a personal preference.
But I think a brief ping now and then is fine (Disclaimer: I'm not an admin, just sharing my personal preferences.)
Right, maybe I'll let the question marinate in the specific channel for a bit and see where it lands. Thanks for the feedback
@mbjarland Which channel wasn't getting you a response? (maybe we can suggest a more active channel that might also help)
This was on #datomic - really the question was about ions and whether ions are suitable for a plain-vanilla ring-type web applications or aimed at api:s and event handlers. I posted it on #clojure after...
Ah... I would have expected #datomic to be the best place to ask... sorry you didn't get a response there 😞