Skip to main content

All Questions

Tagged with
2 votes
0 answers
28 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&...
cgoates's user avatar
  • 175
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
2 answers
230 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
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
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
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
220 views

Implementing parser combinators in a functional manner

I am just starting on my journey of learning clojure (I have just read to the end of chapter 3 in clojure for the brave and true). So for practice, I wrote some parser combinator functions. I am quite ...
user1762507's user avatar
3 votes
1 answer
275 views

Solving Knight's Travails Problem without using vector for position

I'm trying to implement a solution to the The Odin Project - Project 2: Knight’s Travails in Clojure (Functional Programming) based on the solution posted by benjdelt. I would like to know your ...
Vasco Ferreira's user avatar
6 votes
1 answer
151 views

Clojure "Game of Life"

I'm a Clojure beginner and I implemented Game of life to learn how I should code things in Clojure. ...
minebreaker's user avatar
2 votes
2 answers
159 views

Find the middle of the string

The follow code should correctly run the test cases at the bottom. It works correctly. I just don't feel like this is clearest way I could write it. A lot of the complexity comes from having to ...
TMB's user avatar
  • 209
0 votes
3 answers
881 views

Binary search algorithm in Clojure

I'm absolutely new to Clojure (started learning it yesterday). After I went through some tutorials and checked out the basics I implemented the following Binary search algorithm: ...
Farkas István's user avatar
4 votes
0 answers
182 views

Attempt at Idiomatic Hangman in Clojure

I am pretty new to Clojure & am loving it so far. After going through a few resources, I decided to make a hangman game. I'm wondering how idiomatic is my code & where can I improve it ...
AnEnigmaticBug's user avatar
2 votes
1 answer
182 views

Sorting algorithms and command-line interface

I have implemented both some sorting algorithms (namely bubble sort and merge sort), as well as a command-line interface, in ...
Qwerp-Derp's user avatar
1 vote
1 answer
100 views

Parsing string into hash-map with 2D coordinates as keys

I had never programmed in a functional programming language before. I think that this function has large nesting. Is there way to rewrite it better? I am most worried about the use of "flatten". Is ...
KgOfHedgehogs's user avatar
6 votes
1 answer
387 views

2048 game implementation in Clojure

This is my first Clojure program. If you want to run it locally please check out https://github.com/achikin/game2048-clj core.clj ...
Anton Chikin's user avatar
2 votes
3 answers
545 views

Solving quadratic equation in Clojure

I wrote a function in Clojure to solve quadratic equations using the quadratic formula The function ...
Attilio's user avatar
  • 1,645
3 votes
1 answer
839 views

Get RSS feeds and store them into database

It is my first program in Clojure. It read RSS feed's list from text file, get each feed and store result into sqlite database. project.clj: ...
ceth's user avatar
  • 792
5 votes
2 answers
141 views

Resolve double auction orders

Given a vector of seller orders (asks) of a certain product (each order having a price) and buyer orders (bids) of the same product, I'm creating a function that resolves the auction by matching the ...
Ezequiel's user avatar
  • 208
2 votes
1 answer
3k 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: ...
bkoodaa's user avatar
  • 153
4 votes
1 answer
107 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 ...
Carcigenicate's user avatar
2 votes
1 answer
848 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-...
niicM's user avatar
  • 23
6 votes
2 answers
295 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 ...
Paul Gowder's user avatar
2 votes
1 answer
306 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 ...
Attilio's user avatar
  • 1,645
10 votes
2 answers
815 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 ...
Viacheslav Kovalev's user avatar
1 vote
3 answers
4k 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 ...
Aseem Bansal's user avatar
  • 2,269
2 votes
2 answers
573 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: ...
ionutt93's user avatar
2 votes
1 answer
396 views

Program for printing all numbers that user inputs till 42 in Clojure

As the name suggests it is a very simple program to print numbers to screen till user inputs 42. ...
Aseem Bansal's user avatar
  • 2,269
