Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Haskell -

Posted on 2006-11-05
2
Medium Priority
?
214 Views
Last Modified: 2010-04-16
Given that I have the following function:

-- This function constructs InputData where InputData is either a line of words ex "Hi there. Oh it's Bob!" or
-- it is a word in which to search the string  ex "?Bob"
inputline :: String -> InputData
inputline (x:xs)
  | x == '?' =  Search xs
  | otherwise = Line (x:xs)

so for example:
inputline "hello bob"
returns > Line "hello bob"

What I can figure out is how to pass this inputline data type into a function, and then return just the string part.  

Help please??
0
Comment
Question by:twibblejaway
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 2000 total points
ID: 17878791
I've never seen Haskell before, but I'm gonna take a shot and suppose it works similar to OCaml in its pattern matching:

undoit  :: InputData -> String
undoit (Line (x))
    = x
0
 

Author Comment

by:twibblejaway
ID: 17879185
Very nice shot
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question