Questions tagged [clojure]
Clojure is a general-purpose language supporting interactive development that encourages a functional programming style, and simplifies multithreaded programming.
                91 questions
            
            
            
                -3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                157
            
            views
        
        
            
            
            
        How can we handle inserts/delete cases using Map like data structures in FP?
                    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 ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                118
            
            views
        
        
            
            
        In clojure, how to structure a simple reverse file search function to make it unit testable
                    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
...
                
            
       
        
            
                -2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                505
            
            views
        
        
            
            
        Is Clojure a wrong choice for implementing Data Structures?
                    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 ...
                
            
       
        
            
                1
            
            vote
        
        
            
                0
            
            answers
        
        
            
                87
            
            views
        
        
            
            
        How Functional Programming addresses concurrent increment/decrement operations invoked by different users? [duplicate]
                    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 ...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                919
            
            views
        
        
            
            
            
        How Functional Programming addresses concurrent increment/decrement operations invoked by different users?
                    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 ...
                
            
       
        
            
                37
            
            votes
        
        
            
                7
            
            answers
        
        
            
                9k
            
            views
        
        
            
            
            
        What are the functional equivalents of imperative break statements and other loop checks?
                    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(...
                
            
       
        
            
                2
            
            votes
        
        
            
                3
            
            answers
        
        
            
                965
            
            views
        
        
            
            
            
        Can functional programming used for solving problems which require randomness?
                    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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                309
            
            views
        
        
            
            
            
        Should I provide partialed functions based on API call in Clojure?
                    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:
(...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                208
            
            views
        
        
            
        Efficient algorithm for deducing object type dynamically based on members
                    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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                0
            
            answers
        
        
            
                441
            
            views
        
        
            
        Clojure: Decomposing Logging, Metrics, and Business Logic from a Function
                    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 ...
                
            
       
        
            
                12
            
            votes
        
        
            
                1
            
            answer
        
        
            
                2k
            
            views
        
        
            
            
        What practical problem results from lack of hygienic macros in Clojure?
                    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 ...
                
            
       
        
            
                14
            
            votes
        
        
            
                3
            
            answers
        
        
            
                6k
            
            views
        
        
            
            
        If you can use def to redefine variables how is that considered immutable?
                    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 ...
                
            
       
        
            
                2
            
            votes
        
        
            
                0
            
            answers
        
        
            
                390
            
            views
        
        
        Implement FSM explicitly in re-frame/reagent/react?
                    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 ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                195
            
            views
        
        
            
            
            
        How can you write an activation function in a neural network to handle a layer architecture of arbitrary dimensions?
                    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]    ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                222
            
            views
        
        
            
        Clojure NameSpace Design
                    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 ...
                
            
       
         
        