Fork me on GitHub
#beginners
<
2019-09-28
>
Christian Barraza16:09:35

Is there an easy way to pass a list as an argument, but not as a list, but rather its individual elements?

jaime18:09:41

In javascript it is a common pattern to have index.js in a directory which just exports other modules within that directory. Eg. components/index.js exports components/my-component.js Is this possible in clojure? What I’m trying to accomplish is that just require components namespace.

(ns 
  (:require [my.components :as components]))
So that I can use components/input components/label instead of :requireing each component

athomasoriginal19:09:21

Yes, you can do that, but it’s a manual process which looks something like this:

(ns your.ns.core
  (:require 
    [comp.a :as a]
    [comp.b :as b]))

(def a a/a)
(def b b/b)

; ...and so on
Then you could have one ns which allows you to import everything from it. The downside of the above approach is you IDE tooling will not work as you expect, a from your.ns.core will not have docs associated when you interact from the repl etc. So one way around this is to manually specify components in your index ns like
(ns your.ns.core
  (:require 
    [comp.a :as a]
    [comp.b :as b]))

(defn a 
  "docs"
  []
  a/a)

; ...and so on

jaime16:09:19

Hi @U6GNVEWQG thank you for taking the time and showing example. It seems like its not worth it applying this pattern. Yes?

athomasoriginal16:09:23

I feel that it can be, yes, and we structure some of our libraries like this at work.

jaime16:09:14

Oh great. It’s not that bad I guess so 😄

jaime16:09:59

But repeating the doc is what I don’t like

athomasoriginal00:09:40

Its hard to explain without code, but the docstrings are not repeated. They live in the entry ns. Everything else is implementation details.

jaime18:09:12

Oh ok. It’s like defining an interface in the entry ns with the docs. and implementation in the other files

bartuka20:09:59

I'm trying without sucess to configure a datomic database with metabase

bartuka20:09:18

I am using this pluggin, https://github.com/lambdaisland/metabase-datomic but cannot find a way to proper configure the edn file

bartuka20:09:52

I have an in-memory database and I keep receiving "unable to connect to database" error messages

oliver21:09:52

Hi there… I'm using Emacs with CIDER and boot as a build tool. Sometimes I get exceptions such as: java.nio.file.NoSuchFileException: styles/.#styles.clj I do have a source file styles.clj, but not .#styles.clj To me this looks like the watch task detects the creation of Emacs' autosave files and since they're on my source path boot wants to load them. Autosave files are of the fleeting type of course and then end up missing. Any other ideas as to what may be causing this or how to fix it? Thanks!

seancorfield21:09:17

".bootignore controls construction of the initial boot-fileset. Files matching the regexes in .bootignore will be excluded. For example, to ignore emacs backup files, .bootignore should contain .*~$. To ignore transient emacs files, add ^\.# and /\.#."

oliver22:09:37

@seancorfield Hi, many thanks for helping me out once again! That should solve it…It didn't happen all that often and actually my workflow is quite smooth by now… I'm totally hyped by the language!

seancorfield22:09:30

Cool. I personally do not like "watch" workflows. I don't want to have to switch out of my editor/REPL setup to see code being compiled or tests being run. I do all my updates from the editor via the REPL -- a very tight RDD workflow.

seancorfield22:09:03

I also run tests from my editor/REPL combo during my regular development and only run "test suites" from the command line occasionally (e.g., before pushing a feature to a branch).