-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplasm_basics.js
More file actions
30 lines (28 loc) · 750 Bytes
/
plasm_basics.js
File metadata and controls
30 lines (28 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
PLASM basics
//AA:Apply-to-All
AA(SUM) [[1,2,3],[4,5,6]]
--------------------------------
//DISTL: DISTribute-Left
DISTL [2,[1,2,3]]
// => [[2,1],[2,2],[2,3]]
---------------------------------
TRANS: TRANSpose
TRANS [[1,2,3],[10,20,30],[100,200,300]]
// => [[1,10,100],[2,20,200],[3,30,300]]
---------------------------------
arithmetic ops
MUL [3,4]
// => MUL [3,4] = 12
MUL [[1,2,3],[4,5,6]]
// => MUL [[1,2,3],[4,5,6]] = [4, 10, 18]
----------------------------------
SUM [3,4]
// => SUM [3,4] = 7
SUM [[1,2,3],[4,5,6]]
// => SUM [[1,2,3],[4,5,6]] = [5, 7, 9]
----------------------------------
PROD [3,[1,2,3]]
// => PROD [3,[1,2,3]] = [3, 6, 9]
PROD [4,[10,20,30]]
// => PROD [4,[10,20,30]] = [40, 80, 120]
----------------------------------