Scheme is a functional programming language in the Lisp family, closely modelled on lambda calculus with eager (applicative-order) evaluation.

learn more… | top users | synonyms

4
votes
4answers
4k views

How to Solve N-Queens in Scheme?

I'm stuck on the extended exercise 28.2 of How to Design Programs. I used a vector of true or false values to represent the board instead of using a list. This is what I've got which doesn't work: ...
1
vote
0answers
32 views

Scheme, N-queens optimization stragegies SICP chapter 2

SICP contains an partially complete example of the n-queens solutions, by walking a tree of every possible queen placement in the last row, generating more possible positions in the next row to ...
1
vote
2answers
45 views

How to make a copy of a procedure in Scheme?

So, from the SICP we know that the cons car and cdr can be defined as a procedure: (define (cons x y) (lambda (m) (m x y))) (define (car z) (z (lambda (p q) p))) (define (cdr z) (z ...
0
votes
1answer
30 views

Scheme Parameter Not Applicable

I am starting to learn Scheme and well, I am trying to implement my own max function that gives the max of just two parameters. I've written the function like this: (define (myMax x y) (cond ((> x ...
1
vote
1answer
29 views

GNU Guile SCM to char*

I am relative new to FFI and GNU Guile, and I am writing bindings to a library that heavily uses char* variables. Here is code from function, that wraps C function: static inline char* ...
3
votes
2answers
48 views

How can I convert code to a string or print it with proper spaces in scheme?

Is there a way to convert code to a string in scheme with proper spaces or even pretty print? So when I apply this to a form like (+ 1 2) it should result in "(+ 1 2)" and not in "+12".
2
votes
3answers
65 views

Finding and removing the last occurrence of a specified element in a list [racket]

I've started to write a function that should find the last occurrence of an element in a list. My idea was to use search to count the occurrences of the specified symbol and return it. I would then ...
1
vote
2answers
43 views

n arity zip function in scheme (problems with apply and map)

I am having trouble calling map over a list of lists. 01>(define (foldr f accum xs) (if (null? xs) accum (f (car xs) (foldr f accum (cdr xs))))) 02> (map (lambda xs foldr cons '() xs) ...
0
votes
1answer
43 views

Deconstructing a recursive process - SICP

Consider the following definition: (define foo (lambda (x y) (if (= x y) 0 (+ x (foo (+ x 1) y))))) What is the test expression? (write the actual ...
1
vote
1answer
53 views

Embeddable Scheme interpreter [closed]

I know Lua is best-in-class for embedding, but I want to use Scheme or some LISP dialect as scripting language for my C app. What are good interpreters to embed? My criteria are: Open source ...
1
vote
1answer
34 views

Simulating classes in scheme

I'm writing code to simulate classes: (define (className) (define value 1) (define (obj arg1) ;constructor (define (increment) ((+ value 1))) (define (get) ...
1
vote
4answers
52 views

How to sort disorder list of numbers in scheme

What it the proper way to sort a list with values in Scheme? For example I have the values which are not ordered: x1, x5, x32 .... xn or 3, 4, 1, 3, 4, .. 9 First I want to for them by increase ...
0
votes
3answers
34 views

Scheme empty list expression

I'm using http://rextester.com/runcode to do some scheme testing. When I run (define x (cons 3 null)) (write x) it has an ERROR: Unbound variable: null. How do I refer to an empty list in the ...
2
votes
3answers
767 views

Lists as arguments in Scheme

Let's say I have a procedure foo that takes three arguments, and returns a list of them all doubled: (define (foo a b c) (list (* 2 a ) (* 2 b) (* 2 c))) What I'd like to be able to do is create ...
1
vote
1answer
37 views

insert an image into a frame x y coordinates

Hi I would like to know how to insert an image into a window but with coordinates. (define ventana (new frame% [label "Ba"] [width 1100] ...

1 2 3 4 5 175
15 30 50 per page