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
1
vote
0
answers
41
views
Pure and impure Implementations of CSV parser in Clojure
There are two versions of the CSV parser. The latter seems to be more performant than the former, although the former's code is easier to read.
Variant 1, which parses a string:
...
2
votes
0
answers
68
views
Tic Tac Toe CLI in Clojure
I wrote a command line tic tac toe game in Clojure. I've broken this post into three sections: Feedback Requests, Gameplay, and Code
Feedback Requests
I'm looking for feedback on:
How "idiomatic&...
0
votes
1
answer
64
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
...
2
votes
1
answer
208
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 ...
1
vote
2
answers
149
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, ...
1
vote
2
answers
261
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:
...
1
vote
2
answers
222
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 ...
5
votes
1
answer
297
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 ...
2
votes
0
answers
115
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 ...
2
votes
1
answer
96
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 ...
3
votes
1
answer
461
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 ...
1
vote
1
answer
118
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 ...
4
votes
1
answer
107
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://...
4
votes
1
answer
99
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 ...
2
votes
1
answer
72
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 ...
4
votes
2
answers
169
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.
...
2
votes
1
answer
97
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]. ...
1
vote
1
answer
61
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 ...
3
votes
2
answers
111
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 ...
2
votes
2
answers
309
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 ...
2
votes
1
answer
203
views
Powerset of collection in Clojure
Similar to this question, here's another implementation. Assume the input is already a set.
...
2
votes
1
answer
142
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:
...
2
votes
2
answers
335
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 ...
1
vote
2
answers
163
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 ...
5
votes
1
answer
384
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 ...