Presentation is loading. Please wait.

Presentation is loading. Please wait.

Writing RPAL Programs Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Concepts Lecture 13.

Similar presentations


Presentation on theme: "Writing RPAL Programs Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Concepts Lecture 13."— Presentation transcript:

1 Writing RPAL Programs Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Concepts Lecture 13

2 Writing RPAL Programs First, review RPAL's syntax

3

4

5

6

7 Let's Write a Few Programs 1.Factorial: 1.Bottom-up (classic) 2.Top down. 3.Top-down, counting from 1 to n, 4.Bottom-up, counting from 1 to n. 2.Palindrome (classic) 3.Add up numbers in a list. Variation: find smallest one.

8

9

10

11

12

13

14

15 Let's Write a Few Programs (cont’d) 4.Remove repeated numbers from a tuple. 5.Create pairs of characters from two strings. P('abc','def')=('ad', 'be', 'cf') 6.Inner product of two vectors: IP( (1,2,3), (1,2,3)) = 14

16

17

18

19 Let's Write a Few Programs (cont’d) 7.Pretty-print a tree. Recursively build a string. NOTE: parentheses required ! Variation 1: structure the program using 'lets'. Variation 2: print the number of children for each node.

20

21

22

23 Writing RPAL Programs Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Concepts Lecture 13


Download ppt "Writing RPAL Programs Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Concepts Lecture 13."

Similar presentations


Ads by Google