CA 208 Logic Ex9 - PowerPoint PPT Presentation

1 / 2
About This Presentation
Title:

CA 208 Logic Ex9

Description:

1. CA 208 Logic Ex9. Define the following list processing ... Finite-State Automaton that accepts/generates the infinite language (coded as Prolog lists) ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 3
Provided by: Josefvan6
Category:
Tags: ex9 | generates | logic

less

Transcript and Presenter's Notes

Title: CA 208 Logic Ex9


1
CA 208 Logic Ex9
  • Define the following list processing predicates
    in Prolog
  • member(X,L) if X is a member of list L
  • last_member(X,L) if X is the last member
    of list L
  • last_two_members(X,Y,L) if X and Y are the last
    two members of list L
  • odd_list(L) if L has odd number of elements
  • even_list(L) if L has even number of elements
  • insert(X,L1,L2) if list L2 is list L1 with X
    inserted
  • delete(X,L1,L2) if list L2 is L1 with X
    deleted
  • conc(L1,L2,L) if list L is the concatenation
    of L1 with L2
  • reverse(L1,L2) if list L2 is the reverse of L1

2
CA 208 Logic Ex9
  • Define a waffle-machine in Prolog as a
    Finite-State Automaton that accepts/generates the
    infinite language (coded as Prolog lists)
  • b,l,a,h
  • b,l,a,h,b,l,a,h
  • b,l,a,h,b,l,a,h,b,l,a,h, ....
Write a Comment
User Comments (0)
About PowerShow.com