Re: Quick question about delimiters

turbosol <[email protected]> Fri, 1 Jun 2007 07:50:01 -0700 (PDT)
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
I guess the part that is tripping me up is checking more than elemement in
the list of delimiters against the list to be checked.   basically, I know
how to check to see if an element is in a list, I know and can remove the
element from the list, I am just unsure as to how to check for the next
element.



Vesa Karvonen-2 wrote:
> 
> On 6/1/07, turbosol <[email protected]> wrote:
>> I am in need of writing a function to take away delimters from a string
>> so it
>> will be a string of only letters.  I have to do this without using any
>> built
>> in functions... I feel like i am close, and logically, I fell like my
>> code
>> should work, but i am getting problems when i call it.  this is what i
>> have
>> so far.
>>
>> fun remele (x, L) =
>> if null L then nil
>> else if hd x = hd L then remele(x,(tl L))
>> else if null(tl L) then remele(tl x, L)   -(*- I am not sure if this is
>> correct, but i want too check to see
>> else hd(L)::remele(x, tl L);         -(*if all elements were checked to
>> then
>> go to the next element to check
>>
>> remele([#" ", #",",#";",#".",#"\n",#"!",#"?"], explode("Hello, this is a
>> string!"));
>>
>> should yield "hellothisisastring"
>>
>> any suggestions?
> 
> Consider writing an auxiliary function
> 
>   val contains : ''a list * ''a -> bool
> 
> with the property that contains (l, x) returns true if and only if the
> list l contains an element equal to x.
> 
> -Vesa Karvonen
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Smlnj-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/smlnj-list
> 
> 

-- 
View this message in context: http://www.nabble.com/Quick-question-about-delimiters-tf3850025.html#a10913971
Sent from the SML/NJ mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/