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

Python vs Ruby holy war thread

Name: Christy McJesus !DcbLlAZi7U 2005-04-12 13:11

Last week I learned Python. It's not perfect but it's pretty damn cool.
This week I'm starting on Ruby. I've just encountered blocks and I would approve if someone would answer this: are blocks merely an ugly kludge because the author did not know about lambda expressions, or can they do something lambdas can't?

Name: Anonymous 2013-07-25 14:04

>>15

A lambda expression is a structure with one operator, apply. It can be defined as a triple(context, args, body) or in a typed language as quadruple (type, context, args, body).  The context contains a snapshot of the scope at creation. The arguments are the declared arguments, these are labels x,y,z. Thus a lambda function \x.x + 1 can be represented as: ({}, x, x + 1). Executing a lambda function is done by evaluating. This is substituting the variables in the body until it has shrunk to only one term. This is called evaluation and is done by the apply operator:


apply (\x -> x + 1) 1
substitute x with 1
(1 + 1)
2


Lambda calculus is a powerful model for computation, it is equally power as a Turing machine. This is shown in the research on the SKI calculus.


Many more interesting properties arise in lambda calculus.


Fun fact: A lambda expression doesn't have to be exactly one line.

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