Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [scheme]

Scheme is a functional programming language that is a dialect of Lisp. It has a minimalist design with a standard specification and many implementations.

Filter by
Sorted by
Tagged with
0 votes
2 answers
169 views

Scheme's define in Common Lisp

In Common Lisp, we have to use the let form to declare a new lexically-scoped variable. This means that the code either looks like that written in C89 (all variables declared on top of scope), or ...
ndsrib's user avatar
  • 9
0 votes
0 answers
409 views

Haskell where clause: is it more than just a matter of taste?

The traditional (Scheme, Pascal) way to structure code is this: declare outer function declare inner function body of inner function body of outer function The where clause in Haskell moves ...
ceving's user avatar
  • 391
4 votes
0 answers
1k views

Is there a conventional URI scheme for local sockets (AF_UNIX)?

I'm looking at creating a class which accepts a string to define a Unix socket address. Linux supports three types of addresses for Unix sockets: File based addresses (also called named domain ...
Alexis Wilke's user avatar
0 votes
1 answer
99 views

How does Lamé's Theorem give us an order-of-growth estimate for Euclid's Algorithm?

I'm reading SICP, and I don't understand how Lamé's Theorem gives us an estimate for the order-of-growth of Euclid's algorithm (the relevant passage is below). It would make sense to me if the ...
cnnrmnn's user avatar
  • 11
2 votes
3 answers
972 views

Are lessons on tail recursion transferable to languages that don't optimize for it?

I'm currently reading through Structure and Interpretation of Computer Programs (SICP). During the course of that book, the lesson of "you can optimize recursive procedures by writing them as ...
J. Mini's user avatar
  • 1,017
1 vote
1 answer
93 views

Using define in a conditional expression in Scheme

In Scheme, the general form of a procedure definition is: (define (<name> <parameters>) <body>) where <body> accepts a sequence of expressions, allowing this kind of procedure ...
Géry Ogam's user avatar
0 votes
1 answer
32 views

"preempts no lexical conventions" in a Scheme PL report

I am reading "Revised^5 Report on the Algorithmic Language Scheme," "1.3.1. Primitive, library, and optional features." In particular, implementations must support portable code by providing a ...
beroal's user avatar
  • 109
4 votes
3 answers
598 views

Can Lisp keywords be protected?

Why aren't lisp keywords protected? For example, (define a 3) (define define +) #makes define useless (define a 1) #outputs 4, instead of assigning 1 to a. Is this flexibility so important? Or even ...
Quora Feans's user avatar
1 vote
1 answer
492 views

Scheme : Lambda inside quoted list is unbound

I'm programming a small lisp/scheme interpreter and I came across the following situation : When a quoted list contains lambdas, they are not parsed as lambdas. Here is a sample code (live on repl....
Julien__'s user avatar
  • 249
7 votes
2 answers
829 views

What is the minimum practical definition for the Scheme language?

