Hi,
I wish to align or match some Haskell types in order to represent a set
of ontologies and their embedded concpts [1]. I am not sure wheather
modules or classes could be used. I have done this task in a language
called Maude[2]. The code is below. I appreciate that Maude is not very
popular so
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
Just remove that if. What comes after | is already a conditional.
Luke
On Dec 6, 2007 7:03 AM, Ryan Bloor [EMAIL PROTECTED] wrote:
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:
Oops, not quite. otherwise == should be otherwise =. Looks like
you already go this from the first one, but guard syntax looks like:
defn
| cond1 = ...
| cond2 = ...
| ...
| otherwise = ...
(otherwise is not actually necessary; it is just a synonym for True)
Luke
On Dec 6, 2007 7:09
Hi,
If I have something like
data Patootie = Pa Int | Tootie Int
and I want to pull out the indices of all elements of a list
that have type constructor Tootie, how would I do that?
I thought I might be able to use findIndices, but I don't
know how to express the predicate.
tootieIndices = findIndices isTootie
where isTootie (Pa _) = False
isTootie (Tootie _) = True
would be my first approach.
/g
On 2/10/06, Creighton Hogg [EMAIL PROTECTED] wrote:
Hi,
If I have something like
data Patootie = Pa Int | Tootie Int
and I want to pull out the
On Fri, 10 Feb 2006, Creighton Hogg wrote:
Hi,
If I have something like
data Patootie = Pa Int | Tootie Int
and I want to pull out the indices of all elements of a list
that have type constructor Tootie, how would I do that?
I thought I might be able to use findIndices, but I don't
know
Or inline as
findIndices (\x - case x of Tootie _ - True; _ - False) listOfPasAndTooties
There was a recent thread about wanting a more succint way to write
this (unary pattern matching):
http://thread.gmane.org/gmane.comp.lang.haskell.cafe/11109
If John got his wish, then you could write
Creighton Hogg [EMAIL PROTECTED] writes:
data Patootie = Pa Int | Tootie Int
and I want to pull out the indices of all elements of a list
that have type constructor Tootie, how would I do that?
x = [Pa 3, Tootie 5, Pa 7, Tootie 9, Pa 11]
y = [ i |Tootie i - x ]
z = [ i | i@(Tootie _) -
On 10/02/06, Creighton Hogg [EMAIL PROTECTED] wrote:
Hi,
If I have something like
data Patootie = Pa Int | Tootie Int
and I want to pull out the indices of all elements of a list
that have type constructor Tootie, how would I do that?
I thought I might be able to use findIndices, but I
On Mar 5, 2004, at 15:48, Vadim Zaliva wrote:
OK, I figured it out. For sake of other novices like me here is what
you need
to do to make it work.
0. Need to import Data.Generics
1. Compile with '-fglasgow-exts' flag
2. When deriving from Data you also need to derive from Typeable.
It slightly
Vadim Zaliva wrote:
[...] It slightly bothers me that this solution seems to be using non-standard
GHC extensions.
Hmmm, using generics seems like massive overkill for option handling. Could you
describe what you are exactly trying to achieve?
Cheers,
S.
On Mar 8, 2004, at 11:17, Sven Panne wrote:
Hmmm, using generics seems like massive overkill for option handling.
Could you
describe what you are exactly trying to achieve?
I am doing command line options parsing. I've defined Flag type with
constructor
for each possible option:
data Flag =
On Mon, 8 Mar 2004, Vadim Zaliva wrote:
I am doing command line options parsing. I've defined Flag type with
constructor
for each possible option:
data Flag = Verbose |
Input String |
Output String |
Filter String
deriving (Show,
On Mar 8, 2004, at 12:55, Ben Rudiak-Gould wrote:
This would work, but I will have to write [] part for each option.
Generics approach is overkill but looks much neater when used.
But thanks for suggestion anyway, it is always good to learn yet
another way of doing things.
Sincerely,
Vadim
Try
Hi!
I am new to Haskell, but I have background in various programming
languages (including Lisp)
I have very basic question, if there is a way to match algebraic types
constructors besides
use of pattern matching. I wrote today code like this:
data Flag = Verbose |
Input String |
On Fri, 5 Mar 2004, Vadim Zaliva wrote:
Hi!
I am new to Haskell, but I have background in various programming
languages (including Lisp)
I have very basic question, if there is a way to match algebraic types
constructors besides
use of pattern matching. I wrote today code like this:
17 matches
Mail list logo