scheme

"set!: not an identifier in:..." plt scheme error.

what's wrong with this code in Dr.Scheme using Pretty Big? i seem to remember doing similar things in the past with no problem. (lambda (x y) (set! (Frame-variables res) (append (Frame-variables res) (list (cons x y))))) which returns the following error: set!: not an identifier in: (Frame-variables res) if i omit the (set! (Fra...

What's up with stdout in Gambit-C Scheme?

What's up with this, how do I capture the output from my Gambit-C program? $ gsi -e "(pp 'hello?)" hello? $ gsi -e "(pp 'hello?)" >asdf hello? $ gsi -e "(pp 'hello?)" 2>asdf hello? $ cat asdf It should have put the output of the program into asdf, but it's empty! Is there a compile-time or run-time option I can set to make it treat...

How do I write all-but-one function in Scheme/LISP?

Can you guys think of the shortest and the most idiomatic solution to all-but-one function? ;; all-but-one ;; checks if all but one element in a list holds a certain property ;; (all-but-one even? (list 1 2 4)) -> true ;; (all-but-one even? '(1)) -> true ;; (all-but-one even? '(2 4)) -> false Edit: all but EXACTLY one. ...

Importing struct with plt scheme

Hi ! I'm struck on a problem with a simple scheme application. In one file (dataloader.ss), I define a struct : (define-struct book-category (id name books)) But I can't use the structure in another file. What I try is, in dataloader.ss, to export the structure with (provide book-category) And in the other file, I import : (requi...

Using _bitmask from PltScheme FFI

This is a part of a plt-scheme wrapper library: (define InputMask (_bitmask '(NoEventMask = #x00000000 KeyPressMask = #x00000001 KeyReleaseMask = #x00000002 ... OwnerGrabButtonMask = #x01000000) _long)) The thing is I cant figure out ho...

Can I define a global from inside a procedure in Scheme?

I have a situation where I'd like to do something like... (define (def a b) (store a b) ; store the definition of 'a' somewhere (define-global a b)) ; also define 'a' so that its definition ; is accessible later in the program Is this possible somehow? As far as I know define-global doesn't exist, so d...

Programatically filling in a letrec in Scheme. Macros or eval?

I'm just playing with an NFA for string recognition. I have a macro that creates a function which consumes input and passes on the rest to some other functions. Because there might be loops in my NFA graph, I'm using letrec to put the whole thing together. Here is some code (been testing in PLT-Scheme): (define-syntax-rule (match chars ...

Best dynamic languages for OpenGL/general graphics

Which are the most mature and well supported solutions for writing graphical programs? I have been using C++ with OpenGL/GLUT, but would like to try a more flexible and expressive approach. Ruby and Processing? Python and OGRE? What things have worked well for you? ...

How to delete an element from a list in scheme

how to delete an element from a list ex:- list=[1 2 3 4] I have come up with some code.I think I got wrong somewhere. (define delete item (lambda (list) (cond ((equal?item (car list)) cdr list) (cons(car list)(delete item (cdr list)))))) ...

Function in Scheme that checks whether the length of a list is even

Hi I have edited the code for function in scheme that checks whether the length of a list is even. (define even-length? (lambda (l) (cond ((null? l)#f) ((equal? (remainder (length(l)) 2) 0) #t) (else #f)))) Is it corrrect? ...

Functional Programming: what is an "improper list" ?

Could somebody explain what an "improper list" is? Note: Thanks to all ! All you guys rock! ...

Assigning the result of an expression to a variable

Working with DrScheme (language-- Pretty Big). Trying to pass the result of an expression to a variable that can later be used in another expression. Here is a simplified version of the problem: Definitions window: (define (tot a b c) (+ a b c)) (define (tot2) (+ (tot a b c) 1)) Interpreter window > (tot 5 6 7) 18 > (tot2) . ....

A function in Scheme to replace all occurences of an element in a list with another element

Hi! I am able to delete the element from a list, but I have no idea how to write a function in Scheme to replace all occurences of an element in a list with another element. Any help will be appreciated. ...

Exclusive OR in Scheme

What is the exclusive or functions in scheme? I've tried xor and ^, but both give me an unbound local variable error. Googling found nothing. ...

What is the difference between Latent type and Manifest type?

Could someone give me a clear distinction between latent and manifest type system? ...

Equivalent of Java's IndexOf() in Scheme?

I am developing a small program in Scheme but I got stuck. Is there anything similar to Java's indexOf() that I could use in Scheme? ...

A list of functions

Hello, Is there a way to make a list that holds functions? What I'm trying to do is, make a list of some arithmetic operators (+ - * /) so I can easily manipulate their order and apply them to a list of numbers. So, if I have that list, I'd use it like this: (apply (map (lambda (x) x) '(+ - * /)) '(1 2...

Trying out the examples from the "The Little Schemer" book in Windows

I am currently reading 'The Little Schemer' and I need a way to test out the Scheme examples in the book on my Windows machine. With what application can I do this (on Windows, not Linux)? ...

Any decent scheme implementation that has *no* threading libs?

Hi, I am considering which scheme to use. I would like to use a scheme that has or can be compiled to have no threading support. I have to avoid the layers that threading libs provide. I want an implementation that has no code for interpreter locks, etc. Something that can compile to C is ideal. This will be Unix only. Chicken and Gambi...

Syntax changes from the examples in 'The Little Schemer' to the real Scheme

I have recently started following the examples from The Little Schemer and when trying out the examples in DrScheme, I have realised that there are some minor syntax changes from the examples in the book to what I can write in DrScheme. First of all, as a language in DrScheme, I chose Pretty Big (one of the Legacy Languages). Is this th...