Then tell me how do you split a string by delimiter in CL? (Without using libraries, don't be a pajeet)
That's what I thought
CRIME Shirt $21.68 |
CRIME Shirt $21.68 |
Then tell me how do you split a string by delimiter in CL? (Without using libraries, don't be a pajeet)
That's what I thought
CRIME Shirt $21.68 |
CRIME Shirt $21.68 |
Don't abuse Satania-chan like that.
>cniles/seplets right now
C/C++ string handling is fairly easy. It’s the built-in functions that are AIDS.
How do you do it in python without importing anything?
You can use the string method "split".
Yep, method. Everything in python is an object, including a simple string containing the word "Black person".
I will never forget the day I stop hating OOP. Learn python was by far the best decision I made in my career.
'wiener-sucker'.split('-')
can python do this
echo "56,http://link,data with,with a comma" | perl -nE 'my$l=join "t", split /(?<!\),/;print+$l=~s/\,/,/gr'
56 http://link data with,with a comma
i kneel
we don't even have while loops how could we ever compete
we do though
???
(loop while condition do stuff)
I can't tell if this is a troll post or if you actually think CL can't manipulate strings? Or is it because unlike in Python it requires a bit of brainpower to use substr and position functions?
oh wow he can split a string without importing a library because that function just happened to be included! what a gay kek
now try doing literally anything nontrivial without importing libraries and suddenly the entire appeal of python crumbles.
So you think Python is better than Common Lisp?
Then tell me how do you get a fixed-width integer? (Without using libraries, don't be a pajeet)
That's what I thought
(ql:quickload :cl-ppcre)
And just use regex. If you want a solution that doesn't involve external libs, let's use csv as an example:
* (defparameter *csv-readtable* (copy-readtable))
(set-syntax-from-char #, #Space *csv-readtable*)
(defun read-csv-line (string) (let ((*readtable* *csv-readtable*))
(with-input-from-string (stream string) (loop for object = (read stream nil nil) while object collect object*~~)
>cl-ppcre
why not uiop:split-sting ?
You could do that too. I was also trying to remember if Alexandria has a string-splitting util but didn't feel like looking it up.
Here's the one I just did
(defmacro while (expr &rest block)
`(tagbody
loop
(if ,expr
(progn ,@block (go loop*~~))
(defun split (sep str)
(let* ((start 0)
(end 0)
(substrings (list nil))
(ptr substrings)
(len (length str*~~
(while (< end len)
(while (and (< end len)
(not (char= sep (aref str end*~~)
(setq end (1+ end*~~
(setf (cdr ptr) (list (subseq str start end*~~
(setq ptr (cdr ptr))
(setq start (1+ end))
(setq end (1+ end*~~
(setq substrings (cdr substrings))
substrings))
(princ (split #space "one two three"))
(terpri)
Can someone rate this? honestly
just realised that we can return directly (cdr substrings)
It is better.
- far more efficient
- can actually distribute binaries to customers
- has a standard
- has multiple up to date implementations
- is academically interesting
- has better books