Is anyone familiar with this?
Write a procedure that takes as inputs
a procedure that computes f and a
positive integer n and returns the
procedure that computes the nth
repeated application of f. The
procedure should be able to be used as
follows:
((repeated square 2) 5)
625
I know that the following code I've create...
Evaluate:
((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)
This is what I did:
-evaluate ((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)
-evaluate 5 -> 5
-evaluate (((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4)
-evaluate 4 -> 4
-evaluate ((lambda (x) (lambda (y) (lambda (x) (+ x y)))) ...
(define (square x)
(display (* x x)))
(define (sum-of-squares a b)
(+ (square a) (square b)))
I tested it, and the sum-of-squares function will not work. Why is this?
...
If f is a numerical function and n is a positive integer, then we can form the nth repeated application of f, which is defined to be the function whose value at x is f(f(...(f(x))...)). For example, if f is the function x + 1, then the nth repeated application of f is the function x + n. If f is the operation of squaring a number, then t...
What is the time complexity? Why?
(define (mult a b)
(define (internal a accum)
(if (= a 1) accum
(internal (- a 1) (+ accum b))))
(internal a b))
(define (to-the-power-of m n)
(define (internal x accum)
(if (= x 0) accum
(internal (- x 1) (mult accum m))))
(internal n...
Hello.
A simple question on how to get the response from a Web Service that can be validated using Liquid XML Studio.
Web Service code (ASP.NET 2.0):
[WebMethod]
[return: XmlElement("TestMe")]
public string TestMe(int value)
{
return value.ToString();
}
The will result in this response:
<?xml version="1.0" encoding="utf-8"?>
<soa...
I know my quiestion is silly but I'm not good in Math:
I'm writing a program:
I want to count the consumption of water and electricity and phone calls.
I know how i want it but i dont know how to translate it to C# statments
1- I created the method decimal getElect(Unit kw)
I want the consumption to be counted as the following:-
---...
What is the difference between int *a[3] and int (*a)[3]?
...
Does a comparison sort have to compare the A[i] largest and A[i+1] largest values? I think any comparison sort must, but I'm not sure. I've checked out mergesort, insertion sort, and quicksort and in each of them the A[i] largest and A[i+1] largest values have to be compared.
...
I believe there's a way to find the kth largest element in an unsorted array of length n in O(n). Or perhaps it's "expected" O(n) or something. How can we do this?
Cheers!
p.s. this is not for homework.
...
When should unions be used? Why do we need them?
...
look at one of my header file which consists of a union template with 4 different structures.
<#define MAX 3
union family
{
struct name /*for taking the name and gender of original member*/
{
unsigned char *namess;
unsigned int gender;
union family *ptr_ancestor; /*this is a pointer to his ancestors detai...
how to use array of function pointers in c?
how to initialize them?
...
I'm working through some homework and a question on a previous exam paper asks to name all of the abstract classes in a given UML diagram. Fairly straightforward, I suppose. There is one abstract class and three interfaces. Do these interfaces qualify as abstract classes, in general?
...
I'm trying to find a way to determine how many parameters a constructor has.
Now I've built one constructor with no parameters and 1 constructor with 4 parameters.
Is there, in C#, a way to find out how many parameters a used or given constructor has?
Thing is, I'm using a third constructor to read log files. These logs files are read...
How do you draw the following dynamic 3D array with OpenGL glDrawPixels()?
You can find the documentation here: http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html
float ***array3d;
void InitScreenArray()
{
int i, j;
int screenX = scene.camera.vres;
int screenY = scene.camera.hres;
arra...
I have a variable
unsigned char* data = MyFunction();
how to find the length of data?
...
I'm working on a project for school , and I'm implementing a tool which can be used to download files from the web ( with a throttling option ) . The thing is , I'm gonna have a GUI for it , and I will use a JProgressBar widget , which I would like to reflect how much the tool downloaded so far , and for that I would need to know the siz...
What is the most efficient way to cacluate the closest power of a 2 or 10 to another number? e.g.
3.5 would return 4 for power of 2 and 1 for power of 10
123 would return 128 for power of 2 and 100 for power of 10
0.24 would return 0.25 for power of 2 and 0.1 for power of 10
I'm just looking for the algorithm and don't mind the langu...
let us have a situation in which the following program prints some 10 lines of #
for(i=0;i<10;i++)
prinf("\n#");
now how to go back to 5 th line and edit that # and change the color of it without clearing the screen or clearing the below 5 lines?
I have tried
window(5,0,20,20);
textcolor(GREEN);
cprintf("#");
but it is not editing...