... 12:36:12 -0700, kheirandish.amin@gmail.com wrote: nil is my own datatype . atoms : 1::Int 'a'::Char Haskell is strongly typed, so as Lauri suggests, the problem you'...in fact, you have to jump through a couple of hoops just to create a function that will accept both lists of "atoms" and lists of lists. So, I think we need to see a more complete example of how you would use the function ...
... occurrences of the first given atom, p1, replaced by the second ... be deleted and the returned list cannot contain anything in place ...give any indication about what "atoms" or "nil" are. Those are...nil" typically means the empty list, but the assignment seems to...material) doesn't specify what atoms and nil are? Are you...datatype that includes both atomic and list-like values? Finally, are...
....amin@gmail.com> wrote: how can detect some element of list is list o Atom?? What is an atom? That is term is not commonly used with ... fails to type-check. Haskell's lists are homogeneous, i.e. all the ...same type. So either _all_ elements are lists (in which case the list...them are (in which case the list has type [b] for some type b which is not a list type). In any case, there is...
On 8 Apr 2007 02:46:25 -0700, kheirandish.amin@gmail.com wrote: how can detect some element of list is list o Atom?? (list? 42) --> #f (list? '(42 37)) --> #t Steve Schafer Fenestra Technologies Corp. http://www.fenestra.com/
i want to replace on Atom by another in list..for example: replace 1 2 [1,2] => [2,2] but sometime i have replace 1 2 [[1,2],2]=>[[2,2],2] i want to detect if first element of list is list then recurcively call head on that element.. is there any solutions??
how can detect some element of list is list o Atom?? for example when i try head (head p1) where p1=[[1,2],2] return 1 but when try head (head p1) where p1=[1,2] it returns Error
...stuff which, while not using exceptions, shows some stuff where in other languages you might use exceptions. for example a function that take an Integer as argument.but we call it by pass a list as argument and then programm detect it and print something... Er, such a programme wouldn't compile anyway. That's what static typechecking is all about. Or are you trying to do something ...
... wrote: for example a function that take an Integer as argument.but we call it by pass a list as argument and then programm detect it and print something... Correction: a function that take an Integer as argument.but we call it by pass a list as argument and then compiler detect it and print something... Solution: You don't need to do anything. ...
how can i use exception handling in haskell?? is there any sample code?? for example a function that take an Integer as argument.but we call it by pass a list as argument and then programm detect it and print something... Thanks...
kheirandish.amin@gmail.com writes: (snip) NO MATTER HOW DEEP IT OCCURRED IN THE LIST. Are you sure they don't just mean, no matter how late it occurs in the list? That is, the 'depth' is how far 'along' the list it is, rather than to what degree it's wrapped up in sublists? -- Mark