Kronecker product: Difference between revisions

m
m (Minor edit to C++ code)
Line 366:
 
=={{header|AppleScript}}==
<lang applescript>------------ KRONECKER PRODUCT OF TWO MATRICES ------------------------------------------
 
-- kprod :: [[Num]] -> [[Num]] -> [[Num]]
Line 380:
-- f :: [[Num]] -> Num -> [[Num]]
on f(mx, n)
script go
on product(a, b)
a * b
Line 390:
end script
map(resultgo, mx)
end f
Line 401:
end kprod
 
-- TEST ------------------------------------------- TEST ---------------------------
on run
unlines(map(show, ¬
Line 412:
end run
 
 
-- GENERIC FUNCTIONS ------------------------------------ GENERIC FUNCTIONS ---------------------
 
-- concat :: [[a]] -> [a] | [String] -> String
Line 426 ⟶ 427:
acc
end concat
 
 
-- concatMap :: (a -> [b]) -> [a] -> [b]
Line 431 ⟶ 433:
concat(map(f, xs))
end concatMap
 
 
-- curry :: (Script|Handler) -> Script
Line 444 ⟶ 447:
end script
end curry
 
 
-- foldl :: (a -> b -> a) -> a -> [b] -> a
Line 456 ⟶ 460:
end tell
end foldl
 
 
-- intercalate :: Text -> [Text] -> Text
Line 464 ⟶ 469:
return strJoined
end intercalate
 
 
-- map :: (a -> b) -> [a] -> [b]
Line 476 ⟶ 482:
end tell
end map
 
 
-- Lift 2nd class handler function into 1st class script wrapper
Line 488 ⟶ 495:
end if
end mReturn
 
 
-- show :: a -> String
Line 522 ⟶ 530:
end if
end show
 
 
-- transpose :: [[a]] -> [[a]]
Line 539 ⟶ 548:
map(column, item 1 of xss)
end transpose
 
 
-- unlines :: [String] -> String
9,655

edits