scheme

Scheme pass-by-reference

How can I pass a variable by reference in scheme? An example of the functionality I want: (define foo (lambda (&x) (set! x 5))) (define y 2) (foo y) (display y) ;outputs: 5 Also, is there a way to return by reference? ...

How do I test whether a variable is defined before referencing it?

I would like to be able to test whether a variable is defined, prior to accessing it. I like to have a global that specifies a "debug level". If debug level is 0, no extra output is given. When greater than 1, debug output is given, with more verbosity at greater numbers. I also would like to set it up so that the procedures would run...

How can i overload a function at run time in Scheme?

rt. I want to redefine a function at run time so that i can change the behavior of the system at run time. thanks. ...

Is there a Scheme implementation that parallelizes?

Is there a R5RS-or-higher Scheme implementation that does parallelization? For example, if I say to do: (map (lambda (x) (pure-functional-stuff x)) '(1 3 5 7 11 13)) it will process 1, 3, 5, and 7 simultaneously if the machine can do it? That's supposed to be one of the big advantages of functional programming, but I c...

Redefining syntactic keywords in r6rs

How can I create a library called rnrs-modified which will make the following code display "Hello, world!"...? #!r6rs (import (rnrs-modified)) (display set!) or even this would be good (arguably better, actually): #!r6rs (import (rnrs) (modified)) ;or (import (modified) (rnrs)) (display set!) Essentially I want to be able to redefi...

Why does this work in DrRacket but not in Racket from the console

(define pick (lambda (num lat) (cond ((null? lat) (quote())) ((= (sub1 num) 0) (car lat)) (else (pick (sub1 num) (cdr lat)))))) (define brees (quote (a b c d e touchdown g h i))) (pick 6 brees) The language in DrRacket is set to Advanced Student. It also works fine in the IronScheme...

Why multiple namespaces?

What is the rationale behind the design decision to have separate namespaces for values and functions in Common Lisp? What are the arguments for and against it? ...

Interacting with a Database from Scheme

Hi, i try to learn scheme and as a test project i wanted to create a very simple website with 1-2 database queries (MySQL preferred, but PostgreSQL would be ok, too). I know it's not really schemes domain but i still want to see how far i can come. Sadly, it seems i'm already stuck at using a database and googling for "scheme database" ...

Missing method in mred:canvas%?

I used MrEd Designer to make a user interface for a Scheme program. It includes a mred:canvas% on which I'd like to plot points using draw-point. It's defined as: (define (naca-ui-init {...} #:airfoil-canvas-class (airfoil-canvas-class canvas%) {...}) and later: (set! airfoil-canvas (new ...

How is Racket different Than Scheme?

Racket is a descendant of Scheme. How is Racket different than R6RS? What did it add, or take away, or is just different? I'm understanding that Racket is more than a language, it's a platform for languages. But I'm referring to the main Racket dialect. ...

Scheme: Data serializing, efficient [and functional]

I'm serializing data which may be an integer, an object (list) with other nested objects, and trying to make a choice as to what approach to be using. Of two, the first one is to create bytevectors recursively and copy them in the calling functions to a larger single bytevector; the second one is to use some kind of the stream I could wr...

Which will serve a budding programmer better: A classic book in scheme or a modern language like python?

I'm really interested in becoming a serious programmer, the type that people admire for hacker chops, as opposed to a corporate drone who can't even complete FizzBuzz. Currently I've dabbled in a few languages, most of my experience is in Perl and Shell, and I've dabbled slightly in Ruby. However, I can't help but feel that although I ...

Calling LISP or SCHEME from .NET/C#

In my existing software I have an implementation of genetic programing using home grown decission making tree that is able to apply basic logic operators (AND OR NOT) in some boolean data that are provided to it in a form of an array. The platform I am using is .NET / C# with SQLServer back end. Looking for ways to improve the perform...

What is the most performant lisp on the JVM

What is the most performant (fastest) lisp implementation on the JVM? By lisp implementation I consider all implementations of any language in lisp family, like Common Lisp, Scheme, Clojure, ... I know that Clojure can be made pretty fast using type hints, that ABCL is in general not considered to be fast. I don't have experience using ...

Scheme beginner question

When I enter the following: (define (root a b c) (/ (+ (-b) (sqrt (- (exp b 2) (* 4 a c)))) (* 2 a))) and then enter: (root 3 6 2) I get a message indicating that the procedure had two arguments but only requires exactly one. What am I doing wrong??? (be nice I am a newbee). ...

Why programming competition contestants use C++ and Java?

After competing in and following this year's Google Code Jam competition, I couldn't help but notice the incredible number of [successful] contestants that used C/C++ and Java. The distribution of languages used throughout the competition can be seen here. After programming in C/C++ for several years, I recently fell in love with Pytho...

How to print a string in backward, in scheme ?

Hi, I know if I write my scheme code in the following way and type in (word ‘(a b c)), it will out put the list in the same order. Could you please tell me if there was a way I can print it out in opposite order. Ex- (list ‘c ‘b ‘a). it needs to be the user's input I print out in opposite order. So, I can't call it (reverse '(a b c))....

Usage of Procedure and Map in Scheme

I am very new to Scheme and I am slowly finding my way around it. I have some doubts on Procedures and Map which I hope could be answered. (map plus1 (list 1 2 3 4)) will basically return me the result: (2 3 4 5) It is fine if the procedure takes in the list as its only parameter. My question is how am I able to use a procedure li...

HTDP Exercise 6.6.1 - What does it mean by template functions?

Hi all I'm looking at Scheme at the moment for a bit of fun, using the "how do design programs" book. All pretty easy so far but ran into this odd wording in exercise 6.6.1 where I'm not clear what is intended: Develop the template fun-for-circle, which outlines a function that consumes circles. Its result is undetermined. One pos...

Why is lambda instead of function defintion shorthand considered good style in scheme?

In scheme, why is this: (define foo (lambda (x) 42)) considered better style than this: (define (foo x) 42) And is there any reason to favour one over the other? ...