Skip to main content

Questions tagged [clojure]

Clojure is a general-purpose language supporting interactive development that encourages a functional programming style, and simplifies multithreaded programming.

Filter by
Sorted by
Tagged with
-3 votes
2 answers
159 views

Let's say, that we keep track of students entering the auditorium using their IDs(Key) and their check-in time(Value) in a Map. We delete the entries once they move out of the auditorium. I want to ...
Vicky's user avatar
  • 399
0 votes
1 answer
119 views

I have the following pair of functions used for searching upwards for a configuration file: (defn has-config? [path] contains? (set (.list path)) "my-config") (defn find-config-path [path] (cond ...
pob's user avatar
  • 119
-2 votes
1 answer
506 views

I am planning to improve my knowledge of Clojure and algorithms at the same time by implementing some known data structures in Clojure (e.g. linked lists, skip lists, bloom filter, etc.). However, I ...
Attilio's user avatar
  • 487
1 vote
0 answers
87 views

Using Functional language, How can 2 different parties achieve the result of increment/decrement operations concurrently? For the below scenario, Let's say, I've 2 quantities in stock and 2 users in ...
Vicky's user avatar
  • 399
1 vote
2 answers
921 views

Using Functional language, How can 2 different parties achieve the result of increment/decrement operations concurrently? For the below scenario, Let's say, I've 2 quantities in stock and 2 users in ...
Vicky's user avatar
  • 399
37 votes
7 answers
9k views

Let's say, I've the below logic. How to write that in Functional Programming? public int doSomeCalc(int[] array) { int answer = 0; if(array!=null) { for(...
Vicky's user avatar
  • 399
2 votes
3 answers
969 views

This older question tells us that in functional programming "true" randomness cannot be achieved since in FP functions are pure/idempotent and return the same value irrespective of number of ...
Vicky's user avatar
  • 399
3 votes
2 answers
309 views

I am designing a library to wrap an API with Clojure. The API requires user credentials to authenticate user related calls. My first approach was to have functions that do each task the API can do: (...
Moon Cheesez's user avatar
3 votes
1 answer
209 views

I am designing a DSL (in clojure, specifically; though this question is more general than that) in which 'entities' are tracked as immutable hashes/maps, and where the 'concept' membership of an ...
nben's user avatar
  • 345
3 votes
0 answers
441 views

I was reading the post A Modern Architecture for FP that included a code snippet that the author wanted to decompose further. I don't know Haskell but I recognize enough to know that I've written many ...
MonkeyWithDarts's user avatar
12 votes
1 answer
2k views

I've heard that Clojure macros are easier to write but not as reliable as Racket's hygienic macros. My question has 2 parts: How does gensym differ from hygienic macros? What do Racket macros provide ...
Alex's user avatar
  • 284
14 votes
3 answers
6k views

Trying to learn Clojure and you can't help but be told continually how Clojure is all about immutable data. But you can easily redefine a variable by using def right? I get that Clojure developers ...
Evan Zamir's user avatar
2 votes
0 answers
390 views

I'm in the process of making a simple game using re-frame (and thus react and reagent), but I'm stuck at one point. In https://github.com/Day8/re-frame#control-via-fsm they claim Not every app ...
NiklasJ's user avatar
  • 675
3 votes
1 answer
195 views

I am making a neural network in Clojure that can take an array of integers,and return a data structure representing the layers of a neural network: so (make-layers [1 4 5]) would evaluate to: [[0] ...
kurofune's user avatar
  • 290
1 vote
1 answer
222 views

I am new to Clojure and trying to get a handle on organizing a project's namespaces. I am working on a solver for the knapsack problem. Currently, I have broken the modules into files, but everything ...
ben rudgers's user avatar
1 vote
0 answers
120 views

I have a modular application written in Java based on NetBeans Modules (those details probably aren't so important :-) ) and I'd like to add another module written in Clojure language. Clojure ...
eMko's user avatar
  • 166
25 votes
7 answers
17k views

In this video by Rich Hickey, the Clojure creator, he advises to use map to represent data instead of using a class to represent it, as done in Java. I don't understand how it can be better, since how ...
Emil's user avatar
  • 359
2 votes
0 answers
418 views

A large part of the vert.x architecture is around the message bus, and message passing between verticals. The main idea I guess being that I can create multiple modules (possibly in multiple languages)...
Kevin's user avatar
  • 1,341
1 vote
1 answer
826 views

I heard a friend say: The first real use of Chris Okasaki's book was in Clojure's data structures I heard another friend say: No, they influenced the design of Scala in quite a subtle way. My ...
hawkeye's user avatar
  • 4,849
11 votes
2 answers
4k views

I am a third year bachelor student in a software engineering program, and I brought up the idea of reading SICP to an adviser to gain a deeper and more fundamental understanding of the principles ...
ironicaldiction's user avatar
7 votes
2 answers
522 views

I have a polyline "class" in my Clojure program, which is represented by a vector of points. (It's not really a class or anything.) The polyline's length (in the geometric sense) is something that is ...
Leonid Shevtsov's user avatar
0 votes
1 answer
60 views

I'm pretty sure there has to be a more idiomatic way of writing this: (defn update-2nd-level-vector [map index value] (assoc map :key1 (assoc (get map :key1) :key2 (-> map (get-in [:key1 :key2]...
m0skit0's user avatar
  • 175
2 votes
1 answer
610 views

I'm using OSGi for some time and I really like the ability to swap/replace components while my application is running. I simply have to build my module and push it to the OSGi container. Is there a ...
Adam Arold's user avatar
  • 1,190
12 votes
1 answer
8k views

What are the key differences between pattern matching in these two languages? I am not referring to syntax, but capability, implementation details, range of use cases and necessity. Scala ...
kurofune's user avatar
  • 290
4 votes
2 answers
464 views

I'm currently learning Clojure (my first functional programming language), and I'm curious as to its order of evaluation. Here is an example: (take 10 (cycle [1 2 3])) If the cycle expression was ...
joecritch's user avatar
  • 143
1 vote
1 answer
188 views

How do I unit test a function that takes a list of maps and returns an HTML table with the same data in Clojure/Hiccup?
Amogh Talpallikar's user avatar
3 votes
3 answers
2k views

I am fascinated to Lisp as it is simple yet powerful. I am just a beginner and I know there have been lots of discussions on removing parentheses from Lisp and its dialects. Yet I request Lisp ninja's ...
user115126's user avatar
3 votes
1 answer
280 views

I just stumbled upon Clojure reducers library. It looks a lot like loop fusion. However the term is not mentioned anywhere on the page. Is there a difference between the two?
Simon Bergot's user avatar
  • 8,030
7 votes
1 answer
1k views

On this blog post aphyr (who is a brilliant programmer) states: Clojure macros come with some important restrictions. Because they’re expanded prior to evaluation, macros are invisible to functions. ...
hawkeye's user avatar
  • 4,849
3 votes
1 answer
625 views

In code quarterly interview with Rich Hickey, Michael Fogus hints that Clojure borrows a lot from Haskell: Fogus: As someone who only knows Haskell enough to read the papers, Clojure appears to be ...
hawkeye's user avatar
  • 4,849
4 votes
3 answers
332 views

When we look at the the overlap between the Ruby Community - we see the following overlaps: Think Relevance (now Cognitect) has switched from Ruby to Clojure Jay Fields has switched from Ruby to ...
hawkeye's user avatar
  • 4,849
3 votes
1 answer
2k views

In the Scala community - there is an apparent fascination with the FlatMap function. Now I understand that FlatMap is significant because it is used for the bind part of a Monad. (and that the ...
hawkeye's user avatar
  • 4,849
7 votes
1 answer
2k views

I'm writing a simple game in Java and I want to learn Clojure, so I've decided to refactor my current Java code to Clojure. The problem is that I've coded so much in object-oriented languages that I ...
m0skit0's user avatar
  • 175
11 votes
2 answers
955 views

According to Command-Query Separation principle, as well as Thinking in Data and DDD with Clojure presentations one should separate side effects (modifying the world) from computations and decisions, ...
Alexey's user avatar
  • 1,269
8 votes
3 answers
1k views

My background is Ruby, C#, JavaScript and Java. And now I'm learning Clojure. What makes me feel uncomfortable about the later is that idiomatic Clojure seems to neglect the Uniform access principle (...
Alexey's user avatar
  • 1,269
20 votes
5 answers
5k views

When looking Python decorators someone made the statement, that they are as powerful as Lisp macros (particularly Clojure). Looking at the examples given in PEP 318 it looks to me as if they are just ...
Profpatsch's user avatar
46 votes
6 answers
10k views

I found this quote in "The Joy of Clojure" on p. 32, but someone said the same thing to me over dinner last week and I've heard it other places as well: [A] downside to object-oriented programming ...
GlenPeterson's user avatar
0 votes
2 answers
274 views

The Clojure docs regarding (reduce f val coll) state: If val is supplied, returns the result of applying f to val and the first item in coll, then applying f to that result and the 2nd item, etc....
Arne's user avatar
  • 153
0 votes
1 answer
2k views

This question could be generalized to any language where the language development is open-source, potentially, but I'm most curious about Clojure specifically. If Clojure (as a language) is open-...
Ben Mosher's user avatar
10 votes
3 answers
5k views

Long running switch cases or if-else-if constructs are avoided in OOP using polymorphism wherever it is applicable. instead of branching by matching a value, branching is done at class-level itself. ...
Amogh Talpallikar's user avatar
8 votes
3 answers
3k views

I am new to Clojure, I am new to Macros and I have no prior background in Lisp. I went on to create my own switch case like form and ended up with this: (defmacro switch-case [v cases default] (if (...
Amogh Talpallikar's user avatar
47 votes
5 answers
10k views

In Rich Hickey's thought-provoking goto conference keynote "The Value of Values" at 29 minutes he's talking about the overhead of a language like Java and makes a statement like, "All those interfaces ...
GlenPeterson's user avatar
0 votes
2 answers
527 views

I'm a web developer, but lately I have been learning Clojure and now I'm interested in creating a p2p application. And since Clojure is a general purpose language, I guess I can just use that. Any ...
ChocoDeveloper's user avatar
13 votes
2 answers
4k views

As mush as FP has done, in the end, all our programs are structured. That is, it doesn't matter how pure or functional we make a them - they are always translated to assembly, so what actually runs ...
MaiaVictor's user avatar
  • 5,860
14 votes
1 answer
4k views

I am new to Clojure. I can understand the code I write but it becomes too difficult to understand it later.It becomes difficult to match parentheses. What are the generic conventions to follow ...
Amogh Talpallikar's user avatar
8 votes
5 answers
4k views

Argument which is always made in favour of Clojure is that. The syntax is simpler and there is only one way of expressing code with no complicated rules. However Scala has loads of different types ...
Amogh Talpallikar's user avatar
10 votes
2 answers
2k views

I've been told in previous questions that functional programming languages are unsuited for dynamic systems such as a physics engine, mainly because it's costly to mutate objects. How realistic is ...
MaiaVictor's user avatar
  • 5,860
14 votes
2 answers
5k views

I am trying to learn Lisp and looking at all the Lisps out there and their differences. I see that in some implementations of Scheme, you can use square brackets interchangeably with round brackets ...
mydoghasworms's user avatar
3 votes
2 answers
2k views

I have a project that will need to handle 1000s of requests a second with a decent amount of processing for each. For the most part, the processing will be done on a list of items, basically ...
tonyl7126's user avatar
  • 297
27 votes
5 answers
12k views

I was wondering about the origins of the "let" used in Lisp, Clojure, and Haskell. Does anyone know which language it appeared in first?
carinmeier's user avatar