racket

Why does "let" not evaluate, but just gives me #<promise>

Something simple as this: Welcome to DrScheme, version 4.2.3 [3m]. Language: Lazy Scheme; memory limit: 128 megabytes. > (let ((x 2) (y 10)) (+ x y)) #<promise> > I press enter for the let expression, and it gives me the #<promise>. What am I doing wrong? ...

PLT-Scheme learning reference

After having got through the two Schemer books, I'm about to embark on HtDP but also discovered the http://docs.plt-scheme.org/guide material. The previously mentioned books are more particular to Scheme, it seems, and the latter being more geared towards PLT specific extensions (modules, require, bracket syntax, etc...). The online man...

Scheme Beginner question

Hello.I am trying to put the following statement in Dr.Scheme: {with {x {+ 5 5}} {+ x x}} but I got an error: expand: unbound identifier in module in: with anyone could help me?Thanks. ...

What Scheme Does Ghuloum Use?

I'm trying to work my way through Compilers: Backend to Frontend (and Back to Front Again) by Abdulaziz Ghuloum. It seems abbreviated from what one would expect in a full course/seminar, so I'm trying to fill in the pieces myself. For instance, I have tried to use his testing framework in the R5RS flavor of DrScheme, but it doesn't seem...

How to 'destroy/dispose' frame% in plt-scheme?

I want to destory my previously shown frame when a certain event is triggered. I can't find anything regarding this in the reference manual. ...

How to print structures in PLT Scheme so as to display their fields?

I would like code like this: (define-struct thing (a b c)) (define th (make-thing 1 2 3)) to print something like this: (make-thing 1 2 3) when I type "th" into either the DrScheme or MzScheme repl. I am using the language "pretty big" in DrScheme with output style set to "constructor". This is what I get in DrScheme: (make-thin...

plt-scheme : catching mouse click event on canvas

I am writing a tic-tac-toe game in plt-scheme as my AI course project. The idea for gui is a grid with 9 boxes, each with a canvas, using panes ... When the user click on a canvas, 'X' or 'O' will be drawn accordingly ... The question is how can I catch mouse click event on canvas? I found out I need to use on-event, but still don't kno...

PLT Scheme sort function

PLT Scheme guide says that it's implemented sort function is able to sort a list according to an extarcted value using a lambda function. link text The guide provides an unworking code example of this- (sort '(("aardvark") ("dingo") ("cow") ("bear")) #:key car string<?) Which returns an error. How is this function is supposed ...

Is there an equivalent to Lisp's "runtime" primitive in Scheme?

According to SICP section 1.2.6, exercise 1.22: Most Lisp implementations include a primitive called runtime that returns an integer that specifies the amount of time the system has been running (measured, for example, in microseconds). I'm using DrScheme, where runtime doesn't seem to be available, so I'm looking for a good substi...

Binary Trees in Scheme

Consider the following BNF defining trees of numbers. Notice that a tree can either be a leaf, a node-1 with one subtrees, or a node-2 with two subtrees. tree ::= (’leaf number) | (’node-1 tree) | (’node-2 tree tree) a. Write a template for recursive procedures on these trees. b. Define the procedure (leaf-count t) that returns the ...

Write Scheme data structures so they can be eval-d back in, or alternative

I'm writing an application (A juggling pattern animator) in PLT Scheme that accepts Scheme expressions as values for some fields. I'm attempting to write a small text editor that will let me "explode" expressions into expressions that can still be eval'd but contain the data as literals for manual tweaking. For example, (4hss->sexp "7...

Matrix addition in Scheme

I am trying to add a matrix and it is not working... (define (matrix-matrix-add a b) (map (lambda (row) (row-matrix-add row b)) a)) (define (row-matrix-add row matrix) (if (null? (car matrix)) '() (cons (add-m row (map car matrix)) (row-matrix-add row (map cdr matrix))))) (define (add-m row col) (...

Cartesian product in Scheme

I've been trying to do a function that returns the Cartesian Product of n sets,in Dr Scheme,the sets are given as a list of lists,I've been stuck at this all day,I would like a few guidelines as where to start. ----LATER EDIT ----- Here is the solution I came up with,I'm sure that it's not by far the most efficent or neat but I'm only ...

Scheme Formatting Help

I've been working on a project for school that takes functions from a class file and turns them into object/classes. The assignment is all about object oriented programming in scheme. My problem however is that my code doesn't format right. The output it gives me whenever I give it a file to pass in wraps the methods of the class in a...

drscheme c# adapter

Hi guys i need to integrate drscheme into my c# code for my assignment but i could find any luck on the web. Can anyone help me ? I tried ironscheme but got the following error. The type or namespace name 'Dynamic' does not exist in the namespace 'System' (are you missing an assembly reference?) C:\Documents and Settings\Administrato...

Practical Scheme Programming

It's been a few months since I've touched Scheme and decided to implement a command line income partitioner using Scheme. My initial implementation used plain recursion over the continuation, but I figured a continuation would be more appropriate to this type of program. I would appreciate it if anyone (more skilled with Scheme than I) ...

"unbound identifier" errors in scheme

Hello: I'm using drscheme from: http://www.archlinux.org/packages/extra/x86_64/drscheme/ I'm trying to work with the sample code in my textbook, but I keep getting getting "unbound identifier" errors. Is it because the scheme interpreter is not configured correctly? or is the code just plain wrong? Here are a few examples: Input: #l...

Recursive breadth first tree traversal

I'm pulling my hair out trying to figure out how to implement breadth first tree traversal in scheme. I've done it in Java and C++. If I had code, I'd post it but I'm not sure how exactly to begin. Given the tree definition below, how to implement breadth first search using recursion? (define tree1 '( A ( B (C () ()) (D () ()) ) (E (...

Graph representation in Dr Scheme

I want to represent a graph in Dr. Scheme in the following manner: For each node I want to store it's value and a list of adjacent nodes,the problem which i'm having difficulties with is that I want the adjacent nodes to be stored as references to other nodes. For example: I want node ny to be stored as („NY“ (...

Scheme Depth-first search of a graph function

This is a homework question,I'm trying to do a Depth-first search function in Scheme,Here's the code I've written so far: (define explore (λ(node visited) (let* ([neighbors (force (cdr node))] [next (nextNode visited neighbors)] [is-visited (member? node visited)]) (cond ;if I ...