March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -0,0 +1,21 @@
|
|||
( " apples, pears # and bananas
|
||||
oranges, mangos ; and a durian"
|
||||
: ?text
|
||||
& :?newText
|
||||
& ( non-blank
|
||||
= %@:~(" "|\t|\r|\n)
|
||||
)
|
||||
& ( cleanUp
|
||||
=
|
||||
. @(!arg:?arg ("#"|";") ?)
|
||||
& @(rev$!arg:? (!non-blank ?:?arg))
|
||||
& @(rev$!arg:? (!non-blank ?:?arg))
|
||||
& !arg {You could write & "[" !arg "]" to prove that the blanks are stripped.}
|
||||
)
|
||||
& whl
|
||||
' ( @(!text:?line (\r|\n) ?text)
|
||||
& !newText \n cleanUp$!line:?newText
|
||||
)
|
||||
& !newText \n cleanUp$!text:?newText
|
||||
& out$(str$!newText)
|
||||
);
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(defun strip-comments (s cs)
|
||||
"Truncate s at the first occurrence of a character in cs."
|
||||
(defun comment-char-p (c)
|
||||
(some #'(lambda (x) (char= x c)) cs))
|
||||
(let ((pos (position-if #'comment-char-p s)))
|
||||
(subseq s 0 pos)))
|
||||
|
|
@ -1 +1 @@
|
|||
strip=: #~ *./\@:-.@e.&';#'
|
||||
strip=: dltb@(#~ *./\@:-.@e.&';#')
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
strip=: {.~ <./@i.&';#'
|
||||
strip=: dltb@({.~ <./@i.&';#')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
strip 'apples, pears # and bananas'
|
||||
apples, pears
|
||||
strip 'apples, pears ; and bananas'
|
||||
apples, pears
|
||||
dquote strip ' apples, pears # and bananas' NB. quote result to show stripped whitespace
|
||||
"apples, pears"
|
||||
strip ' apples, pears ; and bananas'
|
||||
"apples, pears"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue