# Tagged Questions

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 ...

12 views

### Intersection of two lists in clojure

context: this is somewhat related to project euler problem 5, which is: What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? I apply prime number ...
14 views

### Generate all permutations in Clojure

Given a set, generate all permutations: (permutations #{1 4 5}) => ((5 4 1) (4 5 1) (5 1 4) (1 5 4) (4 1 5) (1 4 5)) Here's what I cobbled together: ...
20 views

### Functional Merge Sort

I just finished this Merge Sort in Clojure, structured according to ex. 22-26 of this workshop. The main question I have can be answered without spending time understanding the code: ...
85 views
+50

### Clojure performance for solving Project Euler 72 (counting proper reduced fractions)

This is a solution of Project Euler 72 in Java. How may proper reduced fractions $\dfrac{n}{d}$ are there, where $n < d \le 10^6$? ...
19 views

### The Miller-Rabin Primality Test in Clojure

I am new to clojure and I wanted to test out my skills by taking an existing implementation written in Python and writing it in Clojure. Concerns My main concerns are where I use ...
23 views

### Eight queens puzzle

Problem In the famous eight queens puzzle, one must place eight queens on a chessboard without letting any queen threaten any other queen. There are 92 (or 12, depending on how you count) solutions ...
60 views

### Adding/removing map values: unsymmetric implementation

I am learning Clojure by implementing a simplistic resource reservation system. At its core are the two functions for placing/canceling reservations for a given resource: ...
85 views

### Print matrix in spiral order

I have a task formulated like this Please print a matrix in spiral order, clockwise from outer rings to inner rings. I decided to implement it in Clojure. ...
44 views

### Wrapping a character code for a Caesar Cipher

I'm writing a Caesar Cipher. To deal with characters being shifted to outside of the "normal" printable ASCII range ([32 126]), I'm having them "wrapped" to the max/...
62 views

### Exercism: clean and format a phone number in Clojure

Problem statement Phone Number Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages. The rules are as follows: If the phone number is ...
53 views

### Formatting a date in ClojureScript

I want to convert strings with the iso date format (2015-08-02) to the default format of our app (2 Aug 2015) in ClojureScript. ...
30 views

### Factoring out a “get-change-set” pattern with Clojure's Records

I'm remaking an old program of mine in Clojure. It involves "Beings" (generic entities capable of attacking and breeding) let loose in a confined space. I've noticed a pattern of taking a record, ...
67 views

### Building blocks of Life

I'm learning Clojure, and decided to write a Conway's Game of Life clone as my starting project. I ended up dicking around for a bit before diving in, and came up with a few functions that I'd like ...
53 views

### Spiral a matrix of size NxN filled with integers from 1 up to and including n^2

I have written a solution in Clojure for the following question: When starting from the number 1 and adding three numbers on each row a 3x3 matrix is formed as follows: ...
62 views

### Clojure counter

I'm learning clojure ref types and was trying to make a robust counter generating function. Is there any error or improvement on the code? is there a simpler way? (I want the function to be thread-...
125 views

### Filling a Boot with CIDER

I'm trying to put together a workflow for building Clojure applications with Boot in CIDER. To test this workflow, I've written a small example application using Seesaw. My project structure looks ...
67 views

### Selecting HTML nodes

I'm new to Clojure, and I'm writing some code that processes HTML. I'm parsing the HTML using clj-tagsoup and then trying to pull out the relevant bits with this function: ...
65 views

### Number of ways to make change for an amount

Task Write a program that, given the amount to make change for and a list of coins prints out how many different ways you can make change from the coins to STDOUT. My approach The number to make ...
57 views

### Matrix Diagonal Difference

Problem Given a square matrix of size N×N, calculate the absolute difference between the sums of its diagonals. Input Format The first line contains a single ...
116 views

Obviously, everyone should use a password manager to generate and store long unique random strings of characters for the vast majority of their passwords. However, one still needs to memorize a master ...
56 views

### Clojure reverse multiple times

I have a piece of Clojure code that reverses a string recursively. It is working but too slow (because I got the problem from Codewars and I cannot validate it ...
43 views

To learn about concurrency in Clojure, I wrote a function that accomplishes the following: Takes a (possibly lazy or infinite) sequence of functions representing tasks to be run asynchronously Runs ...
112 views

### “Curious Numbers” (HackerRank PE 34)

I was inspired by a certain recent question to try my hand at this challenge: Project Euler #34: Digit factorials $19!$ is a curious number, as $1!+9!=1+362880=362881$ is divisible by \\$...
97 views

### Document term matrix in Clojure

This is my very first foray into Clojure (I'm normally a Python-pushing data-type). I'm trying to create a simple term-document matrix as a vector of vectors, out of a vector of strings. For those ...
101 views

### Tracking the bounding box of a map

Context I have a bunch of data points that look roughly like this: ...
111 views

### Adding augmented maps to a vector based on regex text grabbing

This is my latest brain child for clojure, could it be done with less code, cleaner, or in a more re applicable way? I am at a pretty early stage in my clojure learning so an in depth explanation of ...
62 views

### Integer square root

This essentially performs the same function as exact-integer-sqrt in math.numeric-tower. ...
332 views

### Printing binary trees

After writing this answer, I was inspired to try to design a more elegant solution to the problem of printing binary trees. And what better tool with which to seek elegance than Clojure? Overall ...
48 views

### Performance Optimized Project Euler Problem 14 in Clojure

Here is the problem: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting ...
23 views

I'm learning Clojure and I'm doing a little thing that reads direct messages from Twitter using twitter-api wrapper. The code doing that is below. ...
50 views

### Reversing all nested sequences

I'm writing a function that returns all (nested) sequences reversed: ...
80 views

### Project Euler #14 in Clojure (finding long Collatz sequence chain)

I'm working on a Clojure implementation for Project Euler #14, which asks for the initial element, under 106, that produces the longest collatz-sequence chain. I'm trying to make use of every ...
42 views

### Understanding lazy sequence in Clojure

In order to understand how the lazy sequences work in Clojure, I decided to implement the quick-sort example from the "The Joy of Clojure, Second Edition" book simulating lazy sequences in Java. Of ...
52 views

### RLE-like string compression in clojure

There have been already many similar questions to this one (e.g. this and this, just to point two), but I did not find any for clojure. The goal is to compress a string in a RLE-like way: i.e. each ...
266 views

### Shuffle a deck of cards, using the overhand shuffle method

I've started learning Clojure, after many years of Java. As one of a series of exercises, I'm writing a simple card game, and the overhand-shuffle function is shown ...
48 views

### Add an entry to every element in a nested data structure

I currently use a data structure like this: ...
49 views

### Printing a nested data structure in Clojure

I wrote the following code which transforms a nested data structure ...
187 views

### Djikstra's algorithm in Clojure

I'm learning Clojure and I'm interested in areas that could be more idiomatic. The main function is below. If you're interested in the whole lib, check out this. The function operates on a ...
60 views

### Creating and displaying a checkers board

I am learning clojure this week end and just starting to develop a simple checkers engine. I currently coded some basic functions to create the board and display it. I would love to get some feedback !...
55 views

### Visualizing Brainf_ck interpreter in ClojureScript

I have written a working Brainfuck interpreter using ClojureScript, reagent, core.async and dommy. I am not very satisfied with the code, however, in particular the central part of the code - the ...
129 views

### Number factorization in clojure

I'm just a Clojure noob (started learning yesterday). Here is my helloworld program. It factorizes number into primes. Do you have any comments? How could I make this code cleaner and shorter? Maybe I ...
85 views

### Sending mail using nodemailer in Clojure

I'm very new to Clojure/ClojureScript and have a question regarding a "proper" way to express something. This code sends a mail using nodemailer on nodejs: ...
91 views

### Squaring a tree in Clojure

I am working on Problem 2.30 from Structure and Interpretation of Computer Programs. I book is in scheme, but I am doing the exercises in Clojure. The problem is to write code that takes a tree of ...
60 views

### Merge sort in Clojure

I made my own version of merge sort: ...
444 views

### Sum of digits in Clojure

I wrote a simple program to sum the digits of a number in Clojure for learning purpose. Not very complex (I hope) so not adding any explanation. I am a beginner in Clojure so please don't mind ...
84 views

### RabbitMQ RPC client

I'm familiarising myself with RabbitMQ and Clojure, so I looked at the Get Started guide for the former and added the client and server parts for the RPC tutorial. I already got the feedback that ...
87 views

### PMX crossover implementation in Clojure

I'm starting to learn Clojure and as an exercise I've implemented the following functions (written in Java) in Clojure: ...
139 views

### Reading lines from a file in random order

I originally wrote this as an answer to a question on Stack Overflow, but it turned out so nicely that I decided to post it here to see if I can make it even better. ...