What is the smallest practical set of primitives that can be used to define the Scheme language? For example, map can be defined as (define (map proc lis) (cond ((null? lis) '()) ...
Robert Harvey's user avatar
0 votes
1 answer
805 views

Two dimensional matrix-like data type using lists and/or mutable lists

I am trying to think of an implementation of a two dimensional matrix-like data type. Normally I would take an array of arrays but I'm bound to a relatively low language level which only provides ...
Benjoyo's user avatar
  • 162
22 votes
4 answers
3k views

What about LISP, if anything, makes it easier to implement macro systems?

I'm learning Scheme from the SICP and I'm getting the impression that a big part of what makes Scheme and, even more so, LISP special is the macro system. But, since macros are expanded at compile-...
Elliot Gorokhovsky's user avatar
1 vote
1 answer
84 views

Looking for advice for the following MS SQL Schema

We currently have the following SQL Schema: Projects Budgets BudgetTabs BudgetSections BudgetTasks BudgetTaskDetails ...
Gaz's user avatar
  • 159
3 votes
0 answers
540 views

Abstract List Functions in Racket/Scheme

I'm completely stuck on a problem to write a function that does NOT use recursion, locals, or lambda. Only abstract list functions can be used. The function must input a list of positive integers, ...
E 4 6's user avatar
  • 31
9 votes
3 answers
12k views

Lambda expressions with no parameters in Haskell and / or lambda calculus

In eager languages like Scheme and Python, you can use a lambda expression without parameters to delay evaluation, e.g. in Scheme (Chicken Scheme): #;1> (define (make-thunk x) (lambda () (+ x 1))) ...
Giorgio's user avatar
  • 19.7k
48 votes
2 answers
8k views

Why do some languages round to the nearest EVEN integer?

Programming languages like Scheme (R5RS) and Python (see this Question) round towards the nearest even integer when value is exactly between the surrounding integers. What is the reasoning behind ...
Profpatsch's user avatar
1 vote
1 answer
171 views

Why is (f . l) not allowed and equal to (apply f l)?

In scheme when defined (define f (lambda (a b c d) d)) (define l (list 'a 'b 'c 'd)) Why it does not do argument destructuring? I mean arguments should evaluate first, why destructuring is not part ...
stralep's user avatar
  • 113
11 votes
2 answers
4k views

Approaching SICP in Clojure instead of Scheme

I am a third year bachelor student in a software engineering program, and I brought up the idea of reading SICP to an adviser to gain a deeper and more fundamental understanding of the principles ...
ironicaldiction's user avatar
1 vote
1 answer
1k views

Continuations, coroutines, and tail-call optimization

I am trying to learn continuations and use them to implement coroutines in Scheme. I have two procedures (coroutines) a and b, and I switch between them in the following way: ;; c is a continuation. ...
Giorgio's user avatar
  • 19.7k
4 votes
1 answer
763 views

Tail-recursive implementation of take-while

I am trying to write a tail-recursive implementation of the function take-while in Scheme (but this exercise can be done in another language as well). My first attempt was (define (take-while p xs) ...
Giorgio's user avatar
  • 19.7k
3 votes
3 answers
2k views

If Scheme is untyped, how can it have numbers and lists?

Scheme is said to be just an extension of the Untyped Lambda Calculus (correct me if I am wrong). If that is the case, how can it have Lists and Numbers? Those, to me, look like 2 base types. So I'd ...
MaiaVictor's user avatar
  • 5,830
-1 votes
1 answer
763 views

Designing XML - confused between attributes and elements [closed]

I have to design an xml structure to set standard data exchange with my client. We deal with payments and its related data. At now, my XML data looks like this: <PAYMENTS> <CURRENCY>...
now he who must not be named.'s user avatar
5 votes
1 answer
1k views

What features does MIT-Scheme have that make it ideal for SICP?

I've been thinking about trying to get through the SICP again, this time well-armed with a better idea of what the SICP is meant to accomplish, and being older and wiser than my first attempt back in ...
Elf Sternberg's user avatar
7 votes
1 answer
3k views

What's the difference between lists constructed by quote and those constructed by cons in Scheme?

(define ls1 '((1 . 2) 1 . 2)) (set-car! (car ls1) 6) ls1 (define ls2 (cons '(1 . 2) '(1 . 2))) (set-car! (car ls2) 6) ls2 After set-car!ing, ls1 will be ((6 . 2) 1 . 2) and ls2 ((6 . 2) 6 . 2). It ...
yanpengl's user avatar
  • 721
4 votes
1 answer
460 views

Why does DrRacket IDE considers some identifiers as "symbols" and some as "keywords"? What is the difference?

Why does DrRacket (kind of Scheme) IDE highlights some of the identifiers as "keywords" (for example define, lambda, send*), and the others as "symbols" (user defined identifiers, +, -, abs, send, ...
Alexey's user avatar
  • 932
5 votes
4 answers
1k views

Why it is `(cons 1 (cons 2 (cons 3 nil)))` and not `(cons 3 (cons 2 (cons 1 nil)))` for [1,2,3]?

Is there any special reason that to construct list in Scheme you use (cons 1 (cons 2 (cons 3 nil))) instead of (cons 3 (cons 2 (cons 1 nil))) ? While the first seems more obvious because it reads ...
MaiaVictor's user avatar
  • 5,830
6 votes
2 answers
2k views

Is there any particular reason for the use of lists over queues in functional programming languages?

Most functional programming languages such as Scheme and Haskell use lists as their main data structure. Queues are identical to lists, except for the fact appending to the end - not to the begin - ...
MaiaVictor's user avatar
  • 5,830
4 votes
3 answers
557 views

Obscurity of Lisp in collaborative projects [closed]

I'm playing with the idea of learning Scheme but I have a few misgivings. From what I understand Lisp makes heavy use of macros that allow programmers to drastically change the language itself. I ...
user2820561's user avatar
2 votes
1 answer
898 views

Is R6RS backwards compatible with R5RS?

Is the new Scheme standard, R6RS which was published in 2007, backwards compatible with the older standard R5RS? If not, is there a compatibility mode in R6RS?
ThePiercingPrince's user avatar
1 vote
2 answers
6k views

Multiple Data Types for Single Variable in C

I am trying to implement basic cons, car and cdr of SCHEME in C. I have made a simple program that allows me to cons two integers as shown in the main program. However, I want my program to be able to ...
Avian78's user avatar
  • 43
8 votes
4 answers
2k views

What makes Common Lisp "big"? [closed]

I've been learning both Common Lisp and Racket, and one thing that I consistently hear is that Racket is a much "smaller" language than Common Lisp. I was wondering what this really meant. As far as I ...
user avatar
0 votes
1 answer
463 views

Show all definitions in Scheme?

I want to see all user-made definitions in a Scheme REPL, both loaded from files and entered at the REPL. Is there any way to "dump all definitions"? E.g. if there is: (define (plusone x) (+ 1 x)...
Aeneas's user avatar
  • 123
4 votes
1 answer
279 views

"Final" Scheme REPL definitions: how to save them?

Is there a way to show and save all "final" definitions entered into a Scheme REPL into a text file? Say, if I have defined in the REPL: (define (increase x) (+ 1 x)) (define (multbytwo x) (*...
Aeneas's user avatar
  • 123
0 votes
1 answer
878 views

In what way is JavaScript (ECMAScript) similar to Self and Scheme

When looking at the ECMAScript 4th Edition specification here it mentions that ES3 is a simple, highly dynamic, object-based language that takes its major ideas from the languages Self and Scheme. ...
AverageMarcus's user avatar
4 votes
4 answers
458 views

In Scheme, what is formally a program's state?

I think i've understood more or less what a parsed Scheme program looks like (a binary tree with atomic values on the leaves, if i have understood correctly). Can anybody please define to me, or give ...
Alexey's user avatar
  • 932
10 votes
2 answers
2k views

Types in Lisp and Scheme

I see now that Racket has types. At first glance it seems to be almost identical to Haskell typing. But is Lisp's CLOS covering some of the space Haskell types cover? Creating a very strict Haskell ...
user2054900's user avatar
9 votes
2 answers
1k views

Who first coined the term Higher Order Function and/or First Class Citizen?

I've come to understand that long before Haskell, O'Caml or LISP, higher order functions were an academic research subject and in mathematics, Schönfinkel (in 1967) and Haskell Curry (in 1968) already ...
Abel's user avatar
  • 922
30 votes
2 answers
3k views

Applying Denotational Semantics to design of Programs

I've read a bit on denotational semantics (DS) and I'm very intrigued about the process of designing computer programs where types and functions have strong and clear mappings to mathematics. Are ...
Tim Stewart's user avatar
9 votes
1 answer
912 views

SICP - Why use accumulate with cons when filter already passes back a list

In SICP 2nd Edition section 2.2.3, the authors have the following code: (define (even-fibs n) (accumulate cons nil (filter even? (map fib ...
RAbraham's user avatar
  • 193
1 vote
1 answer
204 views

What is the meaning of # in R5RS Scheme number literals

There is a partial answer on Stack Overflow, but I'm asking something a teeny bit more specific than the answers there. So... Does the formal semantics (Section 7.2) specify the meaning of such a ...
ikmac's user avatar
  • 490
4 votes
3 answers
381 views

Is Reading the Spec Enough? [closed]

This question is centered around Scheme but really could be applied to any LISP or programming language in general. Background So I recently picked up Scheme again having toyed with it once or twice ...
daniel gratzer's user avatar
10 votes
9 answers
5k views

OS choice for functional developing [closed]

I'm mainly a .NET developer so I normaly use Windows/VisualStudio (that means: I'm spoiled) but I'm enjoying Haskell and other (mostly functional) languagues in my spare time. Now for Haskell the ...
Random Dev's user avatar
4 votes
3 answers
1k views

Can't understand example using continuations

I'm reading the r6rs Scheme report and am confused by the explanation of continuations (I find it to be too dense and lacking of examples for a beginner). What is this code doing and how does it ...
user avatar
2 votes
2 answers
819 views

Why does Scheme r5rs have no module system [closed]

With all the controversy surrounding scheme r6rs, I stuck with r5rs and I am wondering why the designers decided to not implement a module system. How does one organize code in this?
cobie's user avatar
  • 3,237
6 votes
3 answers
1k views

Am I getting Scheme wrong?

Inspired by the numerous posts about the importance of learning Lisp/Scheme I started to learn Scheme two days back, I am using the book "The little Schemer" and have completed half of it. But I ...
nischayn22's user avatar
5 votes
2 answers
2k views

What is a dotted pair's analogy in other Lisp implementations?

What is Scheme's dotted pair construct analogous to in other Lisp implementations? I can make a vector or list quite easily, and understand those in Clojure, even though the syntax is a little ...
octopusgrabbus's user avatar
10 votes
3 answers
3k views

Why do .NET modules separate module file names from namespaces?

In implementations of the Scheme programming language (R6RS standard) I can import a module as follows: (import (abc def xyz)) The system will try to look for a file $DIR/abc/def/xyz.sls where $DIR ...
dharmatech's user avatar
28 votes
6 answers
13k views

how a pure functional programming language manage without assignment statements?

When reading the famous SICP, I found the authors seem rather reluctant to introduce the assignment statement to Scheme in Chapter 3. I read the text and kind of understand why they feel so. As ...
Gnijuohz's user avatar
  • 2,055
23 votes
6 answers
6k views

How useful are Lisp macros?

Common Lisp allows you to write macros that do whatever source transformation you want. Scheme gives you a hygienic pattern-matching system that lets you perform transformations as well. How useful ...
compman's user avatar
  • 1,387
7 votes
1 answer
488 views

Process arbitrarily large lists without explicit recursion or abstract list functions?

This is one of the bonus questions in my assignment. The specific questions is to see the input list as a set and output all subsets of it in a list. We can only use cons, first, rest, empty?, empty, ...
Erica Xu's user avatar
  • 1,131