1 / 23

Writing RPAL Programs

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.

vernon
Download Presentation

Writing RPAL Programs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Writing RPAL Programs • First, review RPAL's syntax

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

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

  5. Let's Write a Few Programs (cont’d) • 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.

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

More Related