Talk About Network



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 2 of 2 Topic 2829 of 2842
Post > Topic >>

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

by lisp2.3.CalRobert@[EMAIL PROTECTED] (Robert Maas, http://tinyurl.c May 4, 2008 at 01:29 AM

To: rigaha at gmail dot com, posting from IP number 128.61.122.197
 hence presumably a student at the Georgia Institute of Technology:
 You are forbidden to read this reply, because you are a potential
 terrorist and I don't want to help any potential terrorist with
 homework and thereby possibly help a future terrorist get a degree
 that isn't deserved and thereby help a terrorist get a job at an
 important facility that affects millions of lives. Please post the
 name and e-mail address of your instructor who assigned that
 homework, OK?
Everyone else feel free to continue reading:

> From: Slobodan Blazeski <slobodan.blaze...@[EMAIL PROTECTED]
>
> What would [it] mean to raise the order of a function?

It's not possible to change anything, because the result is not the
same thing as what you had before. For example, if you add 1 to a
number, you have a different number, not the original number "changed".

> In j you usually play with rank of a function, that returns a new
> function, or you can curry uncarry them, but in order to make an
> ordinary function into a higher order one I really don't have a
> clue.

This is not especially interesting, but given a function you can
create a no-arg function that returns the original function:
Here's a factory that does that:
  (lambda (fun) #'(lambda () fun))
And given a no-arg function that returns a function, it's trivial
to use FUNCALL or APPLY with no args to get that return value
function. Here are respective customers of the factory:
  (lambda (noargfun) (funcall noargfun))
  (lambda (noargfun) (apply noargfun NIL))
Of course that code is completely general. You don't have to pass a
function to that original factory, anything will work just the same
to create a no-arg function that returns whatever you passed to the
factory.

Hmm, this is a perverse case where the factory is smaller than the
customer, but I guess using the #' reader-macro is cheating. The
factory should have been written as:
  (lambda (fun) (function (lambda () fun)))
Then the factory is larger than either of its customers, as it should be.

Putting both facts together:
(lambda (fun) (function (lambda () fun)))
=> #<Interpreted Function (LAMBDA (FUN) #'(LAMBDA () FUN)) {9031769}>
(funcall * 42)
=> #<Interpreted Function "LAMBDA (FUN)" {9036A89}>
(funcall *)
=> 42

Hmm, Rainer Joswig asked if the OP was asking for help with
homework, then KMP really hit the N.A.I.L. on the head when he
replied with a meta-riddle in the form of a paraphrase of the
original posting. But I've been at a loss to make up an appropriate
phrase with that abbreviation, until now:
  Noticeably Awful Instructional Luser, i.e. Bad Student.

After I came up with that, it occurred to me to look here:
<http://www.acronymattic.com/results.aspx?q=NAIL>
But the closest I could find was:
  New Adventure in Learning
So I think I've genuinely coined a new kind of NAIL, which is
a lot better than re-inventing the same old wheel!  :-)

So, just like we say <plonk> or Troll alert! in response to certain
kinds of Original Postings, maybe now we can simply reply N.A.I.L.
any time we spot somebody asking us to do his/her homework for him/her?




 2 Posts in Topic:
Is there any operator that could raise or lower order of functio
Slobodan Blazeski <slo  2008-05-02 00:05:28 
Re: Is there any operator that could raise or lower order of fun
lisp2.3.CalRobert@[EMAIL   2008-05-04 01:29:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat May 17 10:55:24 CDT 2008.