Skip to main content
5 votes
Accepted

Tower of Hanoi in Racket

Regarding Style It would probably be more idiomatic to use a named let form in place of the internal define form for ...
ad absurdum's user avatar
4 votes
Accepted

Simplifying Macro-Generating Racket Macro

Starting at the top, you have a lot of unused imports. Fortunately, DrRacket can tell you which imports are unused, since it will highlight them in red when you hover your mouse over them. ...
Alexis King's user avatar
  • 3,172
4 votes
Accepted

Is this OR procedure correct?

or-l Is a Poor Name The OP procedure or-l is correct in that it yields correct results for its inputs. This ...
ad absurdum's user avatar
3 votes

Tower of Hanoi in Racket

The code looks fine, though I'd suggest to follow the usual Lisp style and not having dangling parentheses around: ...
ferada's user avatar
  • 11.1k
3 votes
Accepted

Binary search tree insertion in Racket

As you suspected, you don't need append for this problem. The trick is to notice that if, for example, your goal is to create the list ...
assefamaru's user avatar
2 votes
Accepted

“Guess My Number” with Racket

Racket isn't my Lisp of choice, but here's some general advice. You're calling the function guess multiple times with the same arguments. The code would be much ...
jkiiski's user avatar
  • 138
2 votes

Sudoku solver in Racket

This looks like a fairly reasonable brute force method. From what I've gathered though, the for loop will try for all combination rather than just the first valid ...
WorBlux's user avatar
  • 501
2 votes
Accepted

Advent of Code 2016 Day 1 "No Time for a Taxicab"

Generative approach The idea of functionally generating the next value from the current value rather than mutating a location is consistent with good Racket practice. Naming Instead of ...
ben rudgers's user avatar
  • 2,663
2 votes

Permutation-stream based n-queens solution

Variable Names There is little reason not to give the variables clear meaningful names. Using abbreviations leads to using bd in ...
ben rudgers's user avatar
  • 2,663
2 votes
Accepted

Recamán's Sequence in Racket

This code is not exactly linear as member is a o(n) time function and grown in proportion to curr-seq, making the whole ...
WorBlux's user avatar
  • 501
2 votes

Wide-stripes function in Racket

To answer that first, you don't need anything complicated, just observe that the pattern is binary, on and off, and compare that with how odd and even numbers are following the same pattern, then ...
ferada's user avatar
  • 11.1k
2 votes
Accepted

Highest number in a list with Racket

Remarks Using an internal function, recursion, and a trampoline is a good way to structure recursive procedures on a lists. The code fragment ...
ben rudgers's user avatar
  • 2,663
1 vote
Accepted

Brute-force algorithm to solve allocation/assignment in Racket

Here's my re-implementation of the Python code: ...
Shawn's user avatar
  • 126
1 vote

Why is this racket n queens code so inefficient?

Probably not. C++ is known for its raw performance. It can work with data that is close to the machine's underlying representation, and easily compiles down fairly directly to machine code. Not ...
JDługosz's user avatar
  • 11.4k
1 vote
Accepted

Racket code to find missing ranges

Your solution seems to me quite complex, with iterations, recursions, and the use of match. Here is an alternative version with a simple linear recursion, where the ...
Renzo's user avatar
  • 2,055
1 vote
Accepted

Implementations of unzip in Racket

Doing it with folds pretty much begs you to create a custom accumulator and recursive function or fold within a fold like that. A couple notes. I don't think foldr...
WorBlux's user avatar
  • 501
1 vote
Accepted

Stack calculator in Racket

Bug The - and / operators interpret their operands backwards from the typical RPN order. That is, I expect ...
200_success's user avatar
1 vote

Sudoku solver in Racket

Following is shortened working code. It is based on simple systematic search & recursion algorithm: read the rows one by one from left to right and top to bottom, starting with first row and ...
rnso's user avatar
  • 241
1 vote

Highest number in a list with Racket

One can also use 'named let' here to have a recursive loop that compares sequentially each item to the maximum till that point: ...
rnso's user avatar
  • 241
1 vote

GUI implementation with Racket

Broadly speaking, I'd say it looks pretty good. I'm a bit confused by the '1055'; I'm guessing that you're trying to wait until the train leaves the screen entirely? Perhaps you could write this as <...
John Clements's user avatar
1 vote

Tic-Tac-Toe game with AI

Modularity All the definitions are in the same lexical scope. For example all-cells is in the same lexical scope as fold-plays ...
ben rudgers's user avatar
  • 2,663
1 vote

Evaluation of e^x with series expansion

General Programming Using built the built in exponent function from racket/base and referencing Euler's Number from math/base ...
ben rudgers's user avatar
  • 2,663
1 vote

Splitting a list in Racket

Following function may have some ideas: ...
rnso's user avatar
  • 241

Only top scored, non community-wiki answers of a minimum length are eligible