racket

Dr Racket problems with SICP

I'm working through SICP. Currently, in the first chapter, I'm having problems getting Racket to let me redefine "primitives". For instance, I was under the impression that I should be able to arbitrarily do "(define + 5)" and that would be fine or redefine the sqrt procedure. Instead, I get this: "define-values: cannot change constant v...

Scheme/Racket: do loop order of evaluation

The following procedure is valid in both scheme r6rs and Racket: ;; create a list of all the numbers from 1 to n (define (make-nums n) (do [(x n (- x 1)) (lst (list) (cons x lst))] ((= x 0) lst))) I've tested it for both r6rs and Racket and it does work properly, but I only know that for sure for DrRacket. My question is i...

How to test the throwing of errors in racket?

Hi Everyone, I'm currently working in some racket programs, specifically in the PLAI's language of the Programming Languages: Application and Interpretation Book, and there is a function called test, i was wondering how to test the error throwing in racket? Does anyone knows how to do this? Greetings (I'm not a native english speaker,...

problem in scheme

.............................................. ...

Scheme Editor prog

Hi, i am trying to develop an editor in Scheme (DrRacket) passing lists into the structures. I handled all the functions of an editor like the keystrokes, backspace, left and right etc but i am not getting the idea of how to implement mouse selection which highlights the selected text. Can any one of you help me with it. Thanks ...

SICP, Scheme, DrRacket Question: Timer/profiler function?

I'm currently trying to do exercise 1.22, which needs a function called runtime that returns the number of milliseconds the system has been running. However, my environment (R5RS) does not seem to have this. It does not have time, current-milliseconds, current-inexact-milliseconds, etc, either. What function do I have access to, to pro...

why i can type only one char in DrRacket?

It can type only one char. look like a bug. I am using fc6. ...

Parameters for Structs in Scheme

I have this struct for people: (define-struct person ( first ; a string: first name last ; a string: last name sex ; a symbol: 'male, 'female eyes ; a symbol: 'blue, 'brown', 'green hair ; a symbol: 'blonde, 'brown, 'black, 'red mother ; a person: empty if not known f...

Identifiers and Binding in Scheme - how to interpret the function ?

Hi ! I am reading DrRacket document http://docs.racket-lang.org/guide/binding.html There is a function (define f (lambda (append) (define cons (append "ugly" "confusing")) (let ([append 'this-was]) (list append cons)))) > (f list) '(this-was ("ugly" "confusing")) I see that we define function f, inside ...

How can I add sections to an existing (OS X) executable?

Is there any way of adding sections to an already-linked executable? I'm trying to code-sign an OS X executable, based on the Apple instructions. These include the instruction to create a suitable section in the binary to be signed, by adding arguments to the linker options: -sectcreate __TEXT __info_plist Info.plist_path But: The e...

Searching through lists with Scheme (DrRacket)

So here's my code: (define *graph* (read(open-input-file "starbucks4.sxml"))) (define get-artifacts (lambda (l) (member (list 'opm:artifact) l))) When I type get-artifacts(*graph*) I get an error saying procedure application: expected procedure, given:...(the whole of my file contents) Anyone see what I'm doing wrong? Thanks gu...

Using the member function in Scheme

This is my code: (define p (read(open-input-file "starbucks4.sxml"))) (define get-artifacts (lambda (l) (member (list 'opm:artifact) l))) (get-artifacts p) I was told that the member function searches completely throughout a list. In the .sxml document there is a complicated list that has many elements called "opm:artifa...