Fork me on GitHub
#beginners
<
2020-08-28
>
Endre Bakken Stovner11:08:34

In Bulma CSS a class is called <div class="notification is-danger">, but in reagent it is written like :div.notification.is-danger. Why do they match? Is . considered whitespace in a class name since you presumably cannot have a nested class? I guess the latter is true and that I realized the answer while writing the question XD

simongray11:08:03

That's just syntax sugar in reagent Hiccup and its origin is CSS, not method calls. Classes in CSS are referred to using a dot and ids using #, so in Hiccup you can just do [:div.myclass.myotherclass#myid] and it will get converted to [:div {:class "myclass myotherclass ", :id "myid"}]

๐Ÿ‘ 3
Endre Bakken Stovner19:08:59

Thanks for the reminder. The final one is > which I think just creates a new element ๐Ÿ™‚

Endre Bakken Stovner12:08:07

Are there formatters that can turn

(cond (true? loading?) :loading
      user :authenticated
      :else :anonymous)
into
(cond (true? loading?) :loading
      user             :authenticated
      :else            :anonymous)
? (I use emacs btw)

gon13:08:48

There is an Emacs' package: aggressive-indent

slipset14:08:47

Note that there is a downside to this approach when it comes to version control. If you change (true? loading?) to something longer or shorter, youโ€™ll get a diff spanning three lines rather than one.

๐Ÿ˜“ 3
practicalli-johnny15:08:20

;; Indentation of function forms
  ;; 
  (setq clojure-indent-style 'align-arguments)
  ;;
  ;; Vertically align s-expressions
  ;; 
  (setq clojure-align-forms-automatically t)
  ;;
  ;; Auto-indent code automatically
  ;; 
  (add-hook 'clojure-mode-hook #'aggressive-indent-mode)

Endre Bakken Stovner15:08:50

Thanks to all of you! ๐Ÿ™‚

dpsutton13:08:27

i hit C-c <space> and it aligned it like that for me. clojure-align is what that is bound to for me. can probably get more clarification in #emacs

๐Ÿ‘ 3
Pablo14:08:14

Hello everyone! Where can I find documentation about the :forms key of metadata map? Is it only for documentation purposes or the compiler does something with its value?

Pablo16:08:57

Thanks :D

Pablo19:08:47

Can I use it on my docs or is it only for clojure.core functions?

Alex Miller (Clojure team)19:08:14

they're used by doc if they exist so it's the best place to hand-craft an arglist form if the default is not conveying what you want. this is a common need with macros which might just take a bunch of syntax that they have to parse

Pablo19:08:35

Thatโ€™s exactly what Iโ€™m writing. Thanks!

Alex Miller (Clojure team)19:08:30

also note that if you supply a spec with fdef and :args, that will printed by doc as well

Alex Miller (Clojure team)19:08:47

(doc defn) for an example

๐Ÿ‘€ 3
bcaccinolo14:08:14

just wanted to share with the community. As a clojure beginner, I've commited my first lines of Clojure in the project of the Java project of one of our customer. It's some HoneySQL code to generate test data on the development server ๐Ÿ™‚

๐ŸŽ‰ 48
๐Ÿ‘ 6
Kevin16:08:48

If you continue down this path, it would be very interesting to read about it (in a blog post or such). Not only interesting by itself but it also teaches the Clojure community what is looked for when migrating systems to Clojure.

๐Ÿ‘ 6
Drew Verlee18:08:45

https://github.com/drewverlee/fk-gen @UPQTL73ML I made a library that might interest you. I'm sure someone else has created a more robust version.

๐Ÿ‘ 3
bcaccinolo08:08:38

@U0DJ4T5U1 thx. I'll check this

Drew Verlee17:08:36

The problem I'm solving is that postures tables demand more information then you might care about testing.

vlad_poh20:08:17

is it prudent to run ring app in production with "lein run"

practicalli-johnny07:08:22

Create an uberjar of the Clojure project and run using the java command line. This is the most common approach

java -jar project-uberjar.jar

Joel22:08:18

can core logic ask questions?