tag:blogger.com,1999:blog-5195188167565410449.post220644804605678931..comments2016-09-19T07:11:19.884+01:00Comments on Haskell for Maths: Permutation groupsDavidAhttp://www.blogger.com/profile/16359932006803389458noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-5195188167565410449.post-72303919230450566432011-05-14T20:38:06.168+01:002011-05-14T20:38:06.168+01:00csoroz:
Yes, that's nice, not sure why I didn&...csoroz:<br />Yes, that's nice, not sure why I didn't see it in the first place. Thanks, I'll put it in a future release.DavidAhttp://www.blogger.com/profile/16359932006803389458noreply@blogger.comtag:blogger.com,1999:blog-5195188167565410449.post-30251641939516886162011-05-11T10:24:47.325+01:002011-05-11T10:24:47.325+01:00Suggestion:
> fromDigits' = fromBase 10
&g...Suggestion:<br /><br />> fromDigits' = fromBase 10<br />> fromBinary' = fromBase 2<br />><br />> fromBase b xs = f (reverse xs) where<br />> f = foldr (\x xs -> x + xs * b) 0csorozhttp://www.blogger.com/profile/16660096506198222136noreply@blogger.comtag:blogger.com,1999:blog-5195188167565410449.post-91923653783540114112009-06-13T20:27:22.278+01:002009-06-13T20:27:22.278+01:00Bark,
We're representing edges of graphs as t...Bark,<br /><br />We're representing edges of graphs as two-element lists, but really they are sets, not lists (these are undirected graphs). So to avoid complications, we just insist that the lists are always sorted. For example, this means that we can just derive an Eq instance, rather than having to write a special one.DavidAhttp://www.blogger.com/profile/16359932006803389458noreply@blogger.comtag:blogger.com,1999:blog-5195188167565410449.post-83437563727936521742009-06-13T16:49:13.919+01:002009-06-13T16:49:13.919+01:00i came up with this .^
import qualified Data.Mayb...i came up with this .^<br /><br />import qualified Data.Maybe as MB<br />import qualified Data.Map as M<br /><br />n .^ P m = MB.fromMaybe n $ M.lookup m n<br /><br />a little less verbose than the version in the library 0.1.2<br /><br />also I wonder why you sort the result of -^?Bark Madlyhttp://www.blogger.com/profile/06253090814511381256noreply@blogger.com