hi
I was curious as to whether my implementation of a Rose Tree and a sumTree
function was correct. The aumTree adds up the elements of a tree.
data Tree a = Leaf a | Node [Tree a]
sumTree :: Tree Int - Int
sumTree (Node []) = 0
sumTree (Node xs) = sum (map sumTree xs)
The problem with
hi I am writing a basic Parser from scratch. So far I have functions;#
removeSpaces# match - which checks if a string is a substring of another#
orParser which combines two parser's abilities# Basic pasrers like... parseInt,
parseTrue, parseFalse, parseBoolusing the orParser on True and
hi
I have a function parseInt... which needs an error guard for when the input is
not an Int.
parseInt :: ParserparseInt [] = []parseInt xs = let (digits, rest) = span
isDigit (removeSpace xs)in [(EInt (read digits), removeSpace
rest)]
Also... I have a function that does
hi I have a function parseInt... which needs an error guard for when the input
is not an Int. parseInt :: ParserparseInt [] = []parseInt xs = let (digits,
rest) = span isDigit (removeSpace xs)in [(EInt (read digits),
removeSpace rest)] Also... I have a function that does this...
hi sorry for vagueness. I am writing a basic Parser from scratch. So far I
have functions; # removeSpaces # match - which checks if a string is a
substring of another # orParser which combines two parser's abilities # Basic
pasrers like... parseInt, parseTrue, parseFalse, parseBoolusing the
hi I am writing a basic Parser from scratch. So far I have functions;#
removeSpaces# match - which checks if a string is a substring of another#
orParser which combines two parser's abilities# Basic pasrers like... parseInt,
parseTrue, parseFalse, parseBoolusing the orParser on True and
hi
I have a problem.
Function A is a function that passes its input into B
Function B is a function that does something once.
How do I make it so function A is done multiple times without adding a third
function?
Ryan
_
hi
I have four functions below: What I want to do is have a way to parse more than
one digit or more than one string head in ParseTrue. Any ideas...
removeSpace:: String - StringremoveSpace = dropWhile (`elem` space)
where space = [' ']
match :: String - String - (Bool,
hi
test :: Parser (Char,Char) test = do x - item item
y - item return (x,y)
How come this brings an error saying that after do {} it must end with an
expression.
Ryan
_
Get free
hi
The code below does almost what I want but not quite! It outputs...parseInt
12444a gives...
[(EInt 1,2444a),(EInt 2,444a),(EInt 4,44a),(EInt 4,4a),(EInt 4,a)]
What I want is: [(EInt 12444, a)]
data Expr = EInt {vInt :: Int} -- integer values | EBool {vBool :: Bool} --
boolean
hi
Can anyone advise me on how to check whether a string contains ints, chars,
bools, etc
2345 + 6767 shoudl give IntAdd (2345) (6767)
2345 should give IntT 2345
Ryan
_
Who's friends with who and co-starred in what?
hi
I have a matching problem... I am wanting to identify whether or not a string
is an opening substring of another (ignoring leading spaces). I have this:
word is a single word and str is a string.
match :: String - String - (Bool, String)match word str |
if removeSpace
hi
I am having trouble with a function that is supposed to eliminate spaces from
the start of a String and return the resulting string. I reckon a dropWhile
could be used but the isSpace bit is causing me problems...
words :: String - String
words a = case dropWhile isSpace a of
HI
I will try and explain it better.
I am meaning to write a function that takes a string, apple and
eliminates the spaces at the start ONLY. called removeSpace :: String
- String
I decided to use the function 'dropWhile' and another one 'isSpace' in the
'removeSpace'
hi
I was testing my code when I came across a strange predicament. The input is a
list of ints and a Results type which is of type
[(int,...),(Int..)..]. I am comparing each int from the list to the
first element in each member of results. But it works for 1-9 but not for 10
hi
I've attempted to cut down this module... but I cannot see where... can someone
help...
Ryan
thanks
From: [EMAIL PROTECTED]: Subject: FW: please help... small problemDate: Fri, 9
Nov 2007 21:57:30 +
sorry heres the code I always do that.
From: [EMAIL PROTECTED]: Subject:
hiya
I was wondering how I would get the second function do recursively do the
function for poolNews xs tried that and it fails.
Ryan
--Give wins, draws a rating.
poolNews :: Result - PoolNews - PoolNews
poolNews (a,b,c,d,e) (home,away,goaless,scoredraw)
| c d =
hi
Is there anyway to cut down this code and to not use auxillary functons, but
instead use pattern matching? The code basically splits up a list 'rslis' into
a list of lists - but so each word is split up and the integers have been
parsed. so [hi ryan 1,hi jeff 2] becomes [[hi,ryan 1],
sorry heres the code
I always do that.
From: [EMAIL PROTECTED]: Subject: please help... small problemDate: Fri, 9 Nov
2007 21:44:35 +
hi Is there anyway to cut down this code and to not use auxillary functons, but
instead use pattern matching? The code basically splits up a list
hi
I am trying to create a function that uses the words function... I am doing the
same thing to each element in a list so I am using mapping techniques.
Code...
--Define the main first function rStrings2Results :: ([String] - String) -
[[String]] - [String] rStrings2Results f(head:tail)
hello, I am struggling with rose trees
in Haskell. I need to construct an algebraic data type definition for
family trees and a representation of the tree below. Also I need to
construct a function that returns a persons children when given both a
family tree and a name. The same is needed but for
Hello,
I need help... I am having trouble with rose trees.
1
2 3 4
5 6 7 8910 11
That is the rose tree that I seek.
Hi, its Ryan here...
I've just come from an intensive course in java and have been thrown into the
imperative world of haskell.
The problem that I have is extremely simple in java but I am having trouble
adjusting my old mindset.
A multiset is a collection of items.
Each item may occur one
23 matches
Mail list logo