das-g
mastodon 4.6.9Raphael Borun Das Gupta | বরুন দাশগুপ্ত | Rafaelo Daŝgupto
💚 esperanto° kaj 📗 Esperantisto*
👨💻 programisto kaj 🧑🏫 instruanto
mapanto je 🗺 #OpenStreetMap
°t.e., mi esperas / mi havas esperon
*t.e., mi uzas kaj apogas #Esperanton
lingvoj: de⁰ | fr¹ | en | bn_IN² | eo
dialektoj: swg⁰,¹ | gsw
⁰denaske
¹nur malbone
²preskaŭ ne
pronomoj:
de: er
fr: il
en: he / they
bn: সে / তিনি
eo: li / ri
Sentu vin libera respondi al miaj afiŝoj. Tion, kion mi ne pretas diskuti, mi ne afiŝas ĉi tie.
@byorgey@mathstodon.xyz Geometrically (from how I'd draw the list of lists of ()s; thus not algebraically like one would in a Bird-Meertens-style code transformation) I've derived the following implementation:
conjugate :: [Int] -> [Int] conjugate [] = [] conjugate (n:ns) = concat $ zipWith replicate diffs [1..] where diffs :: [Int] diffs = zipWith (-) (n:ns) (ns ++ [0])
It assumes the input is non-negative and in non-increasing order and (like your original) gives the result in non-decreasing order.
@byorgey@mathstodon.xyz How is transpose defined?
Edit: Ah, I guess it's https://hackage.haskell.org/package/base/docs/Data-List.html#v:transpose
@byorgey@mathstodon.xyz It should be more efficient than explicitly replicating all those ()s and then counting them again, but I don't know how its performance would compare to your «fiddly but efficient» version from above.


