Questions tagged [racket]
Racket is an extensible general programming language in the Lisp family.
58 questions
3
votes
1
answer
134
views
Brute-force algorithm to solve allocation/assignment in Racket
The situation: A certain number of kids come to a library and each of them wants to borrow a book. Since there is only one copy of each book in the library, each child must say which book they would ...
3
votes
1
answer
68
views
Wide-stripes function in Racket
The exercise is asking to make wider stripes similar to the previous exercise. I've included the exercise and code from it along with code that I've been messing with to get the desired result.
I know ...
0
votes
1
answer
130
views
Why is this racket n queens code so inefficient?
I have the following code for the n queens problem described here: https://leetcode.com/problems/n-queens/
...
3
votes
2
answers
486
views
Tower of Hanoi in Racket
I'm in the early stages of learning Racket, and decided to have a go at the tower of Hanoi. I did this without any reference whatsoever, so everything is up for review, including the algorithm as well ...
1
vote
1
answer
67
views
Racket code to find missing ranges
I'm doing some toy problems in a variety of languages and wanted to do the following in Racket Lisp.
Given a sorted integer array nums, where the range of elements ...
0
votes
0
answers
126
views
Is this zip function ok?
A slick way to write the zip function in Scheme/Racket:
(define (zip . lsts)
(apply map list lsts))
(zip '(a b c) '(1 2 3))
'((a 1) (b 2) (c 3))
Is using cons ...
-1
votes
1
answer
96
views
1
vote
2
answers
556
views
Implementations of unzip in Racket
I've been practicing my folds and tail-call recursive programming, and I wanted to work on unzip for the general case as opposed to just pairs. This was very easy ...
2
votes
0
answers
162
views
Sum of matrix region in racket
I'm learning racket and did simple code challenge in a literate programming style with org mode
The problem:
Given a matrix of integers and the top left and bottom right coordinates of a ...
1
vote
0
answers
690
views
Cartesian product in racket (Is append-map okay?)
I've read several places that say it's really bad to use append, and I understand why. I read somewhere that it was never even correct to use ...
3
votes
0
answers
141
views
Racket macro for variadic FFI
I'm working on FFI wrapper for SDL2 library in Racket. The library includes several variadic functions (e.g. SDL_SetError, SDL_LogMessage etc); Racket FFI does not have straight way for importing ...
2
votes
0
answers
711
views
Simple web API that access sqlite database
This is a very simple web API for a school assignment, as a part of a bigger system. The web API returns a list of courses or a single course as json. I doubt that I will get any feedback on the code ...
1
vote
1
answer
3k
views
Binary search tree insertion in Racket
I am learning Racket and implemented a BST insert function (insert tree n) where the format for a BST node is ...
4
votes
1
answer
161
views
Recamán's Sequence in Racket
I just started learning Racket as my first lisp dialect so after getting used to the syntax I implemented the Recamán's sequence.
Apart from the style, I'd also like to know if my code is a linear ...
1
vote
1
answer
855
views
Stack calculator in Racket
I have implemented a stack calculator based on this programming task. I wondered if a more experienced racketeer could give me feedback and tell me if I am missing anything in Racket that would enable ...