Looks good! A few tips:
funcList :: [Int - Int]
funcList = [\_ - 1, \_ - 2, \_ - 3]
funcList = [const 1, const 2, const 3]
iterateCircularFL :: [a - b] - (a - b, [a - b])
iterateCircularFL (x:xs) = (x, concat [xs, [x]])
{- If you use cycle in main then you do not need this function at
A big thanks to you all for the discussion. I have determined that a
monad is actually not the best representation of a circular list of
functions. I was able to implement it without any special syntax or
unusual typing. For the curious:
--
On Thu, Feb 28, 2008 at 8:28 AM, Aaron Altman [EMAIL PROTECTED] wrote:
I am working on an AI agent that will perform a finite series of actions
before starting the sequence over again. I figured a circular list of
functions that shifts as you apply them would be the way to do it...
I think
On Thu, Feb 28, 2008 at 4:28 AM, Aaron Altman [EMAIL PROTECTED] wrote:
runActionAndIterate :: [a - a] - a - (a, [a - a])
runActionAndIterate (currentAction:actionList) actionInput =
(currentAction actionInput, concat [actionList, [currentAction]])
shiftActionList :: [a - a] - [a - a]
On Thu, Feb 28, 2008 at 8:15 AM, Roel van Dijk [EMAIL PROTECTED] wrote:
I'm nitpicking but,
Not a nitpick, a great difference =). As someone else already said on
this list, it's not good to answer e-mails in the early morning heh.
Thanks,
--
Felipe.
I'm nitpicking but,
On Thu, Feb 28, 2008 at 11:44 AM, Felipe Lessa [EMAIL PROTECTED] wrote:
Bas van Dijk's 'always' (also called 'forever'[1])
forever a = a forever a
always f z = f z = always f
Forever doesn't pass the result of the action to its recursive call,
always does.
On Thu, Feb 28, 2008 at 7:44 AM, Felipe Lessa [EMAIL PROTECTED] wrote:
Bas van Dijk's 'always' (also called 'forever'[1])
Sorry, of course
always' :: Monad m = (a - m a) - (a - m ())
forever :: Monad m = (m a) - (m ())
are of different types and so are different functions.
--
Felipe.
Hi everybody. I'm working towards a better understanding of Haskell
monads the only way I know how: by working through an example.
I am working on an AI agent that will perform a finite series of actions
before starting the sequence over again. I figured a circular list of
functions that
On Thu, Feb 28, 2008 at 7:28 AM, Aaron Altman [EMAIL PROTECTED] wrote:
newtype CircularFuncList funcList arg = CircularFuncList (funcList -
arg - (arg, funcList))
instance Monad (CircularFuncList funcList arg) where
return a = CircularFuncList (\funcList a - (a, funcList))