5
голосов
1ответов
870 просмотров

How does PLTScheme Catch errors?

I am amazed by the "error" function in PLTScheme. If I have a division by zero, it doesnt do any other recursion and just comes out of the call stack and give me an error. Is there an implicit continuation before all the functions? Does the error throw away the call stack? Does anybody have an...

3
голосов
1ответов
1227 просмотров

Embedding IronScheme in a C# app

I'm trying to add a plugin architecture to my C# app. I've chosen IronScheme as the language, and also because it's built on the DLR, which should make it easier to embed. On the Codeplex Wiki, they have the following example. I changed it slightly: public class PluggerInner { IScriptEngine...

0
голосов
3ответов
8834 просмотров

do any one use Dr scheme programming? how to sort using list?

which data structure to use to sort n numbers in dr scheme i m not allowed to use vector and structure ..if i use list i cant edit the list values .so how can i sort n numbers . the language i use is textual mzscheme rsr5

63
голосов
7ответов
27891 просмотров

What is ' (apostrophe) in Lisp / Scheme?

I am on day 1 hour 1 of teaching myself Scheme. Needless to say, I don't understand anything. So I'm reading The Little Schemer and using this thing: http://sisc-scheme.org/sisc-online.php as an interpreter. I need to use ' in for example (atom? 'turkey) to avoid an "undefined variabl...

130
голосов
6ответов
22866 просмотров

Why does Clojure have "keywords" in addition to "symbols"?

I have a passing knowledge of other Lisps (particularly Scheme) from way back. Recently I've been reading about Clojure. I see that it has both "symbols" and "keywords". Symbols I'm familiar with, but not with keywords. Do other Lisps have keywords? How are keywords different from symbols other ...

45
голосов
12ответов
36237 просмотров

Does anyone use the Scheme programming language for a living?

I started learning Scheme for fun, and was wondering if anyone uses it for a living as a prime programming language... or even as an additional tool to the programming arsenal? If so, what do you use it for? What kind of problems do you typically solve with it?

2
голосов
2ответов
195 просмотров

two methods of composing functions, how different in efficiency?

Let f transform one value to another, then I'm writing a function that repeats the transformation n times. I have come up with two different ways: One is the obvious way that literally applies the function n times, so repeat(f, 4) means x → f(f(f(f(x)))) The other way is inspired from the fas...

3
голосов
2ответов
478 просмотров

Can someone explain the following Scheme code?

