Fork me on GitHub
John Bradens02:09:31

What is the difference between running shadow-cljs vs npx shadow-cljs? What does the npx do?


npx download the software on the fly from npm in case it’s necessary @bradj4333

John Bradens02:09:26

Ok thanks! So if I do npm install, then I don't have to use npx, but if I add more dependencies, then I would use npx?


If you do npm install it usually installs all the dependencies in the package.json and you should be good to go


npx will also look into the binary directory of node_modules, otherwise you’d either need to pretend the path or install the package globally

John Bradens02:09:28

Ok cool thank you


npx download the software on the fly from npm in case it’s necessary @bradj4333


Hi Clojurians! I often find myself at odds with Clojure comments (`; this kind of comments`) for several reasons: • they are not formatted automatically by cljfmt (the problem here is mostly that indentation is often broken) • they are awkward to select/move with paredit clojure.core/comment solves the first issue, but not the second (i.e. the comment would still be just a sibling of the expression it refers to) So I've resorted to my own macro:

(defmacro ic
  "Inline comment.
   Ignores first argument.
   for example: (ic \"sum 1 and 2\" (+ 1 2))
   expands to (+ 1 2)"
  [comment expr]
Usage example:
(defn component-xyz
  [prop1 prop2]

  [:div {:class "myclass1"}

   ; a typical comment
   [:span "sub-component-1"]

   (ic "an inline comment"
       [:span "sub-component-2"])

   [:span "sub-component-3"]]
It seems like such a common problem that I'm left wondering: • Is there already something like this out there that I've missed? • Is this a bad idea for some reason that I haven't considered? Thanks!


Maybe checkout #_


It causes the reader to read the following form (so it must be well formed) then discard it


The defacto line Clojure comment is ;; (two semi-colons). This is formatted correctly by all Clojure tools and editors I believe


Thanks, didn't know about ;;


I think Cursive defaults to the singe quote, which is interpreted differently by many Clojure tools The single ; is typically used for end of line comment ;; for the whole line

✔️ 6

the old school convention from LISP was ; - at the end of the line of code ;; - on its own line, indented the same as any sibling forms ;;; - a "section heading", always indented to column 0


I use a rich comment block (comment ) at the end of my code to show examples of calling key functions #_ I use throughout the code, within threading macros, etc. It can also be doubled, tripped up and be on previous lines

👍 2

what is the closest to emacs buffers in clojure? Some convinient way to do something like skip-chars-forward , forward-line and such with a clojure string (from a file) would be nice for my problem right now


that is cool


Hey guys a while ago I made minesweeper in reactJs and Id like to recreate it in clojure. I had these two functions which made it easy to change the screen of the cell/handle onclicks. I was wondering which templating library (hiccup/selmer/enlive/ or any other im might not be aware of) would make it the easiest to replicate something like this, and how? createNestedArray = (x, y) => { //x is how many arrays // y is how many objects in x array //ex x = 3, y = 2 //[ //[{}, {}], //[{}, {}], //[{}, {}] //] let nestedArray = []; for (let i = 0; i < x; i++) { nestedArray.push([]); for (let j = 0; j < y; j++) { //information of individual cell nestedArray[i][j] = { screen: "?", id: ${i}-${j} }; } } this.setState({ //keeps track of board and some bomb info board: nestedArray }) } //for every item in array creates cell //[[],creates row from array //[{randomObj}], creates cell from randomObj //[{}, {}, {}] row with 3 cells tablerows = (nestedArray) => { if (!this.state.board) { return; }//if a board already exist return return, x) => { let row =, y) => <td id={`${x}-${y}`} onClick={(e) => { this.cellClick(e); }} onContextMenu={(e) => this.handleRightClick(e)}> {this.state.board[x][y].screen} </td>); return ( <tr> {row} </tr> ); }); }

Drew Verlee20:09:04

Maybe try helix, it cookies complies to react hooks.


Im open to the idea of using cljs, but I havent found a good/easy setup yet. Id like to stick to clojure for a little longer.