Closed BillFoster closed 12 years ago
When you're constructing a TList, your list needs to contain TNum objects, not just normal javascript numbers. I've just committed a JME implementation of the deal function which does the conversion for you.
It would probably be good manners if the TList constructor did the conversion for you.
Thanks
-----Original Message----- From: Christian Perfect [mailto:reply+i-3374117- 16fe5c4925ff40455d76f208222804c7dc251af6-750780@reply.github.com] Sent: 24 February 2012 3:50 PM To: Bill Foster Subject: Re: [Numbas] creating permutations (#142)
When you're constructing a TList, your list needs to contain TNum objects, not just normal javascript numbers. I've just committed a JME implementation of the deal function which does the conversion for you.
It would probably be good manners if the TList constructor did the conversion for you.
Reply to this email directly or view it on GitHub: https://github.com/numbas/Numbas/issues/142#issuecomment-4159050
I need permutations of [0,1,..,n-1]
So I tried to use the function, deal in math.js. First I had to include it in jme.js, along with randomint
new funcObj('randomint', [TNum], TNum, math.randomint); new funcObj('deal', [TNum] , TList , math.deal);
randomint works but not deal
I then rewrote it as
Still doesn't work.
If I ask for {deal(4)} I get [ , , , ]
Any obvious errors?