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 ...
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 ...
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:
...
3
votes
Accepted
Brute-force algorithm to solve allocation/assignment in Racket
Here's my re-implementation of the Python code:
...
3
votes
Implementations of unzip in Racket
The apply+foldl approach in WorBlux's answer can be simplified by using the split-at-right ...
3
votes
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...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
Accepted
Stack calculator in Racket
Bug
The - and / operators interpret their operands backwards from the typical RPN order. That is, I expect ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
racket × 58scheme × 32
lisp × 15
beginner × 5
programming-challenge × 5
macros × 5
functional-programming × 4
algorithm × 2
image × 2
stack × 2
graphics × 2
c# × 1
c++ × 1
performance × 1
strings × 1
multithreading × 1
sql × 1
sorting × 1
haskell × 1
tree × 1
matrix × 1
mathematics × 1
tic-tac-toe × 1
concurrency × 1
integer × 1