I wrote this today

Object.extend(Class.Methods,{
  curry: function(){
   var curriedArguments = $A(arguments)
   return Class.create(this,{
     initialize : function($super){
 
$super.apply(this,curriedArguments.concat($A(arguments).splice(1)))
     }
   })
  }
})


Here is an example of how I commonly use it

var Herd = Class.create((function(){

  var Cow = Class.create({
    initialize : function(herd, name){
      this.herd = herd
      this.name = name
      this.herd.cows.push(this)
    }
  });


  return {
    initialize : function(name){
      this.name = name
      this.Cow = Cow.curry(this)
    },
    cows:[]
  }
})());


myHerd = new Herd('Jareds herd')
new myHerd.Cow('bessy')
myCows = myHerd.cows

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to