racket Questions
4
Solved
I wrote two different functions in racket to determine whether a list of numbers is ascending:
(define (ascending list)
(if (<= (length list) 1)
#t
(and (< (car list) (car (cdr list))) (a...
Lambart asked 17/10, 2012 at 0:16
4
Solved
I just discovered Racket a few days ago, and I'm trying to get more comfortable with it by writing a little script that generates images to represent source code using #lang slideshow.
I know that...
Homestead asked 25/4, 2013 at 17:45
3
Solved
(defun triangle-using-cond (number)
(cond
((<= number 0) 0) ; 1st
((= number 1) 1) ; 2nd
((> number 1) ; 3rd
;; 4th
(+ number
(triangle-using-cond (1- number))))))
Things that I kno...
Quinquennial asked 1/11, 2015 at 18:32
1
Solved
I want to use a specific #lang in eval to provide it its semantics. However, eval itself does not appear to have a mechanism to specify the language, and passing in #lang does not seem to work.
Cooke asked 24/10, 2015 at 20:50
4
Solved
I'm playing with Racket today, and trying to produce an indefinite sequence of numbers based on multiple applications of the same function.
In Clojure I'd use the iterate function for this, but I...
Morality asked 3/10, 2015 at 0:47
2
Solved
How do I format output using racket? I want to output a fixed-width number and fill it with 0 if the width is too small? How can I do it? I have searched the racket documentation but I can only fin...
1
I would like to add scripting capabilities to my C++ game engine.
I have Engine.exe, Physics.dll, Audio.dll and I'm adding Scripting.dll which is a high-level Racket wrapper.
Engine.exe loads Phy...
Remembrance asked 23/9, 2015 at 11:31
2
The question title says it all, really: What is the best way map a function over a list in parallel in racket? Thanks.
Indurate asked 26/3, 2013 at 22:26
1
Solved
I'd like to enforce the data type for input to a function in racket. For example, in this function I want to expect integers and throw an error if someone inputs a string.
Is there a standard way...
Izzo asked 8/9, 2015 at 16:4
2
Solved
I have define a struct as below,
(struct vector (x y z)
#:methods gen:custom-write
[(define (write-proc vector port mode)
(let ([print (if mode write display)])
(write-string "<")
(print (...
Harri asked 2/9, 2015 at 14:23
2
I found that the program to check if the scoping is lexical or dynamic is the one given below (source: http://inst.eecs.berkeley.edu/~cs61a/su10/resources/sp11-Jordy/scope/)
(define test
(let ((...
4
Or the basic work need to do to create a GUI. I know the basic Components
of GUI, but where to begin. I'm just a self-study person and I'm reading "How to Design Program" (HtDP) at the end of the b...
Minister asked 6/12, 2011 at 15:18
1
Solved
When I try to install a package through raco, I get a strange error message:
raco setup: directory: #<path:/Users/ben/code/racket/benchmark/tr-pfds/pfds> does not exist for collection: "pfds...
Vetavetch asked 29/8, 2015 at 2:15
3
Solved
The Third Commandment of The Little Schemer states:
When building a list, describe the first typical element, and then cons it onto the natural recursion.
What is the exact definition of "natu...
Elective asked 27/8, 2015 at 22:26
1
Solved
I am building a set of rackunit tests, where the actual test-case and check-equal? function is defined in a macro. The code looks something like this:
#lang racket
(require rackunit
rackunit/tex...
2
Solved
Is there an easy way for me to load a submodule in the current file in racket-mode in emacs?
For example if I have the following file
#lang racket
(define (foo x)
x)
(module+ sub
(define (bar...
1
Solved
I'm writing a function in Racket, using DrRacket:
(define (same-parity a .b)
(let ((remain (remainder a 2)))
(define (recur-part remain-list)
(cond ((= remain (remainder (car remain-list) 2))
...
Furbish asked 24/8, 2015 at 15:54
4
Solved
As the title implies, I don't understand the difference between using #:transparent and using #:prefab when defining a struct. The reference mentions that prefab involves some sort of global sharin...
Drawback asked 19/8, 2015 at 14:26
4
Solved
I'm starting to read the Little Schemer and now instead of PLT Scheme we have Racket. I would like to know if Racket is suitable for doing the exercises in the book or do I need to get another true...
Enfleurage asked 22/10, 2012 at 1:14
3
Solved
According to the documentation eval and eval-syntax behave the same with the exception that eval enriches the input syntax.
If top-level-form is a syntax object whose datum is not a compiled for...
1
Solved
Is there an easy way to truncate strings to a certain width in Racket?
Examples:
(truncate "foobar" 3)
-> "foo"
(truncate "foobar" 6)
-> "foobar"
I'd also like to replace the last few cha...
3
Solved
Suppose I have a struct with many fields:
(struct my-struct (f1 f2 f3 f4))
If I am to return a new struct with f2 updated, I have to rephrase every other fields:
(define s (my-struct 1 2 3 4))
...
3
Solved
recently, I started programming Racket (formerly Scheme) in DrRacket.
I quite fast I began to miss all the features of VIM in DrRacket, so I would like
to use VIM for my scheme(racket) programming....
2
Solved
In Chapter 3 of The Little Schemer, the answer to the question of why we don't simplify the rember function right away is "because then a function's structure does not coincide with its argument's ...
Jeniferjeniffer asked 31/7, 2015 at 0:3
1
Solved
I'm learning Racket (but probably answer will be similar in any Scheme and scheme-derived language) and wonder how to filter out false (#f) values from a given list. The best I came up with is:
(f...
© 2022 - 2024 — McMap. All rights reserved.