problem about racket-Collection of common programming errors
Will Ness
scheme racket
I’m trying to write some code, but there is a problem with my reply procedure. Ignore the procedures for the first two random-of-threes, but the problem is in the else when calling the pick-random procedure. Here’s the code:(define earlier-responses ‘()) (define (doctor-driver-loop name earlier-
Keen
functional-programming scheme racket mutable
i have this definition “sort left list” which is a list of pairs sorted according to the left element of each pair the left element must be a non-negative integer and the right component may be a value of any typei have to
Timbo925
table user-interface listbox scheme racket
I’m currently trying to create a a grid of information in Racket using the Racket Graphical Interface Tooling. The only real table that is available is the list-box% (link to reference)To fill the table I need to use:(send a-list-box set choices …) → void?choices : (listof label-string?)choices being list being a list of each column. The problem is that I have a variable amount of collumns. My current data is formated like (list (list 1 2 3) (list 4 5 6))
Yasir Arsanukaev
list scheme racket
Below is my code which takes a car element of a list(carVal) and an list(initialized to
Óscar López
scope scheme racket define
I need some function which among other stuff would define a new global symbol. So that I could use it like this:(define (func-prototype symbol value comment)(define symbol value) ; th
Chris Jester-Young
racket cartesian-product
I was hoping someone could guide me in the right direction: I am looking two produce all possible combinations of items in two lists: Example: Given the lists ‘(symbo
mac01021
lisp scheme racket
Using DrRacket, on both linux and Mac OS, the following code gives this error *: expects type as 1st argument, given #but if I uncomment the (newline) at the beginning of the procedu
Michael McGuinness
scheme racket
I have been trying to launch a racket program from the commandline (via ‘racket’) but have not been having success. According to the documentation (here http://docs.racket-lang.org/reference/running-sa.html#%2
akavel
scheme racket old historical
I’m trying to resurrect an old (1999 or earlier) project written in Scheme (PLT-Scheme, using the mzscheme interpreter (?) commandline tool). To make the matters worse, I don’t know Scheme, or Lisp (in fact, I want to learn, but that’s another story).I have the source code of the project at: github.com/akavel/shermanNow, when running the code, it bails out with an error message like below:Sherman runtime version 0.5 Hosted on MzScheme version 52, Copyright (c) 1995-98 PLT (Matthew Flatt) reference to undefined identifier: list->block
Yasir Arsanukaev
recursion racket
I’m still plugging away at the exercises in How to Design Programs on my own, but have managed to get stuck again. This time it’s question 11.4.7:Develop the functionis-not-divisible-by=1], i, and a naturalnumber m, with i < m. If m is notdivisible by any number between 1(exclusive) and i (inclusive), thefunction produces true; otherw
Eli Barzilay
scheme eval racket
The following racket function produces the error:reference to undefined identifier: valThis i
ecounysis
user2085086
scheme racket scoping drracket
So I know that in Scheme define is for dynamic scoping and let for static scoping, yet the following thing confuses me:If I have(let ((x 0))(define f (lambda () x))(display (f))(let ((x 1))(displa
Sam Tobin-Hochstadt
racket
When building up some functions, I can make some mistakes. When
Eli Barzilay
scheme racket
Hey i’m just trying to write some code in DrScheme: ((function (
Sam Tobin-Hochstadt
lisp scheme racket
I’m trying to run the program described in SICP 4.1 (http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-26.html) but have run into some difficulty in redefining the function apply as the book suggests that you do. The code is the following:#lang planet neil/sicp;; —————————————————————————– ;; 4.1.1 The Core of the Evaluator ;; —————————————————————————–;; Eval (define apply-in-underlying-scheme apply) (define (eval exp env)(display ‘eval)(newline)(display exp)(newline)(cond ((self-evaluating? exp) exp)((variable? exp) (let ((res (lookup-variable-value exp env)))(display (list ‘lookup exp))(newline)(display res)(newline)res))((quoted? exp) (text-of-quotation exp))((assignment? exp) (eval-assignment exp env))((definition? exp) (eval-definition exp env))((if? exp) (eval-if exp env))((lambda? exp)(make-procedure (lambda-parameters exp)(lambda-body exp)env))((begin? exp)(eval-sequence (begin-actions exp) env))((cond? exp) (eval (cond->if exp) env))((application? exp)(apply (eval (operator exp) env)(list-of-values (operands exp) env)))(else(error “Unknown expression” exp))));; Apply(define (apply procedure arguments)(display ‘apply)(newline)(display procedure)(newline)(cond ((primitive-procedure? procedure)(apply-primitive-procedure procedure arguments))((compound-procedure? procedure)(eval-sequence(procedure-body procedure)(extend-environment(procedure-parameters procedure)arguments(procedure-environment procedure))))(else(error”Unknown procedure type — ” procedure))));; Application(define (application? exp) (pair? exp)) (define (operator exp) (car exp)) (define (operands exp) (cdr exp));; Procedure arguments(define (list-of-values exps env)(if (no-operands? exps)'()(cons (eval (first-operand exps) env)(list-of-values (rest-operands exps) env))))(define (no-operands? ops) (null? ops)) (define (first-operand ops) (car ops)) (define (rest-operands ops) (cdr ops));; Conditionals(define (eval-if exp env)(if (true? (eval (if-predicate exp) env))(eval (if-consequent exp) env)(eval (if-alternative exp) env)));; Sequences(define (eval-sequence exps env)(cond ((last-exp? exps) (eval (first-exp exps) env))(else (eval (first-exp exps) env)(eval-sequence (rest-exps exps) env))));; Assignments and definitions(define (eval-assignment exp env)(set-variable-value! (assignment-variable e
Gilles
variables scheme racket
I think I read somewhere that you could bind multiple definitions to a single name in scheme. I know I might be usin
Chris Jester-Young
scheme racket continuations
Consider the following code:(call-with-values(lambda ()(call/cc (lambda (k)(k k k))))(lambda (x y)(procedure-arity y)))It’s pretty obvious here that the continuation at the point of the call/cc call is the lambda on the right-hand side, so its ari
Nathan Campos
regex url racket
I’m trying to use the URL regular expression to match URLs in Racket like this:(regexp-match #rx”((mailto\:|(news|(ht|
Originally posted 2013-11-09 23:20:22.