clojure_filter

1 answer

Simplify a filter clause with many predicates that depend on context

I am new to Clojure and am still trying to wrap my head around doing things the "Clojure way". One function that I'm currently writing requires me to filter a collection (pile) with several ...

1 answers | 15 mins ago by DaGaMs on Stack Overflow stackoverflow.com
3 answers

Need the first 10 multiples of any number in Clojure

We given a task to print the first 10 multiples of any number for which we had written below code. It is throwing an error. In simple words if n is 2 then we need 2 table till 10. (defn multiples [n] ...

3 answers | 18 hours ago by Ashish Jindal on Stack Overflow stackoverflow.com
1 answer

How to properly setup shadow-cljs for hot reload?

I've been trying to get shadow-cljs hot reload to work but I haven't been able to, I've tried multiple settings in my project.clj file but none have worked. This is what my project.clj looks like: ...

1 answer

Filtering a list in dependence of that list in clojure

Suppose you have the following code to get all primes until a parameter: (defn my-filt [x z] (or (not= 0 (mod z x)) (= z x))) (defn my-filter [y x] (filter (partial my-filt x) y)) (defn ...

1 answers | yesterday by David on Stack Overflow stackoverflow.com
2 answers

Import dependency “clojure.tools.trace” to REPL in Clojure failed: File not found

I'm new to Clojure, trying to debug my program with the function trace. I tried this in REPL: (require '[clojure.tools.trace :as trace]) But it throws an exception: Execution error (...

3 answers

DSL in Clojure that replaces an object-oriented software solution?

I was wondering wether anyone knew of a concrete example of a DSL in Clojure which replaces the abstraction and readability of a good OO program (written in, say , Java). I've been trying to take an ...

1 answer

CLOJURE: How to find date-diff in days and also optimized way of doing nested loop in Clojure

I am a newbie to Clojure and trying to do some simple validation to verify courses completed by a students are having gap in days, if so then how many days. Wanted to iterate over the courses and find ...

1 answers | yesterday by pravin nair on Stack Overflow stackoverflow.com
1 answer

Split 100% in a given number of columns width random width

i want to split 100% in a given number of columns. but the width of the columns should be random. here is my first try. but it's static to 5 columns. any ideas to make it dynamic? (defn create-columns ...

1 answers | yesterday by MrD on Stack Overflow stackoverflow.com
2 answers

Function for the maximum index of vector in clojure

Hi I'd like to ask how to get the maximum value of index from Vector in clojure? (def dummyvector [190 260 300 310 250]) I have dummyvector here, index 0 = 190, 1 = 260 ... I know the maximum is ...

2 answers | 2 days ago by Adrian Imanuel on Stack Overflow stackoverflow.com
1 answer

How to save the file in the server?

I'm receiving the following request in the server that I'm extracting using (-> req :params): ...

1 answers | 2 days ago by zendevil on Stack Overflow stackoverflow.com
2 answers

How to write an Clojure macro to get var's value?

user=> (def v-1 "this is v1") user=> (def v-2 "this is v2") user=> (defmacro m [v] (symbol (str "v-" v))) user=> (m 1) "this is v1" user=> (m 2) ...

2 answers | 2 days ago by jamesqiu on Stack Overflow stackoverflow.com
3 answers

When to use a Var instead of a function?

I am going through the book Web Development with Clojure and it tells me to pass the handler (defined bellow) as a Var object instead of as the function itself, since the function can then change ...

3 answers | 2 days ago by Maurex on Stack Overflow stackoverflow.com
1 answer

idiomatic path for leiningen test data

By convention, where is data accompanying test typically stored in Leiningen projects? Some possibilities include: <project_name>/test/<project_name>/data/, ...

6 answers

Alternate version of swap! also returning swapped out value

I talked about this a bit on IRC's #clojure channel today but would like to go more in detail here. Basically, in order to better understand atoms, swap!, deref and Clojure concurrency as a whole, ...

2 answers

Clojure Running Multiple Threads with Functions with zero or one input

I'm experimenting in Clojure with running independent threads and I'm getting different behaviors I don't understand. For my code editor I'm using Atom (not emacs), REPL is Chlorine. I'm testing a ...

1 answer

Size of uploaded video is 0 on the server, even though the video has a size

I have the following re-frame event handlers with which I’m trying to upload a video to the server: (reg-event-fx :upload-shot-video-server (fn [coeffects [_ blob]] (let [body (js/FormData.)] ...

4 answers

Read project name and version from Leiningen project.clj file

How can I query the project group, name and version from a Leiningen project.clj file using only lein and simple command line utilities without modifying the project file? I could not find anything ...

4 answers | Jan 23 at 0:11 by erdos on Stack Overflow stackoverflow.com
1 answer

Clojure java class casting

Is it possible to cast in clojure with java style? This is java code which I want to implement in clojure: public class JavaSoundRecorder { // the line from which audio data is captured ...

1 answers | Jan 22 at 21:43 by ilya.stmn on Stack Overflow stackoverflow.com
1 answer

How to generate JWT exp claim with java-time?

Most examples for JWT token use clj-time which is now deprecated in favor of native java.time. I'm trying to use java-time along with buddy to sign/verify tokens but I'm stuck trying to pass the exp ...

1 answers | Jan 22 at 19:22 by stigma on Stack Overflow stackoverflow.com
4 answers

In Lisp (Clojure, Emacs Lisp), what is the difference between list and quote?

From reading introductory material on Lisp, I now consider the following to be identical: (list 1 2 3) '(1 2 3) However, judging from problems I face when using the quoted form in both Clojure and ...

4 answers | Jan 22 at 15:02 by neo on Stack Overflow stackoverflow.com
0 answers

How to correctly send a video to the server?

I am uploading a video to the server like so: (reg-event-fx :upload-shot-video (fn [coeffects _] (prn "uploading video") (let [video {:uri (-> coeffects :db :shot-video-uri)} ...

2 answers

Can I reference a macro from within a macro in Clojure?

Clojure. Cursive. REPL. Windows 10. All up-to-date. Here's my 'base' macro: (defmacro PutProp! [Sym Val PName] `(reset-meta! (var ~Sym) (assoc (meta (var ~Sym)) ~PName ~Val))) I have no idea if ...

2 answers | Jan 22 at 0:25 by LionelGoulet on Stack Overflow stackoverflow.com
2 answers

Clojure: how to make a leiningen build reproducible?

Introduction As stated on reproducible-builds.org, it's a best-practice to be able to produce a build which can be re-created when given equal source code by anyone on any machine/os, at any time. How ...

2 answers | Jan 21 at 21:53 by Bran van der Meer on Stack Overflow stackoverflow.com
2 answers

Equality of vectors in clojure

I was trying to solve this problem https://www.4clojure.com/problem/32 and I realized that this statement gave output as false. (= (#(into [] (distinct %)) [1 2 3]) '(1 1 2 2 3 3)) It is ...

2 answers | Jan 21 at 21:06 by Natsu on Stack Overflow stackoverflow.com
1 answer

How to pretty print a Clojure data structure in HTML?

How to make the following code generate a similar visualization to pprint in HTML? (let [clj-structure {:ui {:selected #{[:A 3]}} ...

1 answers | Jan 21 at 19:48 by Jp_ on Stack Overflow stackoverflow.com
1 answer

Getting Execution error (StackOverflowError) when evaluating a function on larger range of values

I'm learning Clojure and solving exercises from SICP book in the process. I get this error when evaluating (search-for-primes 1001 10000) but when called on smaller values (search-for-primes 101 1000) ...

1 answers | Jan 21 at 7:15 by shekhar on Stack Overflow stackoverflow.com
1 answer

core.async go block with outside bound symbols works but does not macroexpand

for the past few weeks I’ve been working with “core.async” in Clojure and Clojurescript, wondering if it is a good idea to use outside bound symbols inside a go as there is a pool of threads and ...

2 answers

More idiomatic pattern in clojure than using instance? to dispatch on type

I have the following pattern that I am trying to implement: I have an AST and 2 Generators, one for C# and one for VB. A generator takes the provided AST as input and generates source code in the ...

2 answers | Jan 20 at 12:12 by Rouan van Dalen on Stack Overflow stackoverflow.com
2 answers

Combine functions for same collection

I just start learning Clojure, and I get used in other functional language create some pipelines with functions like val result = filter(something) map(something) reduce(...

2 answers | Jan 18 at 11:03 by paul on Stack Overflow stackoverflow.com
4 answers

Clojure: How do you apply a function to values at a specific nesting level?

I'm a beginner at Clojure so I'll do my best to phrase this as well as I can, I have a function that returns a list of nested lists after parsing a dataset of daily temperatures, each nested list ...

4 answers | Jan 18 at 8:08 by Ben Webb on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3