Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [clojure]

Clojure is a Lisp dialect for the Java Virtual Machine. Its main features include a software transactional memory system for coherent updates to data structures, transparent access to Java libraries, a dynamic REPL development environment, runtime polymorphism, and built-in concurrent programming constructs.

Filter by
Sorted by
Tagged with
2 votes
1 answer
44 views

A better way to parse text input in Clojure

I've been trying Advent of Code challenges to learn Clojure. I've successfully completed Day 2, but I feel like my solution is very clumsy, especially the functions for parsing text input. ...
Dušan Rychnovský's user avatar
0 votes
1 answer
35 views

Reduce run time in Clojure

I have a task which runs sequentially. If I have hundreds of thousands of tags, it is very time consuming. Can this be modified to run the task in parallel? Works fine upto 100 tags ...
Bindiya H's user avatar
  • 101
1 vote
1 answer
51 views

Client <> Query <> Subquery Bookkeeping

Context I am making a system, where different clients issue queries A query is resolved by issuing a set of subqueries I have an invalidation-worker, which gets notified when subqueries go stale ...
Stepan Parunashvili's user avatar
2 votes
1 answer
171 views

Clean up improperly formatted phone numbers

This is a problem from Exercism here, the goal is to clean up badly formatted phone numbers. The rules are: If the phone number is less than 10 digits assume that it is a bad number If the phone ...
Josh Friedlander's user avatar
1 vote
1 answer
119 views

Get city weather and notify an endpoint

I'd like some help to improve this cli program. It queries a city's weather and pushes a weather report. It takes two arguments: the city to query and the apikey for OpenWeatherMap. For example ...
Pablo's user avatar
  • 95
1 vote
2 answers
105 views

Temperature Scale Converter in Clojure

Problem statement: Write a program that converts all given temperatures from a given input temperature scale to a given output temperature scale. The temperature scales to be supported are Kelvin, ...
Christian Hujer's user avatar
2 votes
1 answer
80 views

A Clojure program to classify files based on their filename

My first ever lines of Clojure and while the script seems to work as expected, I'm sure it's far from idiomatic Clojure. Thank you for any suggestions. ...
Dušan Rychnovský's user avatar
1 vote
2 answers
229 views

Clojure Prime Numbers from 1 to 1000

I am a beginner to Clojure and I made a little script that prints out every prime number from 1 to 1000. Let me know if there are any improvements that I can make: ...
code writer 3000's user avatar
3 votes
1 answer
194 views

Game of Life in Clojure

I've implemented a Game of Life in Clojure and would like to understand what I can do better, especially in terms of idiomatic Clojure (without losing readability/maintainability) of the current ...
Christian Hujer's user avatar
1 vote
2 answers
173 views

Verify Armstrong Number in Clojure

Background I am doing an exercise in clojure to make a function that can determine if a number is an Armstrong Number or not. The solution I came up with us a bit more complicated than it would be if ...
Billy Moon's user avatar
1 vote
1 answer
71 views

Factorise numbers

I've started learning Clojure a few days ago and I wrote this code that factorises numbers. How do I make it better? Is there any way to avoid doing it with a loop? Is that how I am supposed to code ...
Likepineapple's user avatar
5 votes
1 answer
261 views

Hackerrank: Breaking the records

I'm learning Clojure and am a rank n00b at it, trying to learn from books and online tutorials (but I'm sometimes concerned that I am picking up bad habits or at least not all the good habits). For ...
frIT's user avatar
  • 153
4 votes
1 answer
153 views

My implementation of Clojure's assoc-in

This is my implementation of Clojure's assoc-in function. I am looking for tips on making it more idiomatic and in general, better. ...
Navarro's user avatar
  • 165
2 votes
0 answers
101 views

Why does my Clojure implementation of Conway's Game of Life run so much slower than my Java implementation?

I'm trying to learn Clojure coming from a Java background. I have written a simple implementation of Conway's game of life in both Clojure and Java, trying to keep the overall structure of the code as ...
clojHalp3k's user avatar
1 vote
1 answer
179 views

Prime factors kata solution in Clojure

I'm new to Clojure but I already know about functions and lists, so I decided to implement Prime Factors Kata solution. For any natural number the function should return a list of all its prime ...
xuesheng's user avatar
  • 367
2 votes
1 answer
78 views

naive bayes sentiment analysis classifier in clojure

attaching my try on implementing simple naive-bayes classifier for sentiment analysis as part of learning clojure and using functional programming on ML algorithms. I tried to invest more time in ...
a.k's user avatar
  • 151
