Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Scheme/DrRacket

Name: Anonymous 2013-01-10 13:28

How do I write a function that takes any integers in a list and produces the number of values in the list whose one's digit (i.e. the least significant or rightmost digit) is 1. For example,
(ones (list 82 231 1 22 1000)) => 2?

Name: Anonymous 2013-01-10 17:47

Expanded:

COUNT-ONE-DIGITS := ((λg.(λx.g (x x)) (λx.g (x x))) (λr.λf.λx. ((λp.λa.λb.p a b) ((λp.p (λx.λy.(λx.λy.y))) x) (λf.λx.x) (((λp.λa.λb.p a b) (f ((λp.p (λx.λy.x)) x)) (λn.λf.λx.f (n f x)) (λf.λx.f x)) (r ((λp.p (λx.λy.y)) x)))))) (λx.(λm.λn.(λp.λq.p q p) ((λm.λn.(λn.n (λx.(λx.λy.y)) (λx.λy.x)) ((λm.λn.n (λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)) m) m n)) m n) ((λm.λn.(λn.n (λx.(λx.λy.y)) (λx.λy.x)) ((λm.λn.n (λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)) m) m n)) n m)) (((λg.(λx.g (x x)) (λx.g (x x))) (λr.λx.(λp.λa.λb.p a b) ((λm.λn.(λn.n (λx.(λx.λy.y)) (λx.λy.x)) ((λm.λn.n (λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)) m) m n)) (λf.λx.f (f (f (f (f (f (f (f (f (f x)))))))))) x) (r ((λm.λn.n (λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)) m) x (λf.λx.f (f (f (f (f (f (f (f (f (f x)))))))))))) x)) x) (λf.λx.f x))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List