2,319 questions
Advice
0
votes
2
replies
13
views
Clojure inline print for debugging
In clojure, the println function returns a nil:
\>(println "a"
a
nil
This makes it awkward to use print to access an intermediate value when print debugging:
Say I have:
(* (+ 5 10) (- ...
1
vote
0
answers
72
views
No *cider-error* buffer and no stacktraces with shadow-cljs
I am using Emacs+Cider to develop a ClojureScript project with shadow-cljs.
When I am using Cider with a .clj project, everything works fine. But in shadow-cljs projects specifically, I don't get the ...
0
votes
1
answer
59
views
How to include a file with shadow-cljs/inline, but preprocess it first?
Shadow-cljs has a resource loader that can include literal files into the Clojurescript code
(ns app.my
(:require
[shadow.resource :as rc]))
(rc/inline "file.txt")
I need a macro that ...
1
vote
1
answer
71
views
How to connect twsapi with @stoqey/ib in clojurescript
When execute the script in javascript, it is normal as expected, however,
using @stoqey/ib with clojurescript unsuccessfully.
Please comment how to access the constructor of @stoqey/ib with ...
1
vote
1
answer
76
views
How to us math.js with clojurescript correctly?
Using math.js with clojurescript unsuccessfully. Please comment how to access the function of math.js with clojurescript correctly.
Error lines
1. product (math/dot v1 v2)]
2. Ainv (math/inv A)]
...
0
votes
1
answer
67
views
Writing Grafana K6 test in ClojureScript
I'm trying to use K6 with a test written in ClojureScript. K6 is written in Golang, runs a bundled JS runtime, which in turn runs tests written in JavaScript.
I don't have a problem running a ...
1
vote
2
answers
95
views
How to use js-pytorch with clojurescript on MacOS?
Using js-pytorch with clojurescript unsuccessfully. Please comment how to fix the installation issue of js-pytorch with clojurescript
execute in calva-repl:
(ns server.ros2
(:require ["js-...
1
vote
1
answer
112
views
Cors request failure in clojure application
I am learning how to use reagent clojure and I am creating a password management application with some basic crud operations as well. Right now when I try to delete a password or use my password ...
1
vote
1
answer
86
views
Error when trying to run ClojureScript on Windows
I try to run ClojureScript "hello-world" project on Windows 10 Home 22H2 19045.4529. I follow documentation from https://clojurescript.org/guides/quick-start and get following output:
C:\...
1
vote
2
answers
173
views
Trying to import libraries in Clojure
I have a problem with a code I am developing in Clojure:
(ns problem2 (:require [cheshire.core :as json]
[clojure.spec.alpha :as s]
[invoice-spec]))
(...
2
votes
2
answers
106
views
Tailwind-Elements React integration into ClojureScript
I am currently trying to use TailWindElements-React in Clojure Script.
In JS an example would look like this:
import React, { useState } from "react";
import { TECollapse, TERipple } from &...
0
votes
1
answer
87
views
Using TWE-React with ClojureScript (import() in cljs)
I am currently trying to use TailWindElements-React in Clojure Script.
In JS an example would look like this:
import React, { useState } from "react";
import { TECollapse, TERipple } from &...
1
vote
1
answer
97
views
Counting items within indexed map
How do you index and count items within an indexed map? Here's an example -
I have example JSON data that looks like this -
[ {
"id" : "z1",
"content_type" : "...
2
votes
3
answers
144
views
Are there any way to treat Javascript methods like ClojureScript functions?
I like ClojureScript, but to interop between CLJS and Javascript is difficult. I would like to create a function that can perform date culculations in arbitrary units, such as the following. But this ...
0
votes
1
answer
115
views
What difference between syntax-quote in Clojure and syntax-quote in Clojurescript?
In Clojure REPL:
(macroexpand-1 `(sum 2 1)) ; (user/sum 2 1)
In Clojurescript REPL:
(macroexpand-1 `(sum 2 1)) ; AssertionError: Assert failed: Argument to macroexpand-1 must be quoted
Why it ...
0
votes
2
answers
133
views
Shadow-cljs requiring react-select Creatable component
Currently I'm requiring using ["react-select" :default Select] in order to create a component:
(def dropdown-standard (ra/adapt-react-class Select)) (this works perfectly)
I want to access ...
0
votes
1
answer
103
views
CSS File Import Fails when using Path in ClojureScript Project
I am working on an Electric Clojure project and I need to import a CSS file to style my application.
I add styles using dom/element and it works but the code looks so crowded. What is the best way to ...
1
vote
2
answers
376
views
Best Practice for Storing Login Credentials in ClojureScript
In ClojureScript, I initially stored login credentials and authorization information in an atom state. However, I encountered a persistent issue where the atom state gets flushed upon page refresh, ...
2
votes
1
answer
198
views
How do I apply a PostgreSQL function to a query using Clojure?
(ns training-clj.querys
(:require [honey.sql :as honey]
[next.jdbc.sql :as jdbc]))
(defn get-by-username
[db username]
(let [query (honey/format {:select [:*]
...
3
votes
1
answer
155
views
Clojure/ClojureScript: How to plug in custom print implementation for EDN tag literals?
I have a record, an instance of and I print it to EDN string:
(ns my)
(defrecord Ref [type id])
(def rich (->Ref :Person 42)
(pr-str rich)
I would like to get "#my.Ref [:Person 42].
But I get ...
1
vote
1
answer
156
views
Implementing a graph in clojurescript
I have been trying to implement a graph in clojurescript , I am using c3.js library for the implementation and it’s failing to render the graph ,
I earlier got errors wrt c3.generate(), but even after ...
0
votes
1
answer
88
views
Clojure(Script) higher order function to accept only functions from certain namespace
I'm trying to define a function (or macro) which should only accept as arguments functions from a certain namespace
(ns ns1)
(defn high-function[f & params]
(if (condition on f meta ...
0
votes
1
answer
97
views
How can I stop my clojurescript app from blocking browser events while running?
Background
For reference, I am building a little ECS game engine with:
clojure
threejs as one of the graphics targets
shadow-cljs for builds
The full code for the example can be found here.
Problem
...
1
vote
1
answer
105
views
Reagent + Ring full stack Clojure + ClojureScript app receiving 403 `Invalid anti-forgery token`
I am trying to set up a full stack Clojure and ClojureScript web app. I am using Reagent and Ring but am running into a 403 error when I try post data using promesa.
On the ClojureScript side I have ...
1
vote
1
answer
216
views
WebAssembly Image manipulation with ClojureScript
Request detail:
We want to do some image manipulation and conversion, in the browser.
We prefer WebAssembly, because of its runtime efficiency.
We want to use ImageMagick, because it can read SVG, Ai, ...
1
vote
0
answers
101
views
How can I send an input in a page to another page with hyperfiddle Electric via using query url
I use Electric Clojure for creating web applications. I want to get an input from the client and redirect to another page with url query parameter and show the input redirected page.
I tried Ring ...
1
vote
3
answers
169
views
How to make stateful Clojure code pure without excessive repetition?
I'm writing a Clojure library to generate Voronoi diagrams using the quad-edge data structure as described in this research paper. I was using refs to represent the edge records, but I wanted to ...
2
votes
1
answer
218
views
Deploying fullstack app with Github Actions (Go + ClojureScript)
I was able to build both the JavaScript bundle, and the Go binary. But, I'm currently unable, due to lack of knowledge, to make the Go server run for the backend, and to display the public/index.html ...
1
vote
1
answer
73
views
Reagent material ui paper elevation
I don't know how to set the elevation for materia-ui paper in reagent-material-ui (https://github.com/arttuka/reagent-material-ui)
Paper elevation in Material UI: https://mui.com/material-ui/react-...
-1
votes
1
answer
130
views
How can I implement kafka consumers in cljs app? [duplicate]
I am working on a project that involves implementing a Kafka messaging bus for resiliency along with SQS in my app. The backend services are developed in CLJ and the frontend script is in CLJS. I have ...
1
vote
1
answer
581
views
How to access the body of a request as a key map in clojure ring server
I have a clojure ring server which I want to post data to so I can do stuff in my database such as add, update and delete users. I'm currently stuck on receiving the body in a format I can ...
1
vote
0
answers
372
views
How to import npm pacakge from clojurescript?
Something confuse me when trying use clj command line tools to compile and bundle clojurescript with npm modules.
My clj command :
clj -M --main cljs.main \
--repl-opts "{:launch-browser ...
-1
votes
2
answers
126
views
Kafka consumers in Clojurescript lang
Is there a way to create kafka consumers in a clojurescript app that I am trying to create. My kafka cluster is at AWS MSK which is configured to use SASL_SSL/IAM auths. And my client-side application ...
0
votes
2
answers
270
views
Trigger onchange event of input in Reagent app
How can I trigger the onchange event of a controlled input in a Reagent application?
[:input {:on-change (fn [e] ...) :id :my-input}]
Reagent implements React and the input components are Controlled ...
1
vote
1
answer
280
views
Leaflet React Markercluster - packages not working in ClojureScript
I want to use a cluster plugin for Leaflet. Since I am using ClojureScript I guess I need a React implementation. I have tried all of the available packages at npm. They all fail at one point or ...
1
vote
1
answer
308
views
How can I use ClojureScript's Hiccups library in nbb
I am using the example from the nbb docs on calling nbb from node, which works as expected, generally, using the following (slightly modified) snippets:
;; example.cljs
(ns example)
(defn greet [name]...
-1
votes
1
answer
392
views
Call smart contract method with WalletConnect v1 and ethers.js provider on mobile in Clojure
Here I would like to allow calling a method of my smart contract from a ethers provider that uses WalletConnect.
I proceed as follows to connect a user to WalletConnect :
(ns my.project
(:...
1
vote
1
answer
120
views
In ClojureScript, What is the difference between `int?` and `integer?` and `number?`?
In ClojureScript,
What is the difference between int? and integer? and number? ?
0
votes
1
answer
565
views
How to import a shadow-cljs project into another shadow-cljs project with a different configuration
I currently have 2 shadow-cljs projects with 2 different ways to manage their dependencies to npm libraries.
One uses the default shadow-cljs.edn configuration :js-options {:js-provider :shadow}, we ...
0
votes
1
answer
218
views
Interpret HTML String from re-frame clojurescript app
I want to connect an re-frame clojurescript app to a headless content manager to get posts. The content is returned to me as a string with HTML tag - something like below:
<h1>dsfdsfdsf</h1&...
0
votes
1
answer
563
views
WalletConnect v2.0 library integration issues with shadow-cljs
I am currently trying to use the WalletConnect v2.0 library using Web3Modal SDK in a clojuscript project with shadow-cljs. To do this I followed the standalone installation: Web3Modal Standalone ...
0
votes
0
answers
117
views
clojurescript base-url / prefix-url in routing using bidi and pushy
I'm implementing routing in clojurescript SPA (built using reagent and reframe). For routing i'm using bidi and pushy. Below is my code for routing.
(def routes
["/" {"" ...
1
vote
2
answers
183
views
Translating and importing Joy UI dark mode to ClojureScript
I am trying to use Joy UI and its dark mode https://mui.com/joy-ui/customization/dark-mode/ in my cljs project and am stuck with translating the part below to cljs code.
import * as React from 'react';...
1
vote
2
answers
56
views
ClojuresScript not applying class values with click
I have the following over-engineered code that displays 2 buttons on a page, but when I click on a button nothing happens.
I'm using reagent (r) and mui (m).
(defn settings [id]
(let [active "...
1
vote
0
answers
184
views
Cannot get REPL prompt with figwheel-main and Clojure Tools
My goal is to have a ClojureScript REPL (targeting Node.js) using Figwheel and Clojure Tools (not Leiningen). But when I launch Figwheel it seems to start correctly but never completes.
deps.edn
{:...
3
votes
1
answer
86
views
How to pass the variable name as a string to a function? (ClojureScript)
Description of the situation
I want to make a form template for an element, but they must be dynamically created. The meta data involved in the Component should use the variable-name passed as it's ...
0
votes
1
answer
82
views
How to animate a dom tree in re-frame without recreating that whole tree?
In my re-frame app, I have a non-trivial svg that is animated. Currently, every animation "frame" means recreating the whole svg, although only the style="display: none" of one ...
0
votes
1
answer
52
views
How to explain this arrangement for :cljsbuild on a Clojure/ClojureScript project? And how to extend it for Continuous Deployment?
I have been dealing with this Clojure/Clojurescript project called clojurescript.csv.
On the project.clj file there is a special form of construction for :cljsbuild which I haven't seen yet.
:...
1
vote
1
answer
211
views
Is there any difference on how to declare a ClojureScript dependency on shadow-cljs.edn file?
I have been working on a Clojure/ClojureScript project and something intrigues me.
On the shadow-cljs.edn file, there is a declaration of the
dependencies. As you might see below, some of them have &...
1
vote
2
answers
174
views
Why does updating my nested Reagent component not update it?
I have a triply nested component (in different files) in Reagent + ShadowCLJS. When editing and saving this file, the changes don't show immediately until editing and saving the parent component.
For ...