I have been listening to Stanford's programming paradigm lecture series, but I'm confused by the following code (from lecture 20). Would someone explain, line by line, what this is doing? Thanks. (define (flatten sequence) (cond ((null? sequence) '()) ((list? (car sequence)) (append (...

2
голосов
2ответов
1637 просмотров

how can I make vim send command to gnu screen session

I am trying to figure out how to script vim to send a message to a gnu screen "window". i.e. I have a screen session open and in one window I have a vim session and in the other a scheme interpreter. When I save my vim session I would like it to restart the interpreter in the other window loading...

3
голосов
1ответов
448 просмотров

Learning Scheme Macros. Help me write a define-syntax-rule

I am new to Scheme Macros. If I just have one pattern and I want to combine the define-syntax and syntax-rules, how do I do that? (define-syntax for (syntax-rules (from to) [(for i from x to y step body) ...] [(for i from x to y body) ...])) If I just have one for, how do I combine t...

2
голосов
1ответов
714 просмотров

Function Table in Scheme using Association List

I am attempting to build a rudimentary interpreter in Scheme, and I want to use an association list to map to arithmetic functions. This is what i have so far: ; A data type defining an abstract binary operation (define binoptable '(("+" . (+ x y))) ("-" . (- x y)) ("*" . (* x y)) ...

13
голосов
5ответов
4223 просмотров

SICP making change

So; I'm a hobbyist who's trying to work through SICP (it's free!) and there is an example procedure in the first chapter that is meant to count the possible ways to make change with american coins; (change-maker 100) => 292. It's implemented something like: (define (change-maker amount) (de...

18
голосов
4ответов
4742 просмотров

What is the exact definition of a Metacircular Interpreter?

Is it legal to call a C compiler written in C or a PHP interpreter written in PHP metacircular? Is this definition valid only for languages of a specific type, like Lisp? In short, what are the conditions that an interpreter should satisfy for being called Metacircular?

1
голосов
3ответов
6208 просмотров

Scheme Compare item or list if it's inside the test list (can be nested)

My Goal is to make the function part? return true if a list or an item is inside the nested list. But so far I can only get it working with signal item inside a first order list. (not nested list yet) (define part? (lambda (item l) (and (not (null? l)) (or (= item (car l)) ...

0
голосов
2ответов
2530 просмотров

Extract every number in the list and reconstruct the list?

I need to create this function flat that's supposed to re-contract a new list from the input list (but here, the input list can have a nested list inside): ex. flat of (A (B (C) D) A) is (A B C D A) My algorithm is the following, not sure if it's correct: Check if the list is empty: if not, g...

4
голосов
7ответов
863 просмотров

Cons of first class continuations

What are some of the criticisms leveled against exposing continuations as first class objects? I feel that it is good to have first class continuations. It allow complete control over the execution flow of instructions. Advanced programmers can develop intuitive solutions to certain kind of prob...

3
голосов
2ответов
971 просмотров

How do I tell if the value of a variable is a symbol bound to a procedure in Scheme?

I am familiar with Common Lisp and trying to learn some Scheme, so I have been trying to understand how I'd use Scheme for things I usually code in Common Lisp. In Common Lisp there's fboundp, which tells me if a symbol (the value of a variable) is bound to a function. So, I would do this: (let...

4
голосов
1ответов
516 просмотров

Scheme equivalent to Haskell where clause

I am just learning scheme, but I would love to be able to repeat myself less. Is there a way I can assign a name to a subexpression in the local scope? As per the comment: Haskell where clause x = s * t where s = 10 t = 20 x should be 200 in this case.

13
голосов
2ответов
15357 просмотров

scheme list equivalence comparison

Hello I need to check if two lists have same elements in same order but I wasn't able to achieve as it seems like scheme eq? and eqv? checks by reference so giving false to such: > (eq? (list 1 2 3) (list 1 2 3)) #f > (eqv? (list 1 2 3) (list 1 2 3)) #f How to achieve this ?

4
голосов
1ответов
439 просмотров

Best way to write portable Scheme code?

In Common Lisp I can conditionally exclude or include code for different implementations like this: #+sbcl (use-sbcl-cool-feature) #-sbcl (use-my-own-not-so-cool-version) This way I can write portable code by isolating the non-portable bits. How can this be done in Scheme? Is there a way to a...

2
голосов
1ответов
2640 просмотров

difference between structural recursion and accumulative recursion

I have been learning scheme and I like to know the difference between the two. Thanks.

0
голосов
3ответов
976 просмотров

random number generation inside a vector

Under scheme I want to generate a vector of random numbers, I have tried this like this: (make-vector 10 (random 100)) and the output for this is such: #(44 44 44 44 44 44 44 44 44 44) so it seems like it uses the same seed for the generated items, how can I overcome this problem of generat...

1
голосов
2ответов
1450 просмотров

Compiling MIT Scheme on Ubuntu 9.04

When I run ./configure I receive: configure: running /bin/bash ./configure '--prefix=/usr/local' --cache-file=/dev/null --srcdir=. Unknown machine type: none configure: error: ./configure failed for compiler This is on a Lenovo laptop with 4GB of memory. Linux shllaptop 2.6.28-15-generic #49-U...

27
голосов
4ответов
5706 просмотров

Is Clojure closer to Scheme or Common Lisp from a beginner's perspective?

If I want to learn Clojure, should I start by learning Scheme or Common Lisp? Or is Clojure different enough from both of these, that I should just start learning Clojure by itself?

0
голосов
2ответов
301 просмотров

Undefined function in DrScheme?

Hey i'm just trying to write some code in DrScheme: ((function (x) (* x x)) 2) but i got a message saying: reference to undefined identifier: function I'm using language "Essentials of Programming languages (3rd ed.)" and the version of DrScheme is 4.2.1 Thanks!

2
голосов
2ответов
545 просмотров

Quotation in Scheme

Following is a exercise from SICP. I couldn't figure it out on my own. Can some why help me understand? Type following code into interpreator: (car ''abracadabra) And it print out 'quote'. Why?

11
голосов
6ответов
6370 просмотров

How to parse out base file name using Script-Fu

Using Gimp 2.6.6 for MAC OS X (under X11) as downloaded from gimp.org. I'm trying to automate a boring manual process with Script-Fu. I needed to parse the image file name to save off various layers as new files using a suffix on the original file name. My original attempts went like this but f...

2
голосов
2ответов
516 просмотров

Is IronScheme suitable for working through SICP?

Will there be any incompatibilities with the code in SICP if I use IronScheme?

2
голосов
3ответов
4153 просмотров

Scheme Factorial (fact* l) Question

I'm a newbie at Scheme, so forgive the question: I have a function that calculates the factorials of a list of numbers, but it gives me a period before the last number in the results. Where am I going wrong? code: #lang scheme (define fact (lambda (n) (cond ((= n 0) 1) ...

4
голосов
4ответов
654 просмотров

Functional GLUT?

I'm learning a bit of functional programming in Gambit-C Scheme by restricting myself to not using set!. I thought it might be fun to write a little OpenGL game using this environment, which seems to lend itself well to game development. However, it seems to be difficult to stick to a functiona...