Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

string-trim

Name: Anonymous 2011-05-21 18:46

CL has string-trim string-left-trim string-right-trim
String trimming is all nice and useful, but what if I want to trim lists or vectors? What if I want to invert their result (return margins, instead of middle), like haskell's `init`? Why there are 3 functions, when CL has keywords? Could they also have keywords for capitalize/downcase/upcase work? It would be nice to have a full blown string processing DSL.

Name: Anonymous 2011-05-21 18:59

CL's string processing is not ideal, but it's not that bad either. I tend to write a small library for some more common things that are not part of CL, and for more advanced stuff there's cl-ppcre.
As for trimming lists? From start? Just use one of the searching functions which traverse the list. remove(-if(-not)) with the right arguments may also achieve the same thing from the end. There's probably many other ways to do it as well. I never contemplated of the concept of trimminga list or vector as these things tend to be better thought of differently (but many times with the same results).

You'll need to be more specific if you want me to give some specific examples.

Could they also have keywords for capitalize/downcase/upcase work?
Do you mean the readtable ones? They are for how symbols are read in and printed (separately).

It would be nice to have a full blown string processing DSL.
If it doesn't have something that you want, you're always welcome to make your own. That's what I do, especially since it's usually fun and easy once you got down the concepts of what you want it to do.

Name: Anonymous 2011-05-21 19:16

As for trimming lists? From start? Just use one of the searching functions which traverse the list. remove(-if(-not))
But remove-if-not works on a whole sequence!

Do you mean the readtable ones? They are for how symbols are read in and printed (separately).
I mean CL has string-capitalize and string-downcase. They could be composed into single DSL.


(string :capitalize :trim (read-string))

Name: Anonymous 2011-05-21 21:59

>>1
Just use Haskell. CL sucks.

Name: Anonymous 2011-05-21 22:00

>>4
haskell cannot into keywords.

Name: Anonymous 2011-05-21 22:07

Lisp: reduce
Haskell: fold, foldl, foldr, foldl', foldr1, foldl1, foldl1'

Name: Anonymous 2011-05-21 23:52

cl-interpol + cl-ppcre = string problems solved

Name: Anonymous 2011-05-22 11:14

Computer Science is a BULLSHIT degree. Learn a manly trade, like ENGINEERING.

Name: Anonymous 2011-05-22 14:28

>>1
It would be nice to have a full blown string processing DSL.

It's called perl. (Sorry for your loss.)

Name: Anonymous 2011-05-22 14:29

/prog/: the best and fastest board dispatching and language bashing board

Name: Anonymous 2011-05-22 14:30

>>10
You: the faggiest and gayer faggot and cock sucking lover.

Name: Anonymous 2011-05-22 17:32

>>1
Using the language for shit that is best solved with libraries is a failure in terse and minimalistic language design.

People who want keywords to solve all of their problems are retards, like yourself. I bet you want a "quake_engine" keyword added to C so that you can just generate a binary of the quake engine all with a simple keyword.

Perl is such a language with thousands of keywords, and Perl is absolute trite shit.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List