Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^8: IO::Lambda: call for participation

by zby (Vicar)
on Jan 06, 2009 at 09:19 UTC ( [id://734377]=note: print w/replies, xml ) Need Help??


in reply to Re^7: IO::Lambda: call for participation
in thread IO::Lambda: call for participation

Hmm - the callback to 'grep' is a predicate in the sense used in mathematical logic (a function that takes an element and returns true of false), the others (for map and sort) are not. This is your choice - but I would at least verify in your sources if indeed all the callbacks are called predicates, I googled for the term and I cannot find such a usage of it (for example the Merriam-Webster dictionary definition is very close to the mathematical one).
  • Comment on Re^8: IO::Lambda: call for participation

Replies are listed 'Best First'.
Re^9: IO::Lambda: call for participation
by dk (Chaplain) on Jan 06, 2009 at 09:49 UTC
    Yes, you're right, even though callback to grep is indeed a predicate in logical sense, the others are not. That's why I'm saying that IO::Lambda use of the word does not correlate with its use neither in logical/mathematical, nor in programming domains. Also, in IO::Lambda not callbacks, but functions accepting these callbacks are called predicates, which furthers the semantic distance between the word and its expected meaning even more. I wish there would be an established term describing such a functionality, but I don't know any. I was forced for devise a word for it, but as much as I dislike making up new words, and I know that it's sometimes acceptable to redefine an existing word, I chose "predicate", which I think gets closest to the definition of "function with perl signature (&), that accepts a callback on perl stack and parameters on the context stack, executes the callback when the event associated with function, and defined by parameter passed on context, is completed". The same concerns are valid for "lambda": there are no one-word terms for "lightweight FSM generator object tied with anonymous subroutine", except possibly "a monad", but people run away screaming from that word :)

    In common use, if I'm not mistaken, I'm not a native speaker, predicates can be thought as constructs (words, sentences) answering questions "if?" and sometimes "when?", f.ex. "we'll talk when you come back", also assuming that we won't talk if you won't come back. In this sense, one can think of, say, predicate "read" in the same fashion: the callback will be called when a socket becomes readable, but it won't be called if the socket never becomes readable.

    Nevertheless, I'm open to renaming "predicate" into something more appropriate.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://734377]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found