×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Who is right, me or my professor?

## Who is right, me or my professor?

(OP)
In a test i got this question:

Define a stream of all numbers in pascal triangle.

(define (pascal a b)
(cons-stream a (pascal(+a b)(b))

Knowing that it will give me a stream of all Natural numbers.
(and pascal triangle is basically all natural numbers..)
I didn't got one point on that question. Who do you think is right, me or my professor?

Thanks

(OP)

(OP)

### RE: Who is right, me or my professor?

Hi namooth,
I don't understand why should your function have 2 arguments, i.e. (pascal a b) ?
IMHO it should depend only of one argument n, i.e. (pascal n).

For example for n=0..4.. the Pascal-triangle is:

#### CODE

0.row:                 1
1.row:              1     1
2.row:           1     2     1
3.row:        1     3     3     1
4.row:     1     4     6     4     1
...

IMHO, your professor probably wants to have a function which delivers for given n either
1. the numbers contained in triangle of order n, i.e:

#### CODE

for n=0: (1)
for n=1: (1)
for n=2: (1 2)
for n=3: (1 2 3)
for n=4: (1 2 3 4 6)
...
or
2. only the n-th row of Pascal triangle, i.e:

#### CODE

for n=0: (1)
for n=1: (1 1)
for n=2: (1 2 1)
for n=3: (1 3 3 1)
for n=4: (1 4 6 4 1)
...
I think, that the 2.function has better purpose, because then the combinatorial number C(n,k) could be taken as k-th element of sequence delivered by the function, for example:

#### CODE

C(4,0)=1 is the 0-th element of (1 4 6 4 1)
C(4,1)=4 is the 1-th element of (1 4 6 4 1)
C(4,2)=6 is the 2-nd element of (1 4 6 4 1)
...

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!