scheme

Learning a Lisp variant? Suggestions?

I ultimately want to learn Clojure, but I've found learning resources for Clojure to be scarce for people of little experience... I'm wondering if it would be beneficial to start with Scheme (read The Little Schemer and SICP) or some other Lisp variant. My only other programming experience is with Java and Python (which is pretty minim...

What exactly are administrative redexes after CPS conversion?

In the context of Scheme and CPS conversion, I'm having a little trouble deciding what administrative redexes (lambdas) exactly are: all the lambda expressions that are introduced by the CPS conversion only the lambda expressions that are introduced by the CPS conversion but you wouldn't have written if you did the conversion "by hand"...

Novice question about Scheme

When I try to run (define-type on DrScheme, I got error "reference to an identifier before its definition: define-type", what is it happening? I input: (define-type GUI [label (text string?)] [button (text string?) (enabled? boolean?)]) and I get result: reference to an identifier before its definition: def...

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. ...

Which languages have readily available safe evaluation environments?

I'm speaking specifically of something like the PLT Scheme make-evaluator. It will run scheme code, but under certain conditions: It only uses a definable amount of memory, and will quit execution if the script needs more It behaves similarly with time It restricts all IO except for what I specifically allow in the code Is anyone ...

another scheme beginner question

I am following the "Programming Languages :Application and Interpretation" http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/plai-2007-04-26.pdf (Page 21) Now I am working on Page 21,with all the test cases. I could only pass the first one,while all test cases that having "with" fails.I realized that my parser doesnt ...

Why isn't there a good scheme/lisp on llvm?

There is Gambit scheme, MIT scheme, PLT scheme, chicken scheme, bigloo, larceny, ...; then there are all the lisps. Yet, there's not (to my knowledge) a single popular scheme/lisp on LLVM, even though LLVM provides lots of nice things like: easier to generate code than x85 easy to make C ffi calls ... So why is it that there isn't a...

sending buffer region to the repl in emacs

hi i'm using quack mode with mzscheme, is there a way to send(evaluate) the whole toplevel contents to the REPL window? i checked the key bindings but i don't see any commands for this, there are options only for sending last sexp, last definition etc. ...

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. ...

Tail Call Elimination in Clojure?

Can somebody rewrite this (plt) Scheme code into Clojure? (define (f n) (printf "(f ~a)~n" n) (g n)) (define (g n) (printf "(g ~a)~n" n) (h n)) (define (h n) (printf "(h ~a)~n" n) (f (+ n 1))) In such a way as to not collapse the procedures f, g, and h together and to allow the code to run indefinitely without cras...

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...

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...

How do you break long string lines in Scheme?

For example, I want to break the long string in the below panic statement: (panic "Truth-assignment length is longer than the number of propositions!") I have tried (panic "Truth-assignment length is longer than the number \ of propositions!") and (panic "Truth-assignment length is longer than the number of propositions!") and they both ...

What are the prerequisites of reading 'The Little Schemer'?

From the reviews 'The Little Schemer' looks like the book to learn functional programming techniques and theory/reasoning. I wanted to ask if this book requires me to learn basic Scheme first? or I can get the hang of it in the middle? Some background about myself to give depth to my question: I'm planning to have a crack at this book, ...

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 ...

Miller-Rabin scheme implementation unpredictable output

Greetings everyone, I am new to scheme. I have tried and implemented probabilistic variant of rabin-miller algorithm using plt scheme. I know it is probabilistic and all, but I am getting the wrong results most of the time. I have implemented the same thing using C, and it worked well(never failed a try). I get the expect...

Is that possible to embbed Scheme(lisp) interpreter into iPhone app?

Hi. I'm finding embeddable Scheme interpreter(or JIT compiler or anything) into Cocoa Touch. I think just a C compatible Scheme engine may be fine. Please recommend some. I wish it's MIT/BSD style free license, but commercials are fine too. And.. does Apple AppStore allow embedded scripting like Scheme? ...

Is there any way to route input/output from TinyScheme?

I'm using TinyScheme, and currently trying to route it's console input/output into my functions without on-disk file. I'm using Cocoa Touch, and final goal is making remote interactive console. I thinks some steps required, but I cannot how to implemented each steps. Especially, the how to using FILE structure. Any recommendations & ad...

Define struct with one field in scheme

I am working on a homework assignment for a class. The problem statement says to use the data definition: (define-struct diff-exp exprs) (define-struct mult-exp exprs) ;; An Expr is one of ;; -- Number ;; -- (make-diff-exp (cons Expr LOExpr)) ;; -- (make-mult-exp (cons Expr LOExpr)) ;; Interpretation: a diff-exp represents a difference,...