writing rpal programs
DESCRIPTION
Writing RPAL Programs. Programming Language Concepts Lecture 13. Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida. Writing RPAL Programs. First, review RPAL's syntax. Let's Write a Few Programs. Factorial: Bottom-up (classic) Top down. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/1.jpg)
Writing RPAL Programs
Prepared by
Manuel E. Bermúdez, Ph.D.Associate ProfessorUniversity of Florida
Programming Language ConceptsLecture 13
![Page 2: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/2.jpg)
Writing RPAL Programs
• First, review RPAL's syntax
![Page 3: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/3.jpg)
![Page 4: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/4.jpg)
![Page 5: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/5.jpg)
![Page 6: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/6.jpg)
![Page 7: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/7.jpg)
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.
![Page 8: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/8.jpg)
![Page 9: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/9.jpg)
![Page 10: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/10.jpg)
![Page 11: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/11.jpg)
![Page 12: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/12.jpg)
![Page 13: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/13.jpg)
![Page 14: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/14.jpg)
![Page 15: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/15.jpg)
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
![Page 16: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/16.jpg)
![Page 17: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/17.jpg)
![Page 18: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/18.jpg)
![Page 19: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/19.jpg)
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.
![Page 20: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/20.jpg)
![Page 21: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/21.jpg)
![Page 22: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/22.jpg)
![Page 23: Writing RPAL Programs](https://reader036.vdocuments.site/reader036/viewer/2022062518/568140c0550346895dac85e2/html5/thumbnails/23.jpg)
Writing RPAL Programs
Prepared by
Manuel E. Bermúdez, Ph.D.Associate ProfessorUniversity of Florida
Programming Language ConceptsLecture 13