Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.lisp
Re: Loop is cool
William James
3/6/2016 2:41:00 AM
> The task is to take a single string with embedded newlines and chop it
> up into a list of strings without newlines, and here is what I came up
> with:
>
> (setq *log* "1234
> 5678
> 90")
>
> (loop with log = *log*
> for start = 0 then (1+ index)
> for index = (position #\Newline log :start start)
> collect (subseq log start index)
> while index)
>
> ;=> ("1234" "5678" "90")
SML:
String.tokens (Char.contains "\r\n") "a\r\nb\n\nc\n\n\n";
===>
["a", "b", "c"]
--
[W]e had enough employees who made more than 85 to fill all the openings. The
highest score that any of the blacks scored on the test was 11. The lowest
score that any black made on the test was 4. All four of those blacks went
into skilled-trades training.
https://archive.org/download/TheOldmanArchives/oldman29-...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Loop is cool
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password