This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-08
Channels
- # aws (3)
- # bangalore-clj (1)
- # beginners (47)
- # boot (137)
- # cider (1)
- # cljs-dev (67)
- # cljsrn (7)
- # clojure (122)
- # clojure-argentina (5)
- # clojure-berlin (4)
- # clojure-czech (12)
- # clojure-france (27)
- # clojure-italy (9)
- # clojure-russia (88)
- # clojure-spec (44)
- # clojure-uk (157)
- # clojurebridge (2)
- # clojurescript (236)
- # datomic (5)
- # devcards (3)
- # dirac (23)
- # emacs (13)
- # hoplon (29)
- # incanter (1)
- # leiningen (41)
- # microservices (1)
- # off-topic (78)
- # om (145)
- # onyx (13)
- # parinfer (8)
- # pedestal (4)
- # planck (15)
- # protorepl (1)
- # re-frame (72)
- # reagent (25)
- # ring (2)
- # specter (23)
- # test-check (9)
- # untangled (106)
- # vim (8)
- # yada (1)
@dimovich Clojure doesn’t really have “frameworks” like other web dev languages. Instead it focuses on small, composable libraries and you build solutions based on those. So there’s no CMS for Clojure, pretty much by definition.
@seancorfield So, if the client needs to edit some files on the server, what options are there?
@dimovich There are some CMS that are build with clojure, if you google for it. That said, you can just read and write files from hard drive or the resource path and use a normal formular to edit them
If the client having access to the server is ok, then it's probably pretty straight forward
Also, please remember, text files dont have any formatting besides tabs and line breaks.
Maybe markdown would be better? Or write the content in edn files, and then parse the edn into your templates.
TBH @dimovich your use case sounds like something I personally wouldn't choose Clojure for. I mean, not that there's something inherent in Clojure that makes it unsuitable for something like this, but based on your description I'd say that there's stuff out there that gives you all you need pretty much from out of the box
Why not just use Wordpress or something? That's not even the only option. I know these techs are not as sexy as Clojure, but I'd say they suit your needs just fine.
Clojure is the golden hammer of god, but for this nail, a regular hammer should do just fine. 😉
@kauko you're right. Feels like using a bazooka to kill a fly. 🙂 I was planning to use markdown. The thing is, enlive (or any other templating lib) seem so elegant and simple. But I guess in this case, going with Wordpress should be fine.
https://www.contentful.com/ CMS-as-an-API. There's possibly others of these around, but this is the one I know off the top of my head.
I've heard of people using the wordpress API, to have the "admin panel" of wordpress, but the smooth dev of Clojure.
@sveri I haven’t been able to turn up any Clojure-based CMS … do you have any pointers?
@seancorfield this one has had some commits this year: https://github.com/emil0r/reverie
these two are older: https://github.com/fmw/vix and https://github.com/jdkealy/clj-cms
Hey! What do you think I should use to convert this map (that was clojure.set/map-invert
ed):
{[:a :b :c] 1 [:c :d] 2 [:a :c] 3}
into
{:a [1 3], :b [1], :c [1 2 3]
?
This looks pretty close, but something is wrong here:
(reduce (fn [m e] (update m (key e) (fnil conj []) e)) {} {[:a :b :c] 1 [:c :d] 2 [:a :c] 3})
got it:
(reduce (fn [m e] (update m (key e) (fnil conj []) (val e))) {} {[:a :b :c] 1 [:c :d] 2 [:a :c] 3})
there must be a "magical" link about asking questions and finding solutions by yourself rubber-duck anyone? thanks!
@pawel.kapala Doesn't that just wrap the values of the input map in vectors?
indeed, too quickly I called it success 😉
(reduce (fn [m e]
(reduce (fn [m k]
(merge-with #(into [] (concat %1 %2)) m {k [(val e)]}))
m (key e)))
{} {[:a :b :c] 1 [:c :d] 2 [:a :c] 3})
But I have a feeling, it should be possible to do it simpler..(apply merge-with concat
(map (fn [[ks v]] (zipmap ks (repeat [v]))) {[:a :b :c] 1 [:c :d] 2 [:a :c] 3}))
I'm 2 min late, but similarly:
(apply merge-with into
(for [[k v] {[:a :b :c] 1 [:c :d] 2 [:a :c] 3}
kw k]
{kw [v]}))
@pawel.kapala @rauh definitely a beginner’s question 😉 !
@st isn’t it a beginner’s question?
@rauh like in my example?
I’m still analyzing @st ‘s zipmap
version
@pawel.kapala I was suggesting that this is not a trivial question. very interesting exercice for sure.
@pawel.kapala Yes this is 3x faster:
(reduce-kv
(fn [m kws v]
(reduce
(fn [m kw]
(update m kw (fnil conj []) v))
m
kws))
{}
{[:a :b :c] 1 [:c :d] 2 [:a :c] 3})
@st oh I didn’t get that. I still consider myself clojure newbe, so I wouldn’t go asking this question around other channels 😆
@progzilla: http://www.braveclojure.com/clojure-for-the-brave-and-true/ is a great place to start
@shaun-mahood Thanks off I go!
@shaun-mahood If you like to learn by example then 4clojure
@progzilla I agree with the above posters! When I started out I read Clojure for the Brave and True while doing some 4clojure exercises in parallel. The cheat sheet http://clojure.org/api/cheatsheet also helps in exploring Clojure's huge (and amazing) library of core functions.
@progzilla Also, I recommend following some other users on 4clojure to see how more experienced programmers solve the exercises. And sorting by difficulty! 🙂
quick question about dependencies! i'm writing a library that i want to be included in another project as a dependency. the library's project.clj starts with (defproject abc/library "0.1.0-SNAPSHOT"...
and has a main namespace called library.core
. i ran lein install
in the abc/library project and then added [abc/library "0.1.0-SNAPSHOT"]
to my dependencies in my main project, but clojure complains that the library.core
namespace can't be found. what am i missing?