jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
waleee has quit [Ping timeout: 255 seconds]
<hayley> With regards to masinter saying "CDR-coding was for when RAM was expensive", cache misses are also expensive.
irc_user has joined #commonlisp
molson has joined #commonlisp
tyson2 has joined #commonlisp
Oladon has quit [Quit: Leaving.]
Demosthenex has quit [Ping timeout: 240 seconds]
triffid has quit [Ping timeout: 268 seconds]
triffid has joined #commonlisp
Demosthenex has joined #commonlisp
pmwals092 has joined #commonlisp
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
sjl has quit [Ping timeout: 268 seconds]
anticomputer has joined #commonlisp
anticomputer_ has quit [Ping timeout: 268 seconds]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
Common-Lisp has joined #commonlisp
karlosz has quit [Quit: karlosz]
mariari has quit [Ping timeout: 252 seconds]
irc_user has quit [Quit: Connection closed for inactivity]
mariari has joined #commonlisp
livoreno has quit [Ping timeout: 268 seconds]
pmwals092 has quit [Ping timeout: 268 seconds]
tyson2 has quit [Remote host closed the connection]
masinter has quit [Ping timeout: 268 seconds]
azimut has quit [Ping timeout: 268 seconds]
Dynom has joined #commonlisp
eddof13 has joined #commonlisp
asarch has quit [Quit: Leaving]
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
masinter has joined #commonlisp
rgherdt has joined #commonlisp
rgherdt_ has quit [Remote host closed the connection]
ttree has quit [Ping timeout: 268 seconds]
thomaslewis has joined #commonlisp
thomaslewis has left #commonlisp [#commonlisp]
SR-71 has quit [Remote host closed the connection]
pve has joined #commonlisp
ec has quit [Write error: Connection reset by peer]
ec has joined #commonlisp
_cymew_ has joined #commonlisp
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
sander has quit [Ping timeout: 268 seconds]
aartaka has quit [Ping timeout: 252 seconds]
aartaka has joined #commonlisp
sander has joined #commonlisp
aartaka has quit [Ping timeout: 244 seconds]
anticomputer has quit [Remote host closed the connection]
ec has quit [Read error: Connection reset by peer]
anticomputer has joined #commonlisp
ec has joined #commonlisp
masinter_ has joined #commonlisp
masinter has quit [Ping timeout: 252 seconds]
shka has joined #commonlisp
puchacz has joined #commonlisp
causal has joined #commonlisp
sander has quit [Quit: So long! :)]
sander has joined #commonlisp
cage has joined #commonlisp
opal[m] has quit [Quit: You have been kicked for being idle]
_cymew_ has quit [Quit: Konversation terminated!]
masinter_ has quit [Ping timeout: 268 seconds]
_paul0 has joined #commonlisp
paul0 has quit [Remote host closed the connection]
aartaka has joined #commonlisp
McParen has joined #commonlisp
<McParen> hello, i'm looking for a way to destructuring-bind a string, does somebody know if there is known library for that? essentially I want to bind (a b &rest c) to "foo bar baz qux", to get a "foo" b "bar" and c "baz qux".
<hayley> I think you want to split the string, then destructuring-bind the resulting list.
<McParen> I want to split a string, but keep the &rest in a single variable.
<_death> the analogy doesn't quite hold up, and there are various implicit choices so it's doubtful that there's a library that does just that
<McParen> I think it will be some combination of split-sequence and subseq, or cl-ppcre, but it is always better to check if there is a common solution to that.
random-nick has joined #commonlisp
<_death> sometimes position and subseq suffice :)
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
<McParen> I'd like to (re)use the lambda list parsing of destructuring-bind, including the &rest, &optional keywords and such.
aartaka has quit [Ping timeout: 268 seconds]
<McParen> what I essentially want is to pars user input (read as a single string), to be able to have a command, some parameters in between and then the free content at the end of the string.
<_death> well, when I read "destructuring-bind a string" I imagined something like (destructuring-bind (a b &rest c) (coerce string 'list) (setf c (coerce c 'string)) body) but you're looking for something more elaborate with regards to atoms or tokens
<McParen> I dont theink it is more elaborate, when i write it it looks kinda simple: (destructuring-bind-string (a b &rest c) "foo bar baz qux" (list a b c)) => ("foo" "bar" "baz qux")
<_death> it looks simple to you because you're making implicit choices
<pjb> McParen: the way to destructure a string is to use cl-ppcre:scan
<_death> that's one way.. it could be something that expands to (destructuring-bind (a b c) (coerce (nth-value 1 (ppcre:scan-to-strings "([^ ]*) ([^ ]*) (.*)" "foo bar baz qux")) 'list) (list a b c)) .. of course you need to define &optional semantics (and &key? what would that mean..)
<pjb> McParen: you can also read a string. (read-from-string (concatenate 'string "(" "foo bar baz qux" ")")) #| --> (foo bar baz qux) ; 18 |#
<pjb> McParen: but reading opens a whole another can of worms. Such as syntax error, or upcasing the symbol names.
<hayley> pjb: I'm sure packages and un-pwned computers will appreciate that one.
<McParen> pjb: reading the string is not what I tried to do, because that would parse the user input I want to keep unchanged (including spaces, etc).
<pjb> The scan the string yourself, or with cl-ppcre.
<McParen> i guess that is what i will have to do, but since i do not know ppcre well, i was trying to avoid dealing with regexps...
<_death> another thing is that d-bind can be deeper, so (destructuring-string-bind ((a b) c) "\"foo bar\" zot" (list a b c)) => ("foo" "bar" "zot") ?
MajorBiscuit has joined #commonlisp
aartaka has joined #commonlisp
triffid has quit [Ping timeout: 268 seconds]
MajorBiscuit has quit [Ping timeout: 268 seconds]
triffid has joined #commonlisp
<pjb> McParen: then you may parse yourself. eg. (destructuring-bind (a b c) (split-sequence:split-sequence #\space "foo bar baz") (list a b c)) #| --> ("foo" "bar" "baz") |#
nij- has joined #commonlisp
<McParen> pjb, I've come that far already, what i was looking for was: (destructuring-bind (a b &rest c) (split-sequence:split-sequence #\space "foo bar baz qux") (list a b c)) #| --> ("foo" "bar" "baz qux")
<McParen> I will get to that point too, but my hope was that somebody has done it already.
nij- has quit [Ping timeout: 244 seconds]
beach` has joined #commonlisp
beach has quit [Ping timeout: 268 seconds]
thuna` has joined #commonlisp