5,906 questions
0
votes
1
answer
90
views
How to create a C array from a list?
I have a list of Vector2 that I want to pass to this function:
void DrawLineStrip(const Vector2 *points, int pointCount, Color color);
There is a function _array/list which looks promising, as "...
0
votes
1
answer
46
views
Calling main in standalone executable
Consider this snippet:
#lang racket/base
(provide main)
(define (main)
(displayln "hi"))
When I run this with racket -tm test.rkt I see 'hi'.
But when I compile this with raco exe test....
1
vote
1
answer
65
views
How to reload a module in racket?
Consider the file "test.rkt":
#lang racket
(provide test)
(define (test)
(displayln "foo"))
In a racket REPL I load the file:
(require "test.rkt")
Now I can run (...
0
votes
0
answers
66
views
How to import a C define into racket via ffi?
raylib.h has the following definition:
#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 }
How can I import this definition so that I can use RAYWHITE?
Best practices
0
votes
4
replies
63
views
How to define an interface equivalent in Typed Racket?
For Java's classes and interfaces usage, what is the equivalent in Racket?
#lang racket
(define fish-interface
(interface () get-size grow eat))
(define fish%
(class* object% (fish-interface)
(...
0
votes
1
answer
50
views
How to use MouseEvents in racket world?
I am trying to design a world program that displays the current (x, y) position of the mouse at that current position. So as the mouse moves the numbers in the (x, y) display changes and its position ...
1
vote
2
answers
167
views
Replacing the element in the list with the specific index using `foldr` —— Exercise 1.19 of Essentials of Programming Language
Here is the question from Mitchell Wand's Essentials of Programming Language:
Exercise 1.19 [⋆ ⋆] (list-set lst n x) returns a list like lst, except that the n-th element, using zero-based indexing, ...
0
votes
0
answers
69
views
How do I properly insert 3 into my nested list tree?
I am working on a program that is supposed to build a tree using nested lists in Racket. I believe I am very close, but I am stuck on one section of my insertion testing process.
The syntax for my ...
2
votes
0
answers
56
views
issues with set-car! when implementing SICP evaluator in Racket
I am implementing circular evaluator in Chapter 4 SICP with racket, it seems that the code running fine only it cannot add new frames to the environment due to set-car! issue.
I tried the followings:
...
-1
votes
1
answer
77
views
How do I scale and translate my Pentagons properly?
I am trying to finish a program that will take the world coordinates of polygons, in this case pentagons, and scale and translate them from a world size of 1280x720 so they are drawn based on the ...
2
votes
1
answer
97
views
How do I extract the "hue" value only from an HSV in racket?
I am working on a program to convert and RGB color value into an HSV and then gather only the hue value from the hsv for manipulation
(define mycolor (make-color 12 168 45))
(define myhsv (color->...
1
vote
0
answers
39
views
Simplest way to center and fit an image in racket/gui
I'm writing an image processing application where I need to present to the user two images, side-by-side, in such a way that they will fit and be centered on the screen, regardless of their actual ...
1
vote
1
answer
61
views
Passing Racket arguments to Datalog queries dynamically
I am trying to use Racket-Datalog queries dynamically/programmatically within the scope of the Racket function by passing upper-case variable arguments to Datalog queries.
The following is an example ...
0
votes
1
answer
83
views
How to write a filter function for streams?
I started learning Racket with the book Schreibe dein Programm!
Streams are introduced in chapter 9 as an exercise. The goal is to develop functions working on streams on your own, i.e. not using the ...
4
votes
1
answer
52
views
In Racket, why does parameterize not work lexically with shift/reset?
Consider the following piece of code:
(define p (make-parameter 'outer))
(reset
(parameterize ([p 'inner])
(displayln (p)) ; prints 'inner
(shift k
(begin
(displayln (p)) ; ...