File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,8 @@ Returns the string without the first `n` characters.
178178count :: (Char -> Boolean) -> String -> Int 
179179``` 
180180
181- Returns the number of characters in the string for which the predicate holds.
181+ Returns the number of contiguous characters at the beginning
182+ of the string for which the predicate holds.
182183
183184#### ` split `  
184185
Original file line number Diff line number Diff line change @@ -120,6 +120,13 @@ exports.drop = function (n) {
120120  } ; 
121121} ; 
122122
123+ exports . count  =  function  ( p )  { 
124+   return  function  ( s )  { 
125+     for  ( var  i  =  0 ;  i  <  s . length  &&  p ( s . charAt ( i ) ) ;  i ++ ) ;  { } 
126+     return  i ; 
127+   } ; 
128+ } ; 
129+ 
123130exports . split  =  function  ( sep )  { 
124131  return  function  ( s )  { 
125132    return  s . split ( sep ) ; 
Original file line number Diff line number Diff line change @@ -172,7 +172,8 @@ foreign import take :: Int -> String -> String
172172--  | Returns the string without the first `n` characters.
173173foreign  import  drop  ::  Int  ->  String  ->  String 
174174
175- --  | Returns the number of characters in the string for which the predicate holds.
175+ --  | Returns the number of contiguous characters at the beginning
176+ --  | of the string for which the predicate holds.
176177foreign  import  count  ::  (Char  ->  Boolean ) ->  String  ->  Int 
177178
178179--  | Returns the substrings of the first string separated along occurences
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments