vindarel / cl-str

Modern, simple and consistent Common Lisp string manipulation library.
https://vindarel.github.io/cl-str/
MIT License
305 stars 37 forks source link

Feat: add *whitespaces* characters, export symbol #87

Closed kilianmh closed 1 year ago

kilianmh commented 1 year ago

Two further questions might be:

  1. Are there any more whitespace characters?
  2. The char-code of #\Linefeed #\Newline (10) is identical and #\Linefeed even evaluates to #\Newline. So can #\Linefeed be discarded from the list?
vindarel commented 1 year ago

The char-code of #\Linefeed #\Newline (10) is identical and #\Linefeed even evaluates to #\Newline. So can #\Linefeed be discarded from the list?

I would keep the two and add a comment. Probably on some platforms they are different.

LGTM.

kilianmh commented 1 year ago

Now there's some documentation added.

2 more things came things came to my mind regarding whitespaces:

vindarel commented 1 year ago

Now there's some documentation added.

+1

2 more things came things came to my mind regarding whitespaces:

* Should we export the symbol, because someone might want to use it outside of `cl-str`?

good idea

Since whitespaces is basically a constant value, could/should it be defined as a constant (alexandria:define-constant) or global variable (global-vars:define-global-var) ? Then there would be no run-time boundness checks (for global-vars at least on SBCL, CCL, Lispworks) and as constant even value directly in place inserted at compilation (if i remember correctly).

I was saying: I'd rather not include another dependency (and AFAIK Alexandria is not a transitive dependency. The only one is cl-ppcre (and change-case, but that's cl-ppcre)).

but *whitespaces* is not a constant value, a user could "let over" it (more so if it is exported).

kilianmh commented 1 year ago

Now *whitespaces* is an exported symbol. Also the whitespace characters in the string-trim examples in README are updated to the new character list.

I'd rather not include another dependency

Yeah it's probably good to keep the transitive dependency list small.

*whitespaces* is not a constant value, a user could "let over" it (more so if it is exported)

Makes sense

vindarel commented 1 year ago

Very nice again, thanks.