Questions tagged [lisp]
23 questions
15
votes
1 answer
Is this a generic way to convert any recursive procedure to tail-recursion?
It seems that I've found a generic way to convert any recursive procedure to tail-recursion:
Define a helper sub-procedure with an extra "result" parameter.
Apply what would be applied to the procedure's return value to that parameter.
Call this…
nalzok
- 1,111
- 11
- 21
9
votes
2 answers
Is it possible to do Dependent Types in Typed Racket?
Is it possible to use Dependent Types in the existing Typed Racket implementation? (ie do they exist in it?)
Is it reasonably possible to implement a Dependent Types System using Typed Racket?
hawkeye
- 1,199
- 8
- 20
5
votes
0 answers
Why did the Mathematica Language choose term rewriting instead of the Lambda Calculus as its basis?
Now we can see that Church was associated with the Simply Typed Lambda Calculus. Indeed, it seems he explained the Simply Typed Lambda Calculus in order to reduce misunderstanding about the Lambda Calculus.
Now when John McCarthy created Lisp - he…
hawkeye
- 1,199
- 8
- 20
4
votes
1 answer
How do you represent LISP as mathematical / logical model?
I asked this in stackoverflow, but the question probably fits here better.
This question arose from the objection that LISP is regarded as a functional language with some simple principles, namely functions, variables, and operators that roughly…
MarkokraM
- 405
- 2
- 9
4
votes
1 answer
Description of lists with functions in LISP
I have been given the following implementation of basic list functions in LISP:
nil = (lambda (k) (k ’none ’none))
(cons x y) = (lambda (k) (k x y))
(car l) = (l (lambda (x y) x))
(cdr l) = (l (lambda (x y) y))
(null? l) = (l (lambda (x y) (= x…
user1868607
- 2,224
- 14
- 23
4
votes
1 answer
How did MacLisp's garbage collector "run in the register set"?
Olin Shivers, ‘History of T’:
Maclisp on the [PDP]-10 had used a mark&sweep GC (one version of which famously "ran in the register set," though that is another story)
This implies, in my interpretation, that the garbage collector used no storage…
Daphne Preston-Kendal
- 143
- 3
3
votes
1 answer
Why pointer dereference was once called "decrement"?
I'm reading McCarthy's paper Recursive Functions of Symbolic Expressions And Their Computation by Machine, where when the author describes the machine implementation of lists, he writes this:
a. Representation of S-Expressions by List Structure. A…
wvxvw
- 1,388
- 9
- 13
2
votes
1 answer
Can we prove mathematical induction statements in Lisp?
My previous question Can we prove that $1 + 2 + \dots + n = \frac{n(n+1)}{2}$ using a computer program? has a problem that it tries to cover too much ground. Here is a related question motivated by the comments.
In Lisp and certain other languages…
john mangual
- 1,951
- 1
- 21
- 27
2
votes
1 answer
SICP: Pascal's triangle problem
I was reading SICP and was solving a problem that asked to create a function in lisp for finding elements of Pascal's triangle.
The way I went about it is to take input as the row number and then print each element of the row iteratively, whose…
Varun Patel
- 23
- 3
2
votes
2 answers
Lambda Calculus Conversion
How can I take a Haskell data type or function (eg fold, list, String, zip) and convert or translate it to a lambda calculus abstraction?
Example:
If sum computes a sum of all elements in a list, and
:type sum = Num a => [a] -> a.
sum [] =…
Zuckerbrenner
- 123
- 3
1
vote
1 answer
how to deduce a function subtype rule from a given function type definition
This question relates to liskov substitution principle seems to have two conventional meanings but is really a different question, so I'm posing it as a new question.
I'm doing a bit of research into an old language, Common Lisp, which defines…
Jim Newton
- 315
- 4
- 11
1
vote
1 answer
Claimed problems with Lisp dynamic scoping
What would be the problem of running the following scala codes assuming we are working with dynamic scoping and a global stack to store environments as some variants of Lisp do?
def fact(n:Int,f:() => Int):Int =
if(n == 0) f()
else fact(n-1,() =>…
user1868607
- 2,224
- 14
- 23
1
vote
1 answer
How does time/space complexity work with lisp
I'm completely new to programming but I've had a course in computational complexity. I'm trying to read the book "Structure and Interpretation of Computer Programs." In the first few sections, the authors make some claims about the relative…
dessin d'enfant terrible
- 113
- 4
1
vote
0 answers
Simple proof that Lisp expresses all computable list functions
Given computable function $f : LispTerm \rightarrow LispTerm$ is it possible to implement it in Lisp?
The $LispTerm$ is any term that is constructed using cons, nil and set-car!, set-cdr! (because it can be cyclic).
Of course Lisp is…
prog
- 105
- 4
1
vote
0 answers
Delayed "let" in SICP
In section 3.5.4 , i saw this block:
(define (integral delayed-integrand initial-value dt)
(define int
(cons-stream initial-value
(let ((integrand (force delayed-integrand)))
(add-streams (scale-stream…
user137213
- 11
- 1