3 votes
0 answers
77 views

Brainfuck NASM compiler in Clojure

I've made a simple brainfuck compiler, I feel like my code is unreadable and messy, how can I improve it? src/core.clj ...
jacadzaca's user avatar
3 votes
1 answer
450 views

Constructing a packet header

I am currently working on writing a library for use with LIFX light bulbs over their UDP API. I have written the code for creating the packet headers, but I'm unsure whether it is the most idiomatic ...
adzy2k6's user avatar
  • 33
6 votes
1 answer
266 views

Clojure depth first search maze problem from Classic CS Problems in Python Book

I am an experienced self-taught professional Python programmer working my way through the book Classic Computer Science Problems in Python to try to catch myself up on some of the things I missed by ...
user5293's user avatar
  • 163
1 vote
1 answer
88 views

Check balanced brackets

Yes, I know we have a lot of these. I'm new to Clojure, but not to lisps. After the recent (javascript?) parentheses-balancing Q, I decided to do an implementation in Clojure for practice with the ...
D. Ben Knoble's user avatar
2 votes
1 answer
239 views

Filtering vector of maps based on a blacklist

Given a vector of maps: (def my-list [{:a 1 :b 2 :c 3} {:a 1 :b 5 :c 6} {:a 7 :b 8 :c 12} {:a 10 :b 11 :c 12}]) and a blacklist: ...
Alexander Popov's user avatar
3 votes
1 answer
82 views

Count Words in Quotes Fetched from Website

I have solved the following exercise and would like to get some feedback on my implementation. Create a function that uses futures to parallelize the task of downloading random quotes from https://...
JDurstberger's user avatar
2 votes
1 answer
54 views

A program that expands a list of maps and chooses a random element

This is the essence of chapter 3 of "Clojure for the Brave and True". This program is about completing the list asym-hobbit-body-parts by adding a given number of ...
Uzaku's user avatar
  • 123
3 votes
1 answer
82 views

Get list of new questions from Stack Overflow

I would like to write a little pet project using Clojure to study it, something like Stack Overflow client. Here is a my first code to get list of new questions from site. I am in the very beginning ...
ceth's user avatar
  • 792
1 vote
0 answers
46 views

Clojure test for Git operations

Is this code a good test for a testable Clojure code? ...
Amanuel Nega's user avatar
1 vote
2 answers
174 views

Combined looping and recursion when implementing Quicksort, using proper Clojure style

In "The Joy of Clojure", 2nd edition, code for quicksort is introduced on page 133 that I found hard to digest. I have rewritten it to make it clearer (at least to myself). Here is the original: <...
David Tonhofer's user avatar
2 votes
1 answer
52 views

Table of employee with end of mission visual clue

to learn Reagent, re-frame and spec I made a little personal project. Description: Given a ...
Julien Rousé's user avatar
4 votes
1 answer
73 views

Langton's ant in Clojurescript

The weekly coding challenge in Eric Normand's newsletter this week involves implementing Langton's ant. I wanted something on my screen so I put together a simple re-frame app. The core functions ...
nakiya's user avatar
  • 235
4 votes
2 answers
128 views

Extract indices of visible nodes in a tree where only some nodes are expanded

A program that I work on constantly updates and modifies program state containing an arbitrarily deep and wide tree. The data looks something like this. ...
clartaq's user avatar
  • 247
4 votes
1 answer
85 views

n-puzzle in Clojurescript

I'm in the process of creating a n-puzzle solver in Clojurescript. I have the basic model up and running and can move tiles on the screen. I plan to implement A* or such an algorithm to solve a given ...
nakiya's user avatar
  • 235
2 votes
1 answer
60 views

Picking a random point along the edge of an area

I'm writing a Diffusion-limited aggregation simulation, and need to pick a random point along the edge of an area defined by a dimension pair of [width, height]. ...
Carcigenicate's user avatar
5 votes
2 answers
788 views

Parsing infix expressions in Clojure

I'm trying to teach myself Clojure by reading the Brave Clojure book online, and at the end of Chapter 7 there is an exercise to parse a mathematical expression written as a list in infix notation to ...
Eric Zhang's user avatar
2 votes
1 answer
37 views

Using deftype to create a wrapper class for byte arrays

I want to create a wrapper class for byte arrays so that I can use them as keys in fastutil's Object2LongAVLTreeMap. I have ...
Martin Harrigan's user avatar
3 votes
0 answers
458 views

