This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module SliderPuzzle where | |
import Prelude hiding (Either(..)) | |
import Data.Vector (Vector, (//), (!?)) | |
import qualified Data.Vector as Vec | |
import Control.Arrow (second, (***)) | |
import Control.Monad.State.Strict | |
import Data.Set (Set) | |
import qualified Data.Set as Set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module SliderPuzzle where | |
import Prelude hiding (Either(..)) | |
import Data.Vector (Vector, (//), (!?)) | |
import qualified Data.Vector as Vec | |
import Control.Arrow (second, (***)) | |
import Control.Monad.State.Strict | |
import Data.Set (Set) | |
import qualified Data.Set as Set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sudoku where | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Data.Char | |
import Data.List | |
newtype Board = Board (Map (Int, Int) Int) | |
instance Show Board where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rec where | |
import Data.Maybe | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import Data.List (nub) | |
data Logic = Logic :& Logic | |
| Logic :| Logic | |
| Not Logic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PriorityQueue where | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
data Unique = U | |
instance Eq Unique where | |
U == U = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PriorityQueue where | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
data Unique = U | |
instance Eq Unique where | |
U == U = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiWayIf, MultiParamTypeClasses, FunctionalDependencies #-} | |
module AStar where | |
import Control.Monad.State | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
import PriorityQueue (PriorityQueue) | |
import qualified PriorityQueue as Prio | |
class Ord s => AStarState s m | s -> m where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Map (Map) | |
import qualified Data.Map as Map | |
instance (Ord k, Monoid k) => Applicative (Map k) where | |
pure = Map.singleton mempty | |
f <*> x = Map.fromList [(mappend fk xk, f Map.! fk $ x Map.! xk) | fk <- Map.keys f, xk <- Map.keys x] | |
instance (Ord k, Monoid k) => Monad (Map k) where | |
return = pure | |
m >>= f = Map.fromList $ do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample :: Presentation | |
sample = | |
emptyPresentation { | |
slides = [ | |
Slide [ | |
Header 1 "Genetski algoritmi", | |
Header 2 "Križanja" | |
], | |
Slide [ | |
Header 2 "Sadržaj", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lns :: Diagram SVG | |
lns = Diag.fromOffsets [Diag.unitX # Diag.rotateBy (1/8)] | |
pattern :: Diagram SVG | |
pattern = Diag.gridCat $ replicate 64 lns | |
circle :: Diagram SVG | |
circle = Diag.circle 4 `Diag.clipBy` pattern | |
where circleClip = Diag.circle 4 # Diag.translate (Diag.r2 (4, 4)) # Diag.showOrigin :: Diagram SVG |