4 votes
1 answer
499 views

Number guessing game in Clojure

I have recently started learning Clojure, and decided to write a number-guessing-game as an exercise. The game works as follows: User enters minimum and maximum values Computer generates a number ...
Attilio's user avatar
  • 1,645
1 vote
1 answer
340 views

Read Space Delimited Text File to Standardized Data Type

From the README.md Introduction: The purpose of data-in is to read all the lines from a text file and return the file's contents as a Clojure value in a ...
ben rudgers's user avatar
  • 2,663
2 votes
0 answers
108 views

Re-implementation of Caolan McMahon's parallel and map functions

I have wrote my first reasonably complete piece of ClojureScript code and would like feedback. It is basically a re-implementation of Caolan McMahon's parallel and map functions from async in ...
Forbesmyester's user avatar
4 votes
1 answer
1k views

Clojure Fibonacci

I'm a Clojure novice working through 4Clojure problems. In one problem I am supposed to create a function that takes a number and returns that number of Fibonaccis. My first thought was to create a ...
Thomas Sobieck's user avatar
2 votes
1 answer
404 views

Determine if braces in a string are balanced in Clojure

I'm currently learning Clojure, and am working through a few exercises. The exercise that I'm working on right now is accept an arbitrary string and determine if the opening and closing parenthesis, ...
Michael0x2a's user avatar
3 votes
1 answer
84 views

Simple spec testing DSL

I wrote a very small little DSL for spec testing: ...
mjgpy3's user avatar
  • 729
6 votes
2 answers
154 views

Performing an algebraic regression on syntax trees

I am quite new to Clojure and would need some advice on the following genetic programming gist I wrote as my first working clj program. The aim of it is to perform an algebraic regression using ...
vojta havlíček's user avatar
4 votes
1 answer
79 views

Zeckendorf numbers the Clojure way

I'm just getting into Clojure, and I wanted to make sure I am writing code the "Clojure way". The challenge I took on is Zeckendorf numbers (fairly trivial). ...
mjgpy3's user avatar
  • 729
5 votes
1 answer
561 views

Algorithm to Iterate All Possible Strings in Clojure

I'm fairly new to Clojure and I struggled a bit coming up with a nice Clojure-y solution for implementing an algorithm for one of my applications. The real issue I'm trying to solve would require a ...
reibitto's user avatar
4 votes
3 answers
313 views

Parsing US address with Clojure

The parser below is not designed for every single US address. I am parsing through a file where each line may or may not be an address. I am more focused on speed rather than robustness. ...
pgreen2's user avatar
  • 639
3 votes
2 answers
73 views

Basic reverse function

I am just starting out in my Clojure journey and I wonder if anybody can point out my beginners mistakes in my function below that simply reverses a list. I know that there is already a reverse ...
dagda1's user avatar
  • 309
1 vote
2 answers
73 views

Scamble a vector, preserving the sum

My first crack at clojure... if you have time to provide input, I'd appreciate it. I'm as much interested in style as proper usage. I'm just getting started. The task to start with an vector of N ...
sea-rob's user avatar
  • 467
5 votes
1 answer
282 views

Hangman - my first Clojure code

This is my first attempt at Clojure! Apart from all game related issues, how is my code? Is there anything I can do to make it more idiomatic? ...
l3dx's user avatar
  • 153
50 votes
1 answer
2k views

Connect Four AI (Minimax) in Clojure

I wrote a Connect Four game including a AI in Clojure and since I'm rather new to Clojure, some review would be highly appreciated. It can include everything, coding style, simplifications, etc. But ...
naeg's user avatar
  • 641
4 votes
1 answer
355 views

Calculating Pi in Clojure

Obviously there are better ways of obtaining Pi, but for educational purposes, how is the code below? ...
user16973's user avatar
  • 181
2 votes
1 answer
307 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. ...
Kevin Burke's user avatar
4 votes
1 answer
491 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 ...
Frank Henard's user avatar