This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-04
Channels
- # aleph (1)
- # announcements (7)
- # beginners (22)
- # calva (31)
- # cider (2)
- # clj-commons (1)
- # clj-http (2)
- # clj-kondo (10)
- # cljsrn (33)
- # clojure (18)
- # clojure-europe (7)
- # clojure-nl (3)
- # clojure-uk (2)
- # clojurescript (93)
- # depstar (3)
- # events (1)
- # figwheel-main (3)
- # fulcro (13)
- # graalvm (95)
- # graphql (1)
- # introduce-yourself (1)
- # lsp (92)
- # off-topic (2)
- # pathom (11)
- # releases (1)
- # shadow-cljs (33)
- # specter (6)
- # tools-deps (4)
- # vim (3)
- # web-security (1)
- # xtdb (7)
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
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
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]
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!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
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
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
Some examples of different comment use at https://practical.li/clojure/reference/clojure-syntax/comments.html
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
@U02CV2P4J6S, liquid’s buffers come to mind, https://github.com/mogenslund/liquid/blob/master/src/liq/buffer.cljc
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 nestedArray.map((rows, x) => {
let row = rows.map((cell, 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>
);
});
}
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.