Skip to content

Instantly share code, notes, and snippets.

@BillFoster
Created February 9, 2012 21:44
Show Gist options
  • Save BillFoster/1783493 to your computer and use it in GitHub Desktop.
Save BillFoster/1783493 to your computer and use it in GitHub Desktop.
Why vectors to lists cast would be useful
{ notes: " Lists to vectors as below. Vectors to lists would be more efficient as could then sum up over subranges i.e. rows and columns"
name: MAS1342 20122013 CBA1a_1
extensions:[stats]
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
allowregen: true
showfrontpage: false
reverse: true
browse: true
}
feedback: {
showtotalmark: true
}
functions:{
ft:{
parameters:[[v,vector],[m,number],[n,number],[j,number],[k,number]]
type:string
definition:"""switch(j=0 and k=0, '<table border = "1"><tr><td>$\var{v[j*n+k]}$</td>'+ft(v,m,n,j,k+1),
j=m-1 and k=n-1, '<td>$\var{v[j*n+k]}$</td></tr></table>',
k=0, '<tr><td>$\var{v[j*n+k]}$</td>'+ft(v,m,n,j,k+1),
k=n-1, '<td>$\var{v[j*n+k]}$</td></tr> \n'+ft(v,m,n,j+1,0),
'<td>$\var{v[j*n+k]}$</td>'+ft(v,m,n,j,k+1))
"""
}
}
questions: [
{
name: MAS1342 20122013 CBA1a_1
variables: {
a: "sort(repeat(random(0.005..0.995#0.001),m*n-1))"
a1:"a+1"
a0:"[0]+a"
b:"vector(a1)-vector(a0)"
m:random(3..10)
n:random(3..10)
}
statement: """
{ft(b,m,n,0,0)}
"""
parts: [
]
advice: """
"""
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment