Creating 2 dimensional list matrix

后端 未结 3 750
迷失自我
迷失自我 2021-01-24 17:07

How do you create a list-based matrix of 1\'s with given row and column counts? For example, like:

row=3,column=4 -> [[1,1,1,1],[1,1,1,1],[1,1,1         


        
3条回答
  •  遥遥无期
    2021-01-24 18:01

    You can do this with replicate:

    onesMatrix rows cols = replicate rows (replicate cols 1)
    

提交回复
热议问题