racket Questions
5
I have a homework problem that is asking me to tell if two sets are equal in content, regardless of order.
Ex: (set-equal? (list 1 2 3) (list 3 2 1)) is true
I have gotten this code so far,
(de...
1
I implemented a simple and not very efficent sieve of eratosthenes. Once for the built in racket-streams, and once for self defined streams. The only known difference to me is that the built in str...
Ake asked 13/5, 2019 at 13:42
1
I want to be able to do something like this:
(struct point (x y))
(define p1 (point 1 2))
(define p2 (point 10 20))
(+ p1 p2) ; -> (point 11 22)
Is it possible to teach a struct like point ...
Arletha asked 27/4, 2019 at 1:11
3
For example I have (list "a" "1" "b" "2" "c" "3").
Now I want to turn this list into one "a1b2c3".
How do I do that?
Thank you.
Aide asked 2/6, 2013 at 7:6
1
Solved
I wrote a program in Racket (the source code is in a .rkt file with #lang racket at the top). I also wrote a library in (mostly) portable R7RS Scheme. Can I use the library in the program in a clea...
2
Solved
TL;DR
I'm trying to expand an optional ellipsis (~optional datum:my-class ...) into a form that uses attributes from my-class like so: #'(list datum.attr ...).
But as the form is optional, when i...
Privation asked 7/3, 2019 at 13:54
2
Solved
How can I replace all function calls to f with function calls to g using a racket macro? I'm new to racket and I don't know how to process syntax objects, but I believe the use case I have in mind ...
Kittrell asked 15/2, 2019 at 20:55
0
I find the Common Lisp HyperSpec to be useful as a sort of man pages for the Common Lisp programming language.
Is there a Scheme equivalent covering either the R7RS or R5RS standard (or for that ...
Naples asked 24/1, 2019 at 16:39
6
Solved
In Python, I can do something like this:
t = (1, 2)
a, b = t
...and a will be 1 and b will be 2. Suppose I have a list '(1 2) in Scheme. Is there any way to do something similar with let? If it ...
Nadbus asked 18/11, 2010 at 22:58
1
Solved
Is it possible to write documentation in source files like in Common Lisp or Go, for example, and extract it from source files? Or everybody uses Scribble to document their code?
2
Solved
I am trying to write a macro-generating macro, where the macro it generates takes a variable number of arguments.
I am wondering if there is a way to make the following code work:
(define-syntax-...
Nibbs asked 20/12, 2018 at 6:41
1
Solved
Some tutorials for Rosette introduce program synthesis using shallow embedding and others using deep embedding.
After reading Torlak et Bodik's "Growing Solver-Aided Languages with ROSETTE", it se...
3
Solved
Like Racket - how to get the “previous executed command” in bash script? but with DrRacket. How can I get the previously executed command in DrRacket (like up arrow function in bash)?
Boarhound asked 8/7, 2014 at 13:20
2
Solved
I'm learning racket and I have a question about when to use define and when to use let.
I have this function:
(define my-function
(lambda (param1 param2 list1)
(/
(count
(lambda (x)
(define...
1
Solved
In the Little Typer chapter 2 frame 100 gives the following definition:
(claim pearwise+
(→ Pear Pear
Pear))
(define pearwise+
(λ (anjou bosc)
(elim-Pear anjou
(λ (a1 d1)
(elim-Pear bosc
(...
3
Solved
I'm trying to experiment with what I can do in Racket, and I want to suffix numbers with letters.
For this example, I'd simply like to represent 10000 as 10K, and 1000000 as 1M.
Is there way (wit...
2
Solved
I'd like to compare the code contents of two syntax objects and ignore things like contexts. Is converting them to datum the only way to do so? Like:
(equal? (syntax->datum #'(x+1)) (syntax->...
Whiteley asked 22/11, 2018 at 20:34
1
Solved
I define a function
(define 1-9 (list->set (range 1 10)))
I want to see if 1-9 is really a set. How can I get the type of 1-9?
I tried to google racket check type, but I can't find any usefu...
1
Solved
I'm currently trying to code a procedure which gets a list of lists and returns a list of lists, which contains each first item of the input lists. For example I'll provide you with a Input and Out...
1
Solved
I am having trouble implementing exceptions (handle and raise) using a dynamically scoped variable and abort.
This question came from reading the paper A syntactic theory of dynamic binding, sectio...
Reheat asked 22/10, 2018 at 23:8
1
Solved
.rkt is the conventional file extension for 'regular' Racket source code. In the documentation, I also see .rktl and .rkts being used. What are .rktl and .rkts used for, and are there any more Rack...
Gravitative asked 22/10, 2018 at 12:21
3
Solved
I was trying to figure out getting the length of the list
but failed to do so
showing
expected: number?
given: #<procedure:list>
argument position: 1st
other arguments...:
my code:...
3
Solved
I tried running the program below
(define (odd-internal x)
(define (even x)
(if (zero? x)
#t
(odd-internal (sub1 x))))
(if (zero? x)
#f
(even (sub1 x))))
(define (odd-external x)
(if (zer...
Gyrose asked 7/10, 2018 at 13:26
2
I am having trouble understanding the use of collector functions in Scheme. I am using the book "The Little Schemer" (by Daniel P. Friedman and Matthias Felleisen). A comprehensive example with som...
Radiate asked 26/11, 2016 at 13:58
1
Solved
I have quite simple set of .rkt sources and, say, "a.rkt" and "b.rkt" among them. I'd like to be able to write (require "a.rkt") in "b.rkt" and vice versa. Now I'm facing error about "loading cycle...
© 2022 - 2024 — McMap. All rights reserved.