Acting on PhD student feedback to create new learning resourcesLUL Sci-Eng Team
Participants in this LILAC2012 workshop will consider real-life PhD student feedback from traditional Information Literacy sessions and use it to create ideas for new learning resources. Colleagues from Leeds University Library will share their experiences and the learning materials they created for the revised PhD workshops they launched in September 2011.
30. function add(a, b) {
if (arguments.length < 1) {
return add;
} else if (arguments.length < 2) {
return function(c) {return a + c;}
} else {
return a + b;
}
}
11年7月29日星期五 30
31. function curry(func,args,space) {
var n = func.length - args.length;
var sa = Array.prototype.slice.apply(args);
function accumulator(moreArgs,sa,n) {
var saPrev = sa.slice(0); // to reset
var nPrev = n; // to reset
for(var i=0;i<moreArgs.length;i++,n--) {
sa[sa.length] = moreArgs[i];
}
if ((n-moreArgs.length)<=0) {
var res = func.apply(space,sa);
sa = saPrev;
n = nPrev;
return res;
} else {
return function (){
return
accumulator(arguments,sa.slice(0),n);
}
}
}
return accumulator([],sa,n);
}
11年7月29日星期五 31
33. function container() {
var secret = 100;
this.add = function (a,b,c){
if (arguments.length <
this.add.length) {
return
curry(this.add,arguments,this);
}
return a+b+c + secret;
}
this.adjustSecret = function (n)
{ secret = n; }
this.giveSecret = function()
{ return secret; }
}
11年7月29日星期五 33
34. con = new container();
alert("secret is : "+con.giveSecret());
// check that value is indeed 100
curriedthingy = con.add(1,2);
// let's create a curried function
alert(curriedthingy(4));
// this alerts 107, as expected.
con.adjustSecret(1000);
// now, in the original con object,
alert(curriedthingy(4));
// and presto, it does. alerts 1007.
11年7月29日星期五 34