3 ms·
It is a lot less of a problem then you make out: most of the time, the single letter naming conventions are actually very useful. Its not like all the haskeller
by kazagistar 11y ago
It is a lot less of a problem then you make out: most of the time, the single letter naming conventions are actually very useful. Its not like all the haskellers just forgot the usefulness of names from the other languages they frequently use; it is an educated and measured choice.
That said, it certainly can be taken too far and turn into a clusterfuck.
permutations :: [a] -> [[a]]
permutations xs0 = xs0 : perms xs0 []
where
perms [] _ = []
perms (t:ts) is = foldr interleave (perms ts (t:is)) (permutations is)
where interleave xs r = let (_,zs) = interleave' id xs r in zs
interleave' _ [] r = (ts, r)
interleave' f (y:ys) r = let (us,zs) = interleave' (f . (y:)) ys r
in (y:us, f (t:y:us) : zs)
- ridiculous_fish 11y agoaddart a = array ((-1,0),(n,m+n)) $ z ++ xsi ++ b ++ art ++ x where z = ((-1,0), a!(0,0)) : [ ((-1,j),0) | j <- [1..n] ] ++ [ ((-1,j+n),a!(0,j)) | j <- [1..m] ] xsi = ((0,0), -colsum a 0) : [ ((0,j),0) | j <- [1..n] ] ++ [ ((0,j+n), -colsum a j) | j <- [1..m] ] b = [ ((i,0), a!(i,0)) | i <- [1..n] ] art = [ ((i,j), if i == j then 1 else 0) | i <- [1..n], j <- [1..n] ] x = [ ((i,j+n), a!(i,j)) | i <- [1..n], j <- [1..m] ] ((_,_),(n,m)) = bounds a From Matrix.Simplex https://hackage.haskell.org/package/dsp-0.2.1/docs/src/Matrix-Simplex.html https://hackage.haskell.org/package/dsp-0.2.1/docs/src/Matri...
- rtpg 11y agohttps://hackage.haskell.org/package/dsp-0.2.1/docs/src/Matrix-Simplex.html#addart https://hackage.haskell.org/package/dsp-0.2.1/docs/src/Matri... link to the function itself Never really seen something like this before, really hope someone will clean it up
- codygman 11y agoTo be fair it looks to be a relatively complex operation. Do you know how any other languages implement this?