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.
309 questions
3
votes
1
answer
321
views
Web service to add a phone number with SMS validation
I'm new to Clojure. How can I make this more idiomatic Clojure code? Among other things, there are three (do) blocks and I don't think using (def) as many times as I do is a recommended idea.
...
4
votes
1
answer
512
views
A crude clojure progress reporting function
The purpose of this function is to report processing progress to the terminal. It loops through an array of maps that contain two properties: :sequence and ...
4
votes
1
answer
315
views
Lazy look and say sequence
I have been solving a set of online Clojure problems. One of them involves the look and say sequence.
...
2
votes
3
answers
209
views
From enumerator to map
I have an mail object that returns its headers as an Enumerator of Header objects, which have two methods, getName and getValue. I need to convert that to a nice Clojure map so I wrote this short ...
6
votes
3
answers
417
views
Finding the sum of the digits appearing in the leaves via in-order traversal
The following text is an in-order traversal of a binary tree with 1023
nodes. What is the sum of the digits appearing in the leaves?
How can I improve this Clojure code? It looks strange to me to ...
3
votes
2
answers
448
views
Searching for repeated characters in a sequence of characters
The following code solves this problem:
The 3072 characters below contain a sequence of 5 characters which is
repeated. However, there is a twist: one of the sequences has a typo.
To be specific,...
7
votes
3
answers
2k
views
Partitioning strings into substrings of fixed length
I've got a Clojure function here that's meant to parse a string of form:
"DDXXXYYY"
where DD is meant to be discarded, and XXX and YYY are string representations of integers.
...
13
votes
3
answers
600
views
Reservoir Sampling in Clojure
I am learning clojure and decided to start out by trying to write a solution to a fairly simple algorithm, reservoir sampling. As I stated, I am learning clojure specifically and problem solving in a ...
26
votes
3
answers
2k
views
Project Euler Problem 2 in Clojure
I am in the process of learning Clojure. I am fairly new to functional programming and would like to know if my code smells or if there are any performance implications with my approach.
...