Forest Fire Cellular Automata

I stumbled on the idea of a Forest Fire simulating cellular automata, and decided to try making a version using a full Seesaw UI (a Clojure wrapper over Java's Swing). A short sample of it running is ...
Carcigenicate's user avatar
3 votes
2 answers
85 views

What does the Bob say? (clojure version)

I'm doing the exercices from clojureacademy. Here are the instructions for this one. Bob is a lackadaisical teenager. In conversation, his responses are very limited. Returns "Whatever." if ...
little-dude's user avatar
5 votes
2 answers
295 views

RSS feed viewer in Clojure

This semester a classmate and I visited a course on functional programming in our university. For grading, we've to submit a small project which should be written in Clojure and make use of functional ...
Mario's user avatar
  • 51
2 votes
2 answers
272 views

Project Euler problem 86 taking a long time

I'm trying to solve problem 86 in Project Euler. After some tinkering, I managed to unroll the DP solution into a loop. But still the solution takes >150s to complete. What can I do to improve the ...
nakiya's user avatar
  • 235
0 votes
1 answer
74 views

Naïve Prime Factorization in Clojure Pt. 2

After my last review request, I decided to try and make a "tree" visualization, and thought that I could benefit from making find-prime-factors lazily produce prime ...
Carcigenicate's user avatar
2 votes
1 answer
175 views

Powerset of collection in Clojure

Similar to this question, here's another implementation. Assume the input is already a set. ...
dimid's user avatar
  • 303
1 vote
0 answers
105 views

Naïve Prime Factorization in Clojure

I saw a question about prime factorization on Stack Overflow and realized I had never attempted it before. This was what I ended up with after some playing around and tweaking. I'd like improvements ...
Carcigenicate's user avatar
2 votes
2 answers
174 views

Project Euler #10 (sum of primes less than two million) in Clojure

I'm new to Clojure and using some Project Euler problems to familiarize myself with the language's capabilities. Problem #10 asks to find the sum of all primes less than two million. I wanted to ...
brian_o's user avatar
  • 839
2 votes
1 answer
122 views

Program finds the first almost matching string in a list - Advent Of Code 2018 Day 2 Part 2

Advent of Code 2018, day 2, part 2: The [two IDs you are looking for] differ by exactly one character at the same position in both strings. For example, given the following IDs: ...
Simon Brahan's user avatar
0 votes
1 answer
509 views

Five functions to get the digits of a number

I'm writing a simple function: given a number, it will return a sequence or a collection of the digits in the number (in the correct order). i.e ...
nakiya's user avatar
  • 235
2 votes
2 answers
287 views

Project Euler #49: Find 12-digit number concatenating a three terms sequence

First of all, project Euler has been a great help for me to learn Clojure. I tried for months trying to get web projects going but ended up frustrated with and struggling with tooling and libraries ...
nakiya's user avatar
  • 235
0 votes
2 answers
125 views

Project Euler 23 implementation

This code to solve Problem 23 in Project Euler gives the correct answer. But, running the last expression takes around 40 seconds. I welcome advice on how to improve performance here. ...
nakiya's user avatar
  • 235
1 vote
2 answers
105 views

Classic "100 doors" simulation in Clojure

I read this question about the "100 Doors" puzzle, and thought that it would make for a good quick exercise. I ended up with two implementations. The first is more straightforward and uses a vector ...
Carcigenicate's user avatar
1 vote
2 answers
84 views

Recamán Sequence (A005132)

I'm going to screw around with visualizing Recamán's Sequence, but want to have a good sequence generator to generate the sequence before I start. I want to use a lazy generator for my actual ...
Carcigenicate's user avatar
5 votes
1 answer
343 views

A* in Clojure - trickier than I expected

While working through some coding puzzles to brush up on Clojure, I encountered the need to use A* on some search problems. I tried to implement it from first principles/memory and that didn't go ...
Solaxun's user avatar
  • 153
7 votes
1 answer
195 views

Avoid incoming meteors

I'm visiting a functional programming course at my university which has a small project for examination. The language we are using is clojure and the contents of the lecture have mostly been about it'...
Niklas's user avatar
  • 73
0 votes
1 answer
101 views

All of Clojure's Expression Threading Macros

I was bored and in a mood to write some macros, so I decided as an exercise to try and remake each of the standard threading macros: ->, ...
Carcigenicate's user avatar

1
2 3 4 5
7