All Questions
9 questions
1
vote
2
answers
871
views
Scheme - generate all distinct permutations of a list
While reading a certain book about functional programming and scheme (and Racket) in particular, I happened upon an exercise which states the following:
`
"Write a function 'rp' which takes, as an ...
0
votes
1
answer
65
views
When I run my procedure to compute the church numeral of an integer, why do I get a #("halt") error?
Alonzo Church used the lambda-calculus to create a system of representing numbers with procedures.
For example: 0 is x, 1 is f x, 2 is f(f x), and so on where the numeral is how many times f is ...
1
vote
0
answers
125
views
Use intermediate language in racket to find permutations of a list [duplicate]
I have recently started learning racket and scheme. I am practicing some operations on list and I want to find out all the permutations of a list using recursive strategy. This function will return a ...
1
vote
0
answers
555
views
functional forward checking implementation
I would like to implement the forward checking search algorithm in a functional way in scheme. Forward checking search is a depth first search that chooses a variable at each node of a graph, tries ...
1
vote
1
answer
158
views
Functional Programming Idiom to compute maximum of 4 numbers without mutation in racket/haskell
I have a count of the number of occurrences of four characters in a string in 4 variables a, b, c and d.
Now, I want to know which character occurs the maximum number of times.
I want a functional ...
2
votes
1
answer
60
views
mutable variables racket for finding range
I am trying to solve this C question to find a function that takes in 2 integer parameters, a and b and produces the range of all the elements between them, I am trying to do this in Racket.
This is ...
0
votes
1
answer
112
views
How to improve this list algorithm?
Give a list of number (character or anything else) and another random number(character or the same kind with the list), if there are two adjacent value in the list that are the same as the last one( ...
1
vote
1
answer
135
views
How to implement a deep-tree-set algorithm using fold?
This is the pseudocode for a function that will modify a specific node on a tree given a path and a new value:
path_set val path tree =
| empty? path -> val
| otherwise -> set (...
2
votes
1
answer
2k
views
Computing the longest common subsequence of two lists in Scheme in polynomial time
So I need to calculate the longest common subsequence of two lists, but it needs to be in polynomial time. The only problem i'm having is that I'm not allowed to use "!" at all. This means that I can'...