Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7685815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:20:10+00:00 2026-05-31T19:20:10+00:00

I am referring to this question type Churchlist t u = (t->u->u)->u->u In lambda

  • 0

I am referring to this question

type Churchlist t u = (t->u->u)->u->u

In lambda calculus, lists are encoded as following:

[] := λc. λn. n
[1,2,3] := λc. λn. c 1 (c 2 (c 3 n))

mapChurch :: (t->s) -> (Churchlist t u) -> (Churchlist s u)
mapChurch f l = \c n -> l (c.f) n

I am thinking about what other list functions I could implement on Churchlists and successfully wrote a conc2 function that concatenates 2 church lists

conc2Church l1 l2 c n = l1 c (l2 c n)

I also tried a zipWithChurch that operates like zipWith on normal lists. But i can not find a solution. Can anyone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:20:11+00:00Added an answer on May 31, 2026 at 7:20 pm

    Do you want to use real tuples, or church tuples? I’ll assume the former.

    So, start with the desired type signature. You want it to take in 2 different Churchlists and produce a Churchlist of tuples.

    churchZip :: Churchlist a u -> Churchlist b u -> Churchlist (a,b) u
    

    Now how would you implement this? Recall that Churchlists are represented by the function that folds over them. So if our result is a Churchlist (a,b) u, we’ll want it to have the form of a function of the type ((a,b) -> u -> u) -> u -> u (this is, after all, the equivalent to the type synonym Churchlist (a,b) u).

    churchZip l1 l2 c n = ???
    

    What is the next step? Well, that depends. Is l1 empty? What about l2? If either of them are, then you want the result to be the empty list. Otherwise, you want to pair up the first elements from each list, and then churchZip the rest.

    churchZip l1 l2 c n
      | isEmpty l1 || isEmpty l2 = n
      | otherwise                = c (churchHead l1, churchHead l2)
                                     (churchZip (churchTail l1) (churchTail l2) c n
    

    This brings up some questions.

    • Are you allowed to write this function recursively? In the pure lambda calculus, you must write recursive functions with the fixpoint operator (aka the y combinator).
    • Do you have churchHead, churchTail, and isEmpty available? Are you willing to write them? Can you write them?
    • Is there a better way to structure this function? Anything can be done with a fold (remember, l1 and l2 actually are the folding function over themselves), but is that a clean solution to this problem?

    Getting up to this point is purely mechanical, assuming a firm understanding of the church encoding of lists. I’ll leave the deep thinking up to you, since this is homework.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Referring to this question I need a solution for it: HTML: <input type=file />
Referring to this question , how can i get the current page size in
referring to this question , I've decided to duplicate the tables every year, creating
Referring to this question: https://stackoverflow.com/questions/2035449/why-is-oop-hard-for-me class Form { protected $inputs = array(); public function
This question made me question a practice I had been following for years. For
Referring on this question , I have a similar -but not the same- problem..
This is a past exam question and I was wondering what a primitive type
I am referring as a follow up on this question here: Regular expression to
This question asks about the disadvantages of 'cgi-bin based' services. As far as I
I am referring this question and need to implement the same thing but for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.