All Questions
Tagged with functional-programming lisp
19
questions
4
votes
1
answer
151
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.
...
5
votes
2
answers
786
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 ...
2
votes
1
answer
51
views
Storing facts for logical questions
I am writing a crude artificial intelligence program. I am happy with my program's ability to file away new word in ways that will allow logic to be done on them. Before I start expanding the logic ...
2
votes
0
answers
148
views
Computing nth roots of a number - SICP exercise 1.45
From SICP
Exercise 1.45:
We saw in 1.3.3 that attempting to compute square roots
by naively finding a fixed point of x/y does not converge, and that
this can be fixed by average damping.
...
1
vote
2
answers
11k
views
Highest number in a list with Racket
I am trying to build a function to find the highest number in a list without using the built-in functions of "apply" and "max".
I created the following code:
...
1
vote
2
answers
8k
views
Reverse the order of a list in Racket
I am using the SICP book. There is an exercise in which you need to create a function that will receive a list as an argument and return a list with the same elements in a reverse order.
I know there ...
5
votes
1
answer
326
views
“Guess My Number” with Racket
I am using the book "Realm of Racket" which was written by the people behind the Racket and Dr. Racket projects. It is a great book based on games, similar to the famous "Land of Lisp".
The first ...
3
votes
1
answer
474
views
Church Numerals
Here is exercise 2.6 from SICP:
Exercise 2.6: In case representing pairs as procedures wasn’t
mind-boggling enough, consider that, in a language that can manipulate
procedures, we can get by ...
8
votes
1
answer
883
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 \$19\$...
8
votes
2
answers
297
views
Compiler for a minimal LISP dialect to run on the Java Virtual Machine
As the title states, this is a compiler written in C with a ruby build script that translates a minimal LISP dialect and spits out an executable jar file. I designed this LISP dialect and named it ...
3
votes
1
answer
108
views
Golden Section Search in Lisp
I implemented the golden section search algorithm recursively in Lisp. My code is:
...
7
votes
2
answers
327
views
Getting functional Common Lisp code for handling state in a SDL animation
The following code draws a red rectangle bouncing between the borders of a white display. I'm not particularly happy with the update function:
...
13
votes
1
answer
2k
views
Clojure Neural Network
After reading this article about Neural Networks I was inspired to write my own implementation that allows for more than one hidden layer.
I am interested in how to make this code more idiomatic - ...
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 ...
5
votes
1
answer
188
views
Pile shuffle of a vector
My goal is to simulate a Pile shuffle of a vector. It takes 2 optional arguments for the number of piles to use and how many times to perform the shuffle.
As this is my first attempt at clojure code, ...