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/>
jonatack has joined #commonlisp
pony has quit []
tankrim has quit [Ping timeout: 256 seconds]
Catie has joined #commonlisp
Catie` has quit [Ping timeout: 248 seconds]
szkl has joined #commonlisp
herjazz has quit [Quit: leaving]
jmdaemon has quit [Ping timeout: 250 seconds]
hamza has quit [Ping timeout: 248 seconds]
Krystof has quit [Ping timeout: 265 seconds]
czy has joined #commonlisp
Guest86 has joined #commonlisp
pony has joined #commonlisp
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
eddof13 has joined #commonlisp
jonatack has quit [Ping timeout: 265 seconds]
johnjaye has quit [Ping timeout: 256 seconds]
eddof13 has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
johnjaye has joined #commonlisp
jonatack has joined #commonlisp
eddof13 has joined #commonlisp
waleee has quit [Ping timeout: 250 seconds]
eddof13 has quit [Ping timeout: 240 seconds]
Kongo04 has joined #commonlisp
NicknameJohn has joined #commonlisp
Lycurgus has joined #commonlisp
Kongo04 has quit [Quit: Client closed]
szkl has quit [Quit: Connection closed for inactivity]
Lycurgus has quit [Quit: Exeunt: personae.ai-integration.biz]
chrcav has quit [Ping timeout: 265 seconds]
chrcav has joined #commonlisp
masinter has quit [Ping timeout: 240 seconds]
masinter has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
mason has joined #commonlisp
Sario has joined #commonlisp
tetsuo9 has quit [Quit: Leaving]
tetsuo9 has joined #commonlisp
pfd has quit [Ping timeout: 245 seconds]
bilegeek has joined #commonlisp
dcb has quit [Quit: MSN Messenger 3.8]
pranavats has joined #commonlisp
zest has joined #commonlisp
<zest> should I vendor my basic libraries like trivia or just succumb and use quickload?
<zest> the use case is having a self-contained library...
johnjaye has quit [Ping timeout: 240 seconds]
johnjaye has joined #commonlisp
ec has quit [Ping timeout: 240 seconds]
<edgar-rft> zest: if it's self-contained you dont necessarily need quicklisp, but you could go *both* ways to increase the potential user base
ec has joined #commonlisp
<beach> I think a decision like that depends on many things like the quality of the existing library, and the requirements of the client. To minimize maintenance, it is usually best to reuse existing code. But there are cases where the client can't (or won't) use an existing library in addition to yours.
<beach> And it depends on the size of the existing library. For a small one, you can include similar code in your own library. But if the existing library is large, you may take on a lot of maintenance burden if you duplicate that functionality.
<zest> beach: For something as replicatable as pattern matching, guess I'll roll with using cond for now and I'll sacrifice the eye candy.
masinter_ has joined #commonlisp
<zest> do you guys think there is a way to see what is a form of a function? I know 'describe describes data in general but is there smth that could make look at the actual definition of a function...
<beach> clhs function-lambda-expression
<ixelp> CLHS: Function FUNCTION-LAMBDA-EXPRESSION
<beach> I am going to be criticized for this, but here goes: If there were a way to do that for every function, then there would be no commercial Common Lisp vendors.
masinter has quit [Ping timeout: 265 seconds]
<beach> So FUNCTION-LAMBDA-EXPRESSION is allowed to fail. This is also good because you can't get the lambda expression of a closure, nor of a generic function.
<zest> beach: cool, thanks
<beach> Sure.
<zest> beach: so i am guessing it doesn't work on all implementations... ah, well, good enough I just wanna examine some library functions without going to a directory and reading the src file
<beach> That may or may not work.
<zest> beach: it depends on whether the function is compiled or not?
<beach> Also, you may get macroexpanded code which is going to be incomprehensible.
<beach> zest: Especially on the implementation. A valid implementation can return NIL always.
<beach> *A conforming implementation
simendsjo has quit [Ping timeout: 265 seconds]
<pjb> zest: in addition to function-lambda-expression, there's M-. in your favorite editor.
<pjb> M-. will usually jump to the source of the definition of the symbol at the point.
<beach> pjb: "without going to a directory and reading the src file" is what I picked up on.
<pjb> It came late…
<zest> pjb: i don't use emacs
<zest> pjb: but I used it before, that's one hell of a future
<zest> feature*
<beach> zest: Surely, whatever you do use must have something similar. No?
<zest> beach: acme
<zest> emacs is cool and i understand why people use it
<zest> acme is just an old habit dying hard
<beach> zest: In one of my good talks to industry, I estimate the time saved by using a new tool vs the time it takes to learn it. The results are usually staggering, like a factor of 100 or so in favor of learning the new one.
<beach> zest: Even just using Emacs abbrevs when I write email is a significant time saver, but some people here would dispute that, as usual.
<zest> beach: true, tools are our world as programmers
<beach> Unfortunately, as I explain in one of my essays, our brains are not good with such estimates, so we often make the wrong decisions. But as programmers, I think it is our duty is to set aside our immediate responses and do the math.
<zest> beach: i saw one video named "play emacs as an instrument" and the person who did had such so much internal knowledge of emacs it was ridicolous
<zest> among the things he did was he opened a file server in an SSH connection to his local host through eshell
<beach> And, as I explain in my talk, a project leader that can't convince the programmers to use the right tools, should get rid of those programmers.
<zest> beach: it adds up to overall productivity... i feel that today's tools are much less configurable than the older tools
<zest> like forget about code editors for a second, even stuff like windows managers can just boost productivity
<zest> a bigger optimization would be just having a OS that you hack away at...
Guest81 has joined #commonlisp
fiddlerwoaroof has joined #commonlisp
White_Flame has quit [Remote host closed the connection]
White_Flame has joined #commonlisp
edgar-rft has quit [Quit: Leaving]
<Guest86> jackdaniel Try to learn to give smart answers yourself before judging other's questions. This is a shame for CLIM maintainer though https://plaster.tymoon.eu/view/3816#3816 is good enough to judge ....
Guest81 has quit [Quit: Client closed]
Guest86 has quit [Quit: Client closed]
<beach> zest: Working on it! :)
<jackdaniel> yay, one more point towards the asshole of the year award, keep fingers crossed for me everybody
<beach> What could possibly have prompted Guest86 to put that initarg in there?
<splittist> Anyone gluing ML chains together with CL? (Not that one glues a chain…)
<jackdaniel> I don't know, but the question does not indicate that either
rgherdt has joined #commonlisp
msavoritias has joined #commonlisp
<hefner_> tbf I can't figure out where you'd add that keyword either, although the title pane seems obviously wrong
hefner_ is now known as hefner
<jackdaniel> initial-cursor-visibility is a keyword for open-window-stream
<jackdaniel> not that we implement the behavior, but open-window-stream should not error /with/ this keyword
fiddlerwoaroof has quit [Remote host closed the connection]
Guest80 has joined #commonlisp
<jackdaniel> (and it is about the text cursor, not the pointer cursor, so in this sense it is off by default)
rainthree has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
zest has quit [Remote host closed the connection]
Cymew has joined #commonlisp
amb007 has joined #commonlisp
<Guest80> beach you can change :initarg :medium to :initarg :doc-title with no change in code behavior.
<beach> So?
pve has joined #commonlisp
rgherdt has quit [Ping timeout: 265 seconds]
rgherdt has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Hibernating too long]
cmack has quit [Remote host closed the connection]
<beach> The term "visible" is used about a restart in RESTART-BIND and RESTART-CASE and it is related to the return value of the test function. But I can't see a definition of "visible" nor the relation between "visible" and "active" when it comes to restarts. Any hints?
pranavats has joined #commonlisp
<jackdaniel> isn't it that visible means "invokable" while active means "present in the dynamic context"? I don't have a quote
<beach> It could be, but it's not obvious to me.
<jackdaniel> in http://www.lispworks.com/documentation/HyperSpec/Body/m_rst_ca.htm (:test arg): "... that returns true if the restart is to be considered visible."
<ixelp> CLHS: Macro RESTART-CASE
<jackdaniel> and in the Description: "In this case, the dynamic state is unwound appropriately (so that the restarts established around the restartable-form are no longer active) prior to execution of the clause. "
<jackdaniel> it seems that given the context these words are used in is not ambiguous
<jackdaniel> perhaps an entry in the glossary would be a good thing
<beach> Yeah.
Guest80 has quit [Quit: Client closed]
<beach> Oh, that last phrase is in favor of restart clustering, no?
<jackdaniel> we've discussed that earlier, if it is simply appended to the list then it will be correctly unwound either way
<jackdaniel> by earlier I mean yesterday
<jackdaniel> (I think that the quote brought by scymtym is more in favor of restart clustering)
<beach> I'll give this some more thought. Thanks!
<jackdaniel> btw, compute-restarts uses the term "applicable restarts" (which has a glossary entry) instead of "visible", but the context seem indicate that both term describe the same thing
<jackdaniel> that is "active" and "test returns true"
<jackdaniel> sure
<beach> Yes, I am inclined to make "visible" and "active" mean the same thing.
fiddlerwoaroof_ has joined #commonlisp
Guest86 has joined #commonlisp
<jackdaniel> that would be incorrect given the context the word "visible" is used in
<jackdaniel> "visible" and "applicable" would be more appropriate
<beach> Hmm.
<jackdaniel> I'm a bit tight on time with something, so I'll get going. good luck!
<beach> You too!
Guest86 has quit [Client Quit]
fiddlerwoaroof_ has quit [Client Quit]
fiddlerwoaroof_ has joined #commonlisp
igemnace has joined #commonlisp
bilegeek has quit [Quit: Leaving]
bilegeek has joined #commonlisp
Krystof has joined #commonlisp
LW has joined #commonlisp
attila_lendvai_ has joined #commonlisp
mgl has joined #commonlisp
shka has joined #commonlisp
<beach> I think I have made up my mind. It seems "visible" is mentioned only in connection with the TEST-FUNCTION, so I'll define "visible" to mean "the TEST-FUNCTION returns true", and I will consider that a restart can be returned by FIND-RESTART or COMPUTE-RESTARTS only if it is visible.
attila_lendvai_ is now known as attila_lendvai
<jackdaniel> so "applicable restart" would mean "both active and visible"?
<beach> Almost. If by some secret way you could obtain a reference to an invisible restart, you could invoke it.
<jackdaniel> "applicable restart" is a term defined in the glossary
<jackdaniel> (referenced from compute-restarts n.b)
<beach> Right, but it is not clear what the "associated test" means.
<jackdaniel> do you have any plausible interpretation except for the "test associated with the restart"?
<beach> The test being referred to seems to involve the association between a restart and a condition, and that has nothing to do with the test-function.
<jackdaniel> the test function accepts one argument, that is the condition (see the initarg :test)
<jackdaniel> s/initarg/keyword option/
<beach> Right.
<beach> Yeah, OK, fair enough. So then "visible" and "applicable" is the same thing.
<jackdaniel> that was my initial impression, but you've hinted something above, that "visible" means only that the test function returns T
<beach> But it is not true that COMPUTE-RESTARTS returns all applicable restarts. A restart has to be active as well in order to be returned.
<jackdaniel> in other means, visible does not imply active
<jackdaniel> so applicable restart = (and active visible)
<beach> That's not how you interpreted the glossary entry though, is it?
<jackdaniel> the glossary entry says: "applicable restart n. 1. (for a condition) an active handler for which the associated test returns true when given the condition as an argument. 2. (for no particular condition) an active handler for which the associated test returns true when given nil as an argument. "
<beach> Ah, it has to be active! OK.
<beach> This is starting to make sense.
<jackdaniel> great
<beach> I should write this down in a comment somewhere in Predicament.
bilegeek has quit [Quit: Leaving]
Guest38 has joined #commonlisp
Guest38 has quit [Client Quit]
Guest38 has joined #commonlisp
Inline has joined #commonlisp
<beach> One quirk though. If we take the "associated test" in the glossary entry for "applicable restart" to mean the TEST-FUNCTION, then it implies that we can call the test function with NIL and it should then return true.
<beach> I think it is safest to assume that we can not call the test function with NIL, and if we have "no particular condition" we should not call the test function at all.
<beach> I'll write this down as well.
Inline has quit [Quit: Leaving]
Krystof has quit [Ping timeout: 248 seconds]
LW has quit [Ping timeout: 248 seconds]
<jackdaniel> that's not very conservative though, I'd rather fix the description of ":test" to explicitly allow nil
<jackdaniel> well, that's not good either
LW has joined #commonlisp
LW has quit [Quit: WeeChat 3.8]
Guest38 has quit [Ping timeout: 245 seconds]
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life has joined #commonlisp
karlosz has joined #commonlisp
Brucio-61 has quit [Ping timeout: 260 seconds]
varjag has joined #commonlisp
Brucio-61 has joined #commonlisp
Brucio-61 has quit [Ping timeout: 260 seconds]
Brucio-61 has joined #commonlisp
lottaquestions has quit [Quit: Konversation terminated!]
lottaquestions has joined #commonlisp
edgar-rft has joined #commonlisp
Lycurgus has joined #commonlisp
<beach> I fear that someone who reads the dictionary entry for RESTART-BIND or RESTART-CASE might create a TEST-FUNCTION that does not work if passed NIL as an argument.
tertek has quit [Quit: %quit%]
tertek has joined #commonlisp
Lycurgus has quit [Quit: Exeunt: personae.ai-integration.biz]
karlosz has quit [Ping timeout: 240 seconds]
hrberg has quit [Read error: Connection reset by peer]
hrberg has joined #commonlisp
scymtym has joined #commonlisp
nocko has quit [Quit: Connection closed for inactivity]
masinter_ is now known as masinter
Equill has quit [Ping timeout: 240 seconds]
scymtym_ has joined #commonlisp
scymtym has quit [Ping timeout: 248 seconds]
Brucio-61 has quit [Ping timeout: 260 seconds]
Brucio-61 has joined #commonlisp
green_ has quit [Ping timeout: 250 seconds]
tyson2 has joined #commonlisp
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
Guest86 has joined #commonlisp
Guest86 has quit [Client Quit]
chrcav has quit [Quit: leaving]
msavoritias has quit [Remote host closed the connection]
chee has quit [Quit: WeeChat 3.6]
chrcav has joined #commonlisp
mgl has quit [Quit: Client closed]
cage has joined #commonlisp
ec has quit [Ping timeout: 240 seconds]
ec has joined #commonlisp
dtman34 has quit [Ping timeout: 265 seconds]
waleee has joined #commonlisp
<beach> What standard special forms or macros have a list of "bindings" other than LET, LET*, HANDLER-BIND, and RESTART-BIND?
<beach> I mean syntactically, so that some part of the form can be identified as such a list of bindings.
<_death> would DO or PROGV count?
<beach> So things like PROGV and MULTIPLE-VALUE-BIND don't count.
<beach> DO may count. Let me check...
<beach> Yeah, I guess DO and DO* count.
<_death> if you're aiming for completeness you may need to go through the list of CL symbols
<beach> I probably need to do that at some point, yes.
<ogamita> beach: then LOOP WITH and FOR would count too.
<beach> Indeed, specific LOOP clauses would probably count.
<ogamita> Also, binding is something that is established at run-time, so I wouldn't make such a difference between progv and let…
<beach> For context, I am working on Iconoclast, which is a library defining ASTs for standard special forms and macros, and I am trying to identify reasonable mixin classes. That's why I am interested only in operators where the list of bindings is syntactically apparent.
<ogamita> ok.
<White_Flame> FLET and LABELS?
<ogamita> Indeed.
<beach> Definitely.
<beach> MACROLET too.
Brucio-61 has quit [Ping timeout: 260 seconds]
Brucio-61 has joined #commonlisp
<jdz> beach: PROG?
<Bike> the format of the bindings is different for a lot of these, though. like LET is symbol | (symbol [value]), which is not what handler-bind or flet have.
<beach> jdz: Yes, PROG and PROG*!
<beach> Excellent! Thank y'all! Now I can factor some more code.
<splittist> with-hash-table-iterator, for example, has a 'singleton' binding
<beach> Hmm. Maybe not that one.
ldb has joined #commonlisp
<splittist> with-accessors ?
<beach> Sure, why not!
<beach> The idea is to extract certain features to mixin classes to avoid code duplication. Like bindings, declarations, documentation, body, clauses, ...
Brucio-61 has quit [Ping timeout: 260 seconds]
scymtym_ has quit [Ping timeout: 248 seconds]
dtman34 has joined #commonlisp
karlosz has joined #commonlisp
Brucio-61 has joined #commonlisp
waleee has quit [Quit: WeeChat 3.8]
Guest86 has joined #commonlisp
Guest86 has quit [Client Quit]
tyson2 has quit [Remote host closed the connection]
Guest86 has joined #commonlisp
random-nick has joined #commonlisp
Cymew has quit [Ping timeout: 240 seconds]
Guest86 has quit [Quit: Client closed]
ronald has quit [Ping timeout: 250 seconds]
karlosz has quit [Quit: karlosz]
ronald has joined #commonlisp
attila_lendvai has quit [Ping timeout: 248 seconds]
ldb has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)]
rainthree has quit [Read error: Connection reset by peer]
rainthree has joined #commonlisp
amoroso has joined #commonlisp
msavoritias has joined #commonlisp
rainthree has quit [Read error: Connection reset by peer]
rainthree3 has joined #commonlisp
amoroso has quit [Quit: Client closed]
Guest86 has joined #commonlisp
Guest86 has quit [Quit: Client closed]
shka has quit [Read error: Connection reset by peer]
shka has joined #commonlisp
<Shinmera> phoe: I am once again asking for your Verbose patch
rainthree3 has quit [Ping timeout: 240 seconds]
<jackdaniel> there is an appropriate meme template for such requests ;)
<Shinmera> That is, indeed, the reference.
ns12 has quit [Quit: bye]
ns12 has joined #commonlisp
LW has joined #commonlisp
tyson2 has joined #commonlisp
LW has quit [Client Quit]
waleee has joined #commonlisp
msavoritias has quit [Read error: Connection reset by peer]
msavoritias_ has joined #commonlisp
alcor has joined #commonlisp
dcb has joined #commonlisp
johnjaye has quit [Ping timeout: 240 seconds]
johnjaye has joined #commonlisp
zxrom has joined #commonlisp
ec has quit [Ping timeout: 240 seconds]
ec has joined #commonlisp
evnnbd has joined #commonlisp
evnnbd has quit [Quit: evnnbd]
Krystof has joined #commonlisp
msavoritias_ has quit [Ping timeout: 240 seconds]
chrcav has quit [Ping timeout: 256 seconds]
chrcav has joined #commonlisp
mgl has joined #commonlisp
KabeloMsobomvuMo has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 268 seconds]
cage has quit [Quit: rcirc on GNU Emacs 28.2]
elevenkb has joined #commonlisp
elevenkb has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.91)]
KabeloMsobomvuMo is now known as elevenkb
elevenkb` has joined #commonlisp
HamzaShahid has joined #commonlisp
<HamzaShahid> Hello Everyone!
<HamzaShahid> I was solving another projecteuler problem and somehow managed to make it a binary addition problem
<HamzaShahid> All I want now is to have a list of lists containing each digit of a binary number going from 000 to 111
<HamzaShahid> so '((0 0 0) (0 0 1) (0 1 0) (0 1 1) (1 0 0) (1 0 1) (1 1 0) (1 1 1))
<HamzaShahid> but it should be generated dynamically be saying how many digits of binary to calculate from. Any idea on how to add and operate on raw binary in common lisp. Any help would be greatly appreciated
karlosz has joined #commonlisp
<HamzaShahid> Im gonna sleep in a few minutes so will probably read answers when I get up
<HamzaShahid> PS. I know there are libraries like cl-binary but I want to do it with raw common lisp for educational purposes
elevenkb` has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.91)]
knusbaum has quit [Ping timeout: 250 seconds]
elevenkb has quit [Remote host closed the connection]
knusbaum has joined #commonlisp
Gleefre has joined #commonlisp
NicknameJohn has quit [Read error: Connection reset by peer]
tibfulv_ is now known as tibfulv
morganw has joined #commonlisp
<pjb> HamzaShahid: (defun all-bit-combinations (n) (if (zerop n) '(()) (let ((rests (all-bit-combinations (- n 1)))) (mapcan (lambda (bit) (mapcar (lambda (rest) (cons bit rest)) rests)) '(0 1))))) (mapcar #'all-bit-combinations '(0 1 2 3)) #| --> ((nil) ((0) (1)) ((0 0) (0 1) (1 0) (1 1)) ((0 0 0) (0 0 1) (0 1 0) (0 1 1) (1 0 0) (1 0 1) (1 1 0) (1 1 1))) |#
knusbaum has quit [Ping timeout: 250 seconds]
<pjb> HamzaShahid: this is one way. But another is: (defun all-bit-combinations (n) (loop for word from 0 below (expt 2 n) collect (integer-to-list-of-bits word n))) with (defun integer-to-list-of-bits (n width) (loop for i below width collect (if (logbitp i n) 1 0))) (all-bit-combinations 3) #| --> ((0 0 0) (1 0 0) (0 1 0) (1 1 0) (0 0 1) (1 0 1) (0 1 1) (1 1 1)) |#
nij- has joined #commonlisp
<nij-> Is it possible to pass in more parameters into #'call-next-method?
<pjb> nij-: yes, but you're advised not to change the parameters on which the dispatching has been done.
<pjb> if your generic function has &key &rest or &optional, you may add parameters to call-next-method (pass the mandatory ones first).
<nij-> Cool! Thank you :)
waleee has joined #commonlisp
<pjb> HamzaShahid: also, why use list of bits? You could use bit-vectors instead. (defun integer-to-list-of-bits (n width) (loop with result = (make-array width :element-type 'bit :initial-element 0) for i below width when (logbitp i n) do (setf (aref result i) 1) finally (return result))) (all-bit-combinations 3) #| --> (#*000 #*100 #*010 #*110 #*001 #*101 #*011 #*111) |#
<pjb> HamzaShahid: perhaps you could even use 2D arrays of bits? (make-array '(8 3) :element-type 'bit :initial-contents (all-bit-combinations 3)) #| --> #2A(#*000 #*100 #*010 #*110 #*001 #*101 #*011 #*111) |# ?
<HamzaShahid> Ooooh cool thanks everyone, so turns out my solution is the worst but I will still present it :)
<HamzaShahid> (loop :for i :from 0 :to (1- (expt 2 (1- rows)))
<HamzaShahid> :collect (let* ((num (write-to-string i :base 2))
<HamzaShahid> (strnum (format nil "~3,,,v@a" #\0 num)))
<HamzaShahid> (loop :for digitchar :across strnum
<HamzaShahid> :collect (parse-integer (string digitchar)))))
<HamzaShahid> oops
<HamzaShahid> im sorrryyyyy
<HamzaShahid> fforgot to pastebin it
nij- has quit [Ping timeout: 246 seconds]
knusbaum has joined #commonlisp
<HamzaShahid> sorry, that was incorrect
<HamzaShahid> Correct: https://termbin.com/95sr
<HamzaShahid> I mean, is it that bad?
pfd has joined #commonlisp
<HamzaShahid> Used this at the end: (loop :for i :below (expt 2 (1- rows)) :collect (loop :for j :below 3 :collect (if (logbitp j i) 1 0)))
<HamzaShahid> vectors dont' have many functions like apply mapcar etc dont work on them
<HamzaShahid> so its kinda a lot easier with lists
Inline has joined #commonlisp
<pjb> HamzaShahid: if you want to go thru a string you can do (defun integer-to-list-of-bits (n width) (map 'list (lambda (ch) (if (char= #\1 ch) 1 0)) (format nil "~VB" width n))) (integer-to-list-of-bits 9 5) #| --> (0 1 0 0 1) |#
bjorkintosh has quit [Remote host closed the connection]
<pjb> HamzaShahid: you can s/'list/'bit-vector/ or /'vector/ if you prefer.
<pjb> HamzaShahid: or, using functions like you: (map 'bit-vector (compose parse-integer string) (format nil "~V,'0B" 5 9)) #| --> #*01001 |#
<pjb> Note, the pad-char is the second argument, not the fourth.
bjorkintosh has joined #commonlisp
waleee has quit [Ping timeout: 250 seconds]
<pjb> I've used the macro com.informatimago.common-lisp.cesarum.utility:compose, but you may use the function (alexandria:compose #'parse-integer #'string).
ski has quit [Ping timeout: 250 seconds]
ski has joined #commonlisp
tyson2 has joined #commonlisp
waleee has joined #commonlisp
nij- has joined #commonlisp
pfd has quit [Quit: Client closed]
NicknameJohn has joined #commonlisp
Inline has quit [Ping timeout: 268 seconds]
igemnace has quit [Remote host closed the connection]
tyson2 has quit [Remote host closed the connection]
pfd has joined #commonlisp
mgl has quit [Quit: Client closed]
pve has quit [Quit: leaving]
<nij-> In a function I'd like to check if a statement is true or not, but I don't want to do it always, as it will slow down the system.
<nij-> Can I make the statement to be checked IF AND ONLY IF safety is 3?
<pjb> nothing implementation independent let you do that. You have to make your own flag and test.
<pjb> nij-: in general, the question is whether you want this test to be made at compilation-time or at run-time.
morganw has quit [Remote host closed the connection]
makomo has joined #commonlisp
<pjb> nij-: at compilation-time you may use a feature and #+with-assertions (assert expression) Then you can write: (progn (declaim (optimization (safety 3))) (pushnew :with-assertions *features*)) before compiling.
<pjb> nij-: at run-time: (defvar *with-assertions* nil) (when *with-assertions* (assert expression)) Then at run-time you may (setf *with-assertions* t).
<nij-> There's no CL-compliant way to get the current level of SAFETY?
<pjb> yep.
<Bike> you can use one of the cltl2 libraries to get at it
<Bike> note that safety is a syntactic property, so it'll just be the safety at compile time, not at run time
<pjb> You could do: (eval-when (:compile-toplevel :load-toplevel :execute) (defvar *optimizations* '()) (setf *optimizations* '(optimization (safety 3))) (proclaim *optimizations*))) to save the current optimization. But you'd have to remember doing that everytime, everywhere.
shka has quit [Ping timeout: 240 seconds]
nij- has quit [Ping timeout: 265 seconds]
waleee has quit [Ping timeout: 240 seconds]
nij- has joined #commonlisp
<nij-> cltl2 is a lib? not a book?
Gleefre has quit [Remote host closed the connection]
Gleefre has joined #commonlisp
nij- has quit [Ping timeout: 248 seconds]
johnjaye has quit [Ping timeout: 246 seconds]
johnjaye has joined #commonlisp
<Bike> it's an earlier version of common lisp that had some operator for interrogating environments, which some implementations support as an extension
<Bike> https://github.com/Zulu-Inuoe/trivial-cltl2 https://github.com/alex-gutev/cl-environments declaration-information can be used to see what safety is
<ixelp> GitHub - Zulu-Inuoe/trivial-cltl2: Portable CLtL2
<Bike> (it's also a book, namely the book describing the earlier version of common lisp)
rgherdt has quit [Remote host closed the connection]
<johnjaye> i didn't know common lisp had antecedents. i mean it clearly did.
<johnjaye> i just don't know what they are. maclisp maybe
<Bike> common lisp is "common" because it was an attempt to unify about a million different lisps, including maclisp.
elevenkb has joined #commonlisp
johnjaye has quit [Ping timeout: 240 seconds]
johnjaye has joined #commonlisp