Questions tagged [scheme]

Scheme is a functional programming language in the Lisp family, closely modeled on lambda calculus with eager (applicative order) evaluation. FOR questions about URL schemes PLEASE use the tag "URL-scheme".

Scheme is a functional programming language. It is designed to provide a mathematically well-founded language based on lambda calculus (with eager evaluation).

It follows a minimalist design philosophy specifying a small standard core with powerful tools for language extension. Its compactness and elegance have made it popular with educators, language designers, programmers, implementors, and hobbyists.

The Scheme language belongs to the Family. Since Scheme uses a single namespace for naming functions and other values, it is called a lisp-1.

Over the years, attempts at standardizing Scheme have been made including the R5RS standard, the somewhat controversial R6RS, and the most recent standard R7RS which is attempting to split the language into small and large (ongoing) standards.

Free Scheme Programming Books

Implementations

Community Websites

8110 questions
3
votes
1 answer

How do you get the remainder of a decimal in Racket?

I'm looking at Racket as a friendly introduction to lisp, but I'm missing something. I need to simplify angles, so all I need to do get n mod 360. The problem is n may be a decimal. I looked through the documentation, but "remainder" and "modulo"…
3
votes
1 answer

Unbound variable 'trace'

I'm trying to use the guile function trace, but every time I do, I get a possible unbound variable. scheme@(guile-user)> (define (fact1 n) (if (zero? n) 1 (* n (fact1 (- n 1))))) scheme@(guile-user)> (trace fact1) ;;; :4:0: warning: possibly…
AmaCode
  • 143
  • 1
  • 7
3
votes
5 answers

Sum of a List with all Intermediate Values

I am trying to compute the sum of a list with all the intermediate values along the way. My code is as follows but it does not work. (: sums : (Listof Integer) -> (Listof Integer)) ;; compute the sum of a list, ;; produce all the intermediate sums…
testomg
  • 45
  • 6
3
votes
2 answers

How do I rename a procedure with macros in Racket?

Let's say I want to replace all occurrences of an procedure at compile time, for example all occurrences of cons with . I tried two options that seemed natural: 1. (define-syntax (syntax-rules () [(_ x y) (cons x y)])) This works if I do…
Chris Brooks
  • 725
  • 6
  • 15
3
votes
1 answer

How to Use "random" function in DrScheme R5RS

I want to use a "random" function in DrScheme R5Rs but it says it does not exist. But it is possible to use in "Advanced student", I need to use it in R5RS, what is the way to do it? Thank you in advance!
Jack Green
  • 141
  • 2
  • 12
3
votes
1 answer

Understanding Let/cc and throw in racket

In class we talked about two functions in racket i-e letcc and throw. The instructor said that let/cc has something to do with calling with the current continuation and throw just applies a to b e.g. (throw a b) I haven't been able to find much…
danny
  • 400
  • 2
  • 18
3
votes
1 answer

Why does STklos not have the first, word, sentence, butfirst, last etc. functions?

I'm currently watching a Berkley computer science video course where they make extensive use of the Scheme programming language using the old STk interpreter. In the course, the lecturer describes Scheme as having the following functions: first,…
user4087080
3
votes
2 answers

Racket macros syntax matching with square brackets

For some reason, running this line of code: (TEST '("A")) matches the syntax definition: (define-syntax TEST (syntax-rules () [(TEST []) (print "Should not be here")] ;This statement is executed [(TEST…
Sam
  • 133
  • 4
3
votes
3 answers

Difference in implementation of gcd between logic and functional programming

I'm currently learning programming language concepts and pragmatics, hence I feel like I need help in differentiating two subbranches of declarative language family. Consider the following code snippets which are written in Scheme and Prolog,…
Burak.
  • 598
  • 7
  • 19
3
votes
1 answer

How do I define a recursive struct in Racket?

I'm trying to imitate recursive types in OCaml in untyped Racket, but I can't seem to find documentation on defining recursive structs. How would I go about mapping this: type example = | Red | Blue of example | Yellow of example * example;; into…
podington
  • 179
  • 1
  • 8
3
votes
3 answers

At which stage should I implement tail call optimization for my compiler

I wrote a small compiler in Racket for a scheme-like language. Now I want to implement TCO for my compiler. My idea is: I need to detect tail calls before transform them into intermedia representation. But from this page, it seems like TCO is…
3
votes
0 answers

Plai multiple values

my task is to make this to test to run: (test (run "{+ {2 1} {3 4}}") '(5 6 4 5)) (test (run "{+ {- {+ 1 3} 2} {10 -10}}") '(12 -8)) The source code i have so far looks like that #lang plai (require (for-syntax racket/base) racket/match…
3
votes
1 answer

Leibniz Formula in Scheme

I've spent some time looking at the questions about this on here and throughout the internet but I can't really find anything that makes sense to me. Basically I need help on realizing a function in scheme that evaluates Leibniz's formula when you…
Lawrence
  • 31
  • 3
3
votes
2 answers

How to write pseudocode for functional programming languages?

How to write pseudocode for functional programming languages like Scheme or Haskell? All that I searched for showed C style or Python style pseudocode.
Vasantha Ganesh
  • 4,570
  • 3
  • 25
  • 33
3
votes
0 answers

Possibility to extend GNU Make to support non-file targets

I am using GNU make to manage data processing work flow, expressing dependencies for 10000+ files and 100+TB. Now I am after a feature to express non-file targets in Makefile, such as datasets in hdf5, tables in sqlite, (non-conventional) files in…
heroxbd
  • 750
  • 1
  • 7
  • 20
1 2 3
99
100