Post Reply 
Syntax Problems with map() and apply()
05-27-2016, 03:07 PM
Post: #12
RE: Syntax Problems with map() and apply()
I don't understand the "shuffling" distinction, do you mean the method of element (card) extraction?

L0:=MAKELIST(ranm(52,1,52),X,1,4); // Deck shuffled 4 times:
{
[[31],[12],[2],[37],[2],[45],[27],[26],[39],[43],[51],[22],[52],[12],[41],[50],[10],[20],[12],[2],[26],[31],[38],[46],[50],[13],[15],[34],[49],[18],[27],[21],[10],[8],[31],[13],[40],[21],[39],[22],[35],[47],[20],[10],[41],[24],[30],[5],[48],[19],[4],[38]],

[[9],[21],[20],[20],[1],[18],[14],[37],[49],[51],[8],[44],[52],[44],[29],[13],[16],[22],[27],[21],[44],[11],[38],[41],[20],[13],[18],[20],[6],[29],[35],[52],[37],[13],[50],[31],[15],[16],[1],[2],[17],[26],[50],[26],[30],[39],[13],[40],[23],[34],[44],[35]],

[[25],[42],[27],[10],[43],[6],[51],[8],[50],[51],[3],[1],[37],[32],[23],[6],[6],[14],[14],[14],[23],[35],[15],[29],[36],[18],[20],[4],[29],[19],[34],[12],[2],[43],[37],[34],[42],[4],[13],[23],[39],[31],[34],[12],[22],[28],[37],[17],[49],[18],[10],[15]],

[[17],[40],[19],[51],[11],[10],[5],[43],[40],[18],[40],[44],[1],[23],[36],[38],[36],[38],[44],[6],[50],[25],[16],[20],[38],[32],[29],[22],[24],[37],[18],[15],[34],[34],[17],[27],[11],[42],[48],[43],[39],[51],[51],[5],[9],[42],[10],[11],[27],[6],[20],[42]]
}

L1:=MAKELIST(rand(52,1,52),X,1,4); // Deck shuffled 4 times:
{
[29,1,4,15,36,23,7,35,6,2,5,38,16,45,32,12,18,51,26,21,13,44,46,22,52,41,17,10,48​,43,33,47,24,49,8,3,30,37,31,39,28,14,27,19,9,11,20,40,25,34,50,42],

[8,20,38,41,49,34,47,31,10,19,11,17,48,9,3,2,30,16,28,7,26,32,51,43,5,42,45,37,52​,4,33,27,13,12,50,22,44,46,35,1,36,25,23,24,14,21,15,29,39,40,6,18],

[44,36,9,43,50,47,42,24,25,46,31,48,3,27,13,29,11,20,40,26,35,51,4,17,23,30,6,52,​32,7,5,10,12,37,21,15,8,1,49,18,28,45,39,19,16,41,2,38,22,14,34,33],

[46,9,8,50,15,23,39,6,36,33,42,22,51,24,31,17,40,16,52,18,38,30,48,45,2,27,32,7,4​7,43,13,35,25,26,49,19,41,28,14,1,34,29,44,5,37,21,12,10,11,4,20,3]
}

Element selection:
L0(1,2,1) ==> 12
L1(1,2) ==> 1

Matrix, vector, and list representations enable a wide variety of additional toolbox commands, (for further processing).

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Syntax Problems with map() and apply() - DrD - 05-27-2016 03:07 PM



User(s) browsing this thread: 1 Guest(s)