My Lispy PDDL Parser:
https://dl.dropbox.com/u/46434672/Code/LispyPddlParser.hs
The DWR-operators.txt file:
https://spark-public.s3.amazonaws.com/aiplan/resources/DWR-operators.txt
質問
I'm programming a Lispy PDDL parser for the AI Planning class at Coursera.
How can I define a Lispy datatype in Haskell?
解決 2
My Lispy PDDL Parser:
https://dl.dropbox.com/u/46434672/Code/LispyPddlParser.hs
The DWR-operators.txt file:
https://spark-public.s3.amazonaws.com/aiplan/resources/DWR-operators.txt
他のヒント
It looks Lispy, doesn't it?
{-# LANGUAGE FlexibleInstances #-}
import Data.List
data S s = T s | S [S s] deriving (Eq)
instance Show (S String) where
show (T s) = s
show (S list) = "(" ++ (intercalate " " $ map show list) ++ ")"
sExpr = S [T "define",T "x",T "10",S [T "print",T "hello"],S []]
main = do
putStrLn $ show sExpr
The result of running main:
(define x 10 (print hello) ())