Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: Is there an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2834 of 2912
Post > Topic >>

Re: Is there any operator that could raise or lower order of function

by rossberg@[EMAIL PROTECTED] May 2, 2008 at 09:14 AM

On May 2, 9:24 am, Kaz Kylheku <kkylh...@[EMAIL PROTECTED]
> wrote:
>
> Order is perhaps the number of levels of indirection you must
> dereference to actually call a function which just returns or accepts
> a plain datum.
>
> Lambda increases order, funcall decreases.
>
> ;; fourth order function:
>
> (defvar *fourth-order*
>         (lambda () (lambda () (lambda () (lambda () '("hello"
> "world"))))))

Usually, order is the nesting depth of functional _arguments_. The
notion is easy to understand when you look at types. Say you have a
language that has only functions, tuples, and int. Then the standard
definition of order would:

  order(int)    = 0
  order(t1*t2)  = max(order(t1), order(t2))
  order(t1->t2) = max(order(t1)+1, order(t2))

That is, a function of type int->int is first-order, while ((int->int)-
>int)->int is third-order. Note however that your example would have a
type like A->(B->(C->(D->E))), and thus actually is a first-order
function - at least according to the standard definition in logic. The
reason for this definition is that via (un)currying this type actually
is isomorphic to A*B*C*D->E, which clearly is first-order. So
_returning_ a function does not raise order, unless that function is
higher-order itself. Plain curried functions are still first-order.

- Andreas
 




 1 Posts in Topic:
Re: Is there any operator that could raise or lower order of fun
rossberg@[EMAIL PROTECTED  2008-05-02 09:14:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 17:14:15 CDT 2008.