8,216 questions
2
votes
1
answer
115
views
Web Components in Scheme interpreter in JavaScript?
I have a Scheme interpreter written in JavaScript called LIPS, and I have a define-class macro which is using the ES5 prototype system. But I have a problem in creating super().
I'm trying to create a ...
4
votes
1
answer
75
views
Is there a bug in the commutator of vector fields in scmutils?
I'm reading "Functional Differential Geometry" by Sussman and Wisdom. The book uses mit-scheme and the scmutils library to teach differential geometry. On page 48 equations (4.29), (4.30) ...
0
votes
1
answer
58
views
How to round very big float number into x numbers after decimal point in Scheme?
I have a Scheme interpreter written in JavaScript called LIPS.
And a recent version of Node changed the precision of the floating-point numbers by one digit (Node 24, because of V8 change).
So (expt 0....
0
votes
4
answers
132
views
Evaluation of expression in operator position of a list
I am trying to learn Lisp, but it seems like I can not quite get behind how the quotes and the evaluation works. Why does the following expression
((car '(car)) '(a b))
not evaluate to a in the REPL? ...
1
vote
2
answers
167
views
Replacing the element in the list with the specific index using `foldr` —— Exercise 1.19 of Essentials of Programming Language
Here is the question from Mitchell Wand's Essentials of Programming Language:
Exercise 1.19 [⋆ ⋆] (list-set lst n x) returns a list like lst, except that the n-th element, using zero-based indexing, ...
2
votes
0
answers
56
views
issues with set-car! when implementing SICP evaluator in Racket
I am implementing circular evaluator in Chapter 4 SICP with racket, it seems that the code running fine only it cannot add new frames to the environment due to set-car! issue.
I tried the followings:
...
1
vote
1
answer
88
views
Scheme: calling `define-syntax-rule` in a loop
I wonder whether it is possible to call define-syntax-rule in a loop-like construction like for-each. I explicitly say 'loop-like' because I know that normal Scheme evaluation comes after macro ...
1
vote
1
answer
119
views
call/cc and multiple values
I'm playing around with implementing looping using call/cc and wrote a map function like this:
(define (map1 f l)
((lambda (state)
(let ((cc (car state))
(l (cadr state))
(...
1
vote
1
answer
64
views
What are "array increments" and "row-major order" in Guile Scheme?
In the documentation for the array_copy function in Guile Scheme is a warning that in the copy, "the array increments may not be the same as those of src". (Where "src" is the ...
4
votes
2
answers
85
views
Graph recursive walk in Scheme
I have an undirected graph which nodes are numbered from 0 to 5. Adjacencies are given with a vector of lists #((1 2) (0 3) (0) (1) (5) (4))), thus node 0 is connected to nodes 1 and 2, node 1 is ...
2
votes
1
answer
135
views
Don't understand Scheme "unbound identifier" message for this function definition [duplicate]
For this code (using Racket IDE) when doing "Run"
#lang scheme
(define (queue! q x)
(let ( (b (list x))
)
(if (null? (car q))
(set-cdr! q b)
(set-cdr! (car q) b)...
1
vote
3
answers
92
views
Scheme stack-like object
Trying to build a very simple stack structure :
(define (make-stack lst)
(lambda message
(case (car message)
((see) (newline) (write lst))
((empty?) (null? lst))
((push) (begin
...
1
vote
0
answers
61
views
How does dynamic-wind work with delimited continuations?
I'm trying to figure out how to implement dynamic-wind in the context of delimited continuations. Any resources or conceptual model?
While I found reference implementations of dynamic-wind for the ...
1
vote
2
answers
98
views
How to get consistent scientific notation with limited precision in Bigloo Scheme?
I'm working with floating-point numbers in Bigloo Scheme, and I encountered a precision issue when performing a simple multiplication:
(* 0.005 1e-9)
;; => 5.0000000000000005e-12
I was expecting ...
-1
votes
1
answer
68
views
Explain random selection of cons-ed weighted nodes
In Scheme (extempore version) I sometimes use expressions similar to the following
to choose alternative defined callback nodes.
(random (cons 0.1 'node1) (cons 0.2 'node2) (cons 0.7 'node3))
This ...