Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*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.

Students Click Here


Who is right, me or my professor?

Who is right, me or my professor?

Who is right, me or my professor?

In a test i got this question:

Define a stream of all numbers in pascal triangle.

My answer was:

(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?


RE: Who is right, me or my professor?

Please can anyone help?

RE: Who is right, me or my professor?

Anyone with a clue in scheme, please, i need your help

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:


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:


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)
2. only the n-th row of Pascal triangle, i.e:


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:


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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close