Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
2 votes
0 answers
46 views

data ChurchN a = ChurchN { numeral :: (a -> a) -> a -> a , litRep :: String } next :: ChurchN a -> ChurchN a next x = ChurchN { numeral = \f y -> f (numeral x f ...
4 votes
1 answer
136 views

I'm currently learning about Church encoding and I'm trying to implement the mul (multiply) function. This is the correct implementation mul cn cm = \f x -> cn (cm f) x This (my implementation) ...
0 votes
1 answer
409 views

This is a church number implementation under rust, but there are some problems ,there is my code use std::cell::RefCell; use std::rc::Rc; pub type Church<T> = Rc<dyn Fn(Rc<dyn Fn(T) -> ...
6 votes
2 answers
179 views

Following standard definitions of Church-encoded natural numbers and lists represented as right folds, I want to write a function that takes a list of numbers as its argument and returns sum of its ...
1 vote
0 answers
242 views

I was studying Haskell and happened to know the church encoding of algebraic data types. For example, the unit type in Haskell can be encoded as a polymorphic function type. But one can also define a ...
0 votes
1 answer
107 views

I was trying to implement the Church numeral predecessor function pred, then I referred to the wikipedia page about church encodings. According to it I wrote the following {-# LANGUAGE ...
1 vote
1 answer
311 views

Well, suppose that I have a set of functional definitions (with a syntax tree) in church encoding : true : λx -> λy -> x false : λx -> λy -> y Giving the definition λx -> λy -> y, ...
1 vote
3 answers
424 views

Following up from a previous question I asked about writing a curry function, How to create a make-curry function like racket has, I've started writing the fixed case for 0, 1, 2 -- they are very ...
0 votes
1 answer
885 views

I'm working my way through SICP, and it gives the following definition for zero for Church Numerals: (define zero (lambda (f) (lambda (x) x))) I have a few questions about that: Why the complicated ...
0 votes
1 answer
440 views

I'm practicing with OCaml compiler and I'm doing a small assignment where we have to implement Church numerals defined as: zz = pair c0 c0; ss = λp. pair ( snd p) ( plus c1 (snd p)); prd = λm. fst (m ...
0 votes
1 answer
280 views

I am trying to define a procedure that takes an integer and returns its representation in Church numerals. Could any one please help me figure out the mistake I am making? The following code it's what ...
stcol's user avatar
  • 141
1 vote
1 answer
392 views

How can I express the following function by a lambda term? f(n) = T if n != 0. F if n = 0. n stands for a Church numeral. I know that 0 := λf.λx.x where λx.x is the identity function and all other ...
2 votes
0 answers
145 views

The well-known Church encoding of natural numbers can be generalized to use an arbitrary functor F. The result is the type, call it C, defined by data C = Cfix { run :: forall r. (F r -> r) -> ...
0 votes
2 answers
1k views

I want to change decimal encoding number to chruch encoding number ? (define (encode n) (lambda(fn)(lambda(x) (funPower (fn n)x)))) What's wrong with my code? Thank you.
-1 votes
2 answers
175 views

I've been recently working with recursive expressions in Python. An example of such expression is given as: ['+', [['*', ['i0','i1']], ['*', ['i2','i3']]]] I'm attempting to transform expressions ...

15 30 50 per page
1
2 3 4 5
...
7

AltStyle によって変換されたページ (->オリジナル) /