phoe changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.16, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
atgreen has quit [Ping timeout: 248 seconds]
dale has quit [Quit: dale]
pillton has joined #lisp
ebrasca has quit [Remote host closed the connection]
refpga has quit [Ping timeout: 268 seconds]
refpga has joined #lisp
pjb has quit [Ping timeout: 258 seconds]
hiroaki has quit [Ping timeout: 258 seconds]
kajo has joined #lisp
slyrus_ has joined #lisp
slyrus__ has quit [Ping timeout: 245 seconds]
makomo has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 258 seconds]
hiroaki has joined #lisp
keep_learning_M has joined #lisp
hiroaki has quit [Ping timeout: 245 seconds]
grewal has joined #lisp
quazimodo has quit [Ping timeout: 272 seconds]
Kaisyu7 has quit [Quit: ERC (IRC client for Emacs 26.2)]
dacoda has joined #lisp
dacoda has quit [Ping timeout: 252 seconds]
CEnnis91 has quit [Quit: Connection closed for inactivity]
semz has quit [Ping timeout: 264 seconds]
Lord_of_Life has quit [Ping timeout: 245 seconds]
dale has joined #lisp
Lord_of_Life has joined #lisp
Kaisyu7 has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
igemnace has joined #lisp
libertyprime has quit [Remote host closed the connection]
semz has joined #lisp
_whitelogger has joined #lisp
Oladon has joined #lisp
dacoda has joined #lisp
dialectic has joined #lisp
<dialectic> I'm trying to integrate fiveam into asdf's test-op method and, I'm getting a "package does not exist" error whenever I try to load this system definition now. Here is my system:
<dialectic> The offending form is, naturally, (uiop:symbol-call :fiveam :run! 'wizard-tests:test-all). wizard-tests is defined in package.lisp... so I'm not sure what the issue is.
<dialectic> Er, I mean, I can guess. That file isn't loaded when the test-op method is specialized. But, then, what am I actually supposed to be doing?
<fe[nl]ix> dialectic: it probably means the ASDF you're using is too old
<fe[nl]ix> newer versions bundle the UIOP system
<dialectic> No way. Let me check my sbcl verison...
<dialectic> Oh, no, it's "wizard-tests" which is the package not found, not uiop. Sorry if that wasn't clear.
<fe[nl]ix> aha
<fe[nl]ix> then you need to load that
<dialectic> fe[nl]ix: In the system definition file I just linked? That doesn't seem right.
akoana has left #lisp ["Leaving"]
Josh_2 has joined #lisp
<White_Flame> I need a refresher on compilation units and hot code patching. If a function is in a file, with no inline/not-inline declarations, are peer functions in that same file guaranteed to call the redefinition of that funtion?
<White_Flame> when (defun ...) is called at runtime after that file has been compiled & loaded
Necktwi has joined #lisp
dialectic has quit [Ping timeout: 244 seconds]
milanj has quit [Quit: This computer has gone to sleep]
<pillton> clhs 3.2.2.3
<pillton> "A call within a file to a named function that is defined in the same file refers to that function, unless that function has been declared notinline. The consequences are unspecified if functions are redefined individually at run time or multiply defined in the same file. "
<pillton> I suspect most implementations would call the redefinition.
<White_Flame> right, playing a bit with fire
<White_Flame> I'm monkey-patching a bug on a long-deployed server that I can't easily redeploy from scratch
<pillton> What are the consequences of you getting it wrong?
<White_Flame> the bug continues
<White_Flame> and the patch doesn't do anything
dialectic has joined #lisp
<White_Flame> however, I should be able to disassemble the current fucntions to see if they indirect through the symbol
<White_Flame> erm, through the symbol-function
<White_Flame> actually, I'll deploy that particular patched file in its entirety and load it, instead of just issuing a defun. That should hopefully cover the right bases
* White_Flame checks for comple-/load-time effects
oni-on-ion has quit [Ping timeout: 245 seconds]
<pillton> White_Flame: SLIME requires the functionality you desire. I think it is fine to expect the new definition of the function to be used.
nanoz has joined #lisp
<dialectic> Ah-ha! I was supposed to use "find-symbol". That... I get it, but it sort of sucks.
voldial has joined #lisp
<White_Flame> pillton: yep, thanks greatly
yharnam has quit [Remote host closed the connection]
jabr0ni has joined #lisp
torbo has quit [Remote host closed the connection]
libertyprime has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
<pillton> White_Flame: You're welcome.
smazga has joined #lisp
smazga has quit [Client Quit]
dacoda has quit [Remote host closed the connection]
aeth_ is now known as aeth
dale has quit [Quit: dale]
dacoda has joined #lisp
dacoda has quit [Remote host closed the connection]
dialectic has quit [Ping timeout: 268 seconds]
dacoda has joined #lisp
ltriant_ has joined #lisp
ltriant has quit [Ping timeout: 258 seconds]
Bike has quit [Quit: Lost terminal]
^ is now known as uplime
dddddd has quit [Remote host closed the connection]
karlosz_ has joined #lisp
Oddity has joined #lisp
<slyrus_> whom should I tell that gitlab.common-lisp.net is down?
Arcaelyx has quit [Ping timeout: 244 seconds]
<beach> Good morning everyone!
dialectic has joined #lisp
rippa has joined #lisp
nanoz has quit [Ping timeout: 248 seconds]
moldybits has quit [Quit: WeeChat 2.4]
moldybits has joined #lisp
ltriant_ is now known as ltriant
libertyprime has quit [Ping timeout: 272 seconds]
vlatkoB has joined #lisp
kushal has quit [Remote host closed the connection]
<ck_> Good morning, beach
libertyprime has joined #lisp
Inline has quit [Quit: Leaving]
<flip214> slyrus_: I hope it's fixed now.
<slyrus_> yes, thanks!
<flip214> slyrus_: or, rather, I hope it _stays_ fixed.
libertyprime has quit [Ping timeout: 258 seconds]
kushal has joined #lisp
v88m has quit [Read error: Connection reset by peer]
libertyprime has joined #lisp
v88m has joined #lisp
v88m has quit [Read error: Connection reset by peer]
libertyprime has quit [Ping timeout: 268 seconds]
libertyprime has joined #lisp
sauvin has joined #lisp
libertyprime has quit [Ping timeout: 248 seconds]
libertyprime has joined #lisp
cosimone has joined #lisp
v88m has joined #lisp
libertyprime has quit [Ping timeout: 258 seconds]
libertyprime has joined #lisp
v88m has quit [Read error: Connection reset by peer]
libertyprime has quit [Ping timeout: 245 seconds]
libertyprime has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
cosimone has joined #lisp
donotturnoff has joined #lisp
libertyprime has quit [Ping timeout: 245 seconds]
v88m has joined #lisp
libertyprime has joined #lisp
libertyprime has quit [Ping timeout: 245 seconds]
libertyprime has joined #lisp
libertyprime has quit [Ping timeout: 248 seconds]
cosimone has quit [Quit: WeeChat 2.4]
libertyprime has joined #lisp
asarch has joined #lisp
cosimone has joined #lisp
<asarch> Clear! Indentation problem fixed! https://github.com/asarch/apt-cache/blob/master/server.lisp
<minion> asarch, memo from pjb: well, you can map symbols to lexical variables, LEXICALLY! (let ((values) (data "Lisp")) (setf values '(data "really" "rocks")) (loop for item in values for element = (case item (data data) (otherwise item)) do (format t "Parsing: ~a~%" element))) #| Parsing: Lisp / Parsing: really / Parsing: rocks
<minion> asarch, memo from pjb: (let ((values '("Lisp" "makes" "this" "box" "really" "rocks"))) (format t "~?" "~*~@{~a~^ ~}~%" values)) #| makes this box really rocks |#
<minion> asarch, memo from pjb: studies have shown that programmers who use spaces for indent earn more than programmers using tabs. (at least 10% more IIRC).
<minion> asarch, memo from pjb: seriously!
<minion> asarch, memo from pjb: it takes 5mn to get emacs on this box: VERSION=26.1 ; wget ftp://ftp.gnu.org/gnu/emacs/emacs-${VERSION}.tar.gz ; tar zxf emacs-${VERSION}.tar.gz ; cd emacs-${VERSION} ; ./configure && make && make install
<asarch> You can use this file to enable syntax highlighting in GTK+-based applications:
<asarch> Just follow the instructions
libertyprime has quit [Ping timeout: 245 seconds]
cosimone has quit [Client Quit]
cosimone has joined #lisp
libertyprime has joined #lisp
donotturnoff has quit [Ping timeout: 268 seconds]
v0|d has joined #lisp
<LdBeth> hello
<beach> Hello LdBeth.
<no-defun-allowed> Hi LdBeth
karlosz_ has quit [Quit: karlosz_]
<LdBeth> btw, fsf servers were offline for moving last night
<beach> asarch: Why do you introduce variables in a LET and then immediately assign to them?
<beach> asarch: In (when (length ...)...) when do you expect (length ...) to be false?
<beach> asarch: What does it mean when your code has blank lines in it?
<asarch> What number line?
libertyprime has quit [Ping timeout: 246 seconds]
<no-defun-allowed> 37, 47, 51, 53, quite a few.
<beach> 40, 41, 42, 44
<beach> 40, 41, 42 has a LET and then assignments.
<no-defun-allowed> *37, 47, 51, 53, ... are the empty lines.
<beach> 44 has a WHEN with a condition that is always true.
Lycurgus has joined #lisp
ltriant has quit [Quit: leaving]
<flip214> asarch: are you used to the number 0 being false? I know that I did that mistake quite often, coming from C and Perl.
<asarch> Not always, apt-cache search onnanoko gives nothing
<flip214> asarch: you might want a (ZEROP (LENGTH ...)) in there, or a simple (NOT list) [but that doesn't work for vectors]
<beach> asarch: LENGTH always returns a non-negative number, which is always true.
<asarch> D'oh!
* asarch is fixing that part...
<asarch> Well, in mostly other programming languages (i.e Perl), you can declare and immediately assing values to use them
<beach> You can, but it's bad style.
<asarch> open(my $in, "<", "/etc/passwd") or die "Cannot open file";
<beach> Besides, LET does not declare variables. It binds them.
<asarch> I know, I know...
<no-defun-allowed> Lisp's scoping rules are a lot simpler because you cannot do anything like that.
<no-defun-allowed> So, you couldn't have a hypothetical VAR form (in CL) that let you pull variable bindings out of thin air, such as (progn (var x) (setf x 2) (+ x 2)).
<asarch> Blank lines are for nothing, just to help that one part of the code does one thing and the other does other
<no-defun-allowed> One thing this avoids is what to do if we get (progn (when (foo-p y) (var x 2)) x). Is X bound now?
<beach> asarch: So between :h1 and :h2, that's the case?
<asarch> Yeah
<beach> asarch: But not between :h2 and :p?
<beach> asarch: That sounds very mysterious to me.
<asarch> That part is for filtering the results using JavaScript
<beach> Instead of blank lines, it is much better to split your function into several smaller ones.
<beach> A function should fit on a (small) screen.
* loke just submitted Climaxima to Flatpak
<beach> What is Flatpak?
<dialectic> Sometimes I write big functions. It's not always a bad idea to do that, although in Lisp you are more likely to pay an indentation tax for that.
refpga has quit [Ping timeout: 248 seconds]
<loke> beach: It's a Linux software distribution scheme that dpesn't depend on external dependencies. It also runs applications in sandboxes for security reasons.
<beach> I see.
<loke> This means that when you install Climaxima from a flatpak, you won't have to worry about not having the right version of harfbuzz or whatever installed.
<beach> Got it.
<loke> It's becoming quite popular.
donotturnoff has joined #lisp
<dialectic> Ah, I remember when it was called xdg-app...
<LdBeth> I don't like the idea of distributing software in a container
<loke> LdBeth: working in security, I highly approve of the idea.
<LdBeth> But I guess for most people storage is cheap nowdays.
<LdBeth> loke: I have no reason install software from some place I don't trust though.
cosimone has quit [Quit: WeeChat 2.4]
cosimone has joined #lisp
<loke> LdBeth: It's not just about untrusted software. It's about unintended ways in which that software can be exploited.
<no-defun-allowed> #unixworldproblems
<loke> For example, most people would trust Libreoffice. But do you really trust that no one would be able to create a document that explots a bug and overwrites local files?
* LdBeth yes, Ocaml's opam can run rm -rf /
<loke> no-defun-allowed: True.
<ck_> oh man we could talk about that for a long time. "just install [container software], it's totally easy: wget -qO - | bash"
cosimone has quit [Client Quit]
<Lycurgus> you know about nix/nixos i take it
<asarch> So, what should I do instead of use a lot of (let ...)
<asarch> ?
<loke> Lycurgus: Yes. But nixos doesn't containerise anything. It doesn't actually stop an application from accessing other applications that are installed on the system. That makes it completely broken.
<Lycurgus> sorry thought this was another channel
<loke> Another issue with nixos is that it forces packagers to completely rework how applications work.
donotturnoff has quit [Remote host closed the connection]
<LdBeth> nix is the same thing I dislike: storage is cheap, so we can explode computer with massive among of different versions of the same library.
cosimone has joined #lisp
cosimone has quit [Client Quit]
Necktwi has quit [Quit: leaving]
<LdBeth> I'm ok with container if it is not heavy weight. But I'd like to have the choice to install only the minial distribution that just works.
<loke> That's kinda what flatpak does
<loke> Although a lispos would be nicer.
cosimone has joined #lisp
cosimone has quit [Client Quit]
cosimone has joined #lisp
cosimone has quit [Client Quit]
makomo has joined #lisp
Folkol has quit [Ping timeout: 248 seconds]
Folkol has joined #lisp
scymtym has joined #lisp
stacksmith has quit [Ping timeout: 246 seconds]
Ricchi has joined #lisp
dialectic has quit [Ping timeout: 272 seconds]
<asarch> (ZEROP SERVIDOR::RESULT) Derived type of RESULT is (VALUES LIST &OPTIONAL), conflicting with its asserted type NUMBER.
<asarch> (when (not (zerop result))
<ck_> you probably want (when result ...)
<asarch> D'oh!
yharnam has joined #lisp
beach has quit [Ping timeout: 258 seconds]
yharnam has quit [Remote host closed the connection]
schweers has quit [Remote host closed the connection]
<asarch> Besides, which other better way to "create" a small variable for one purpose and then let it die than with (let ...)?
<LdBeth> No
<jackdaniel> ((lambda (variable) (do-something variable)) 42) ;-)
<White_Flame> also &aux
<asarch> Wow! Powerful!
<LdBeth> PROGV does similar thing, but it is no longer be seen in modern code base
<asarch> Which one is faster, (let ...) or, in this case,((lambda ...) ...)?
<jackdaniel> let in CL is a special operator. that said they are semantically equivalent and most likely they will be equally fast
<asarch> Thank you!
schweers has joined #lisp
frgo has joined #lisp
frgo has quit [Write error: Broken pipe]
frgo has joined #lisp
<ck_> (let ...) is much faster to type than ((lambda (...)))
<jackdaniel> that depends on how fast you type #\e
<jackdaniel> (and #\t!)
<ck_> that's true, sometimes those keys go missing for hours at a time
shrdlu68 has joined #lisp
Folkol has quit [Ping timeout: 246 seconds]
Folkol has joined #lisp
hhdave has joined #lisp
<asarch> So, I am not too lost, right?
libre-man has quit [Ping timeout: 244 seconds]
<asarch> Can I do?: (con ((my-list) (do-operations-when-list-has-elements)) (t (do-operations-when-list-is-empty)))
libre-man has joined #lisp
<asarch> I mean: (cond ((my-list) (do-operations-when-list-has-elements)) (t (do-operations-when-list-is-empty)))
<shrdlu68> Yes.
Folkol has quit [Ping timeout: 245 seconds]
<LdBeth> No
Folkol has joined #lisp
<asarch> (let ((my-list '())) (cond (my-list (format t "The list has elements~%")) (t (format t "The list is empty~%"))))
<LdBeth> Oh, yes
<asarch> (let ((my-list '("Lisp" "is" "awesome"))) (cond (my-list (format t "The list has elements~%")) (t (format t "The list is empty~%"))))
<asarch> Well, thank you guys!
vutral has quit [Ping timeout: 245 seconds]
vutral has joined #lisp
<ck_> if you only have one condition, use if
<asarch> (let ((bed-time t)) (when bed-time (format t "さようなら")))
<shrdlu68> Probbly avoiding a progn.
<asarch> But you look "more profesional"
<ck_> asarch: I don't think you really have to worry about that at this time
<asarch> JK
<asarch> Have a nice day!
<White_Flame> if I have tangled comparisons, I actually use AND and OR to chain together what I want to happen when
<LdBeth> GG
asarch has quit [Remote host closed the connection]
cosimone has joined #lisp
Lycurgus has quit [Quit: Exeunt]
cosimone has quit [Quit: WeeChat 2.4]
wigust- has joined #lisp
wigust has quit [Ping timeout: 248 seconds]
cosimone has joined #lisp
cosimone has quit [Client Quit]
cosimone has joined #lisp
keep_learning_M has quit [Ping timeout: 245 seconds]
keep_learning_M has joined #lisp
orivej has joined #lisp
keep_learning_M has quit [Quit: This computer has gone to sleep]
q3d has joined #lisp
maxxcan has joined #lisp
zotan has quit [Ping timeout: 264 seconds]
zotan has joined #lisp
v88m has quit [Read error: Connection reset by peer]
v88m has joined #lisp
jmercouris has joined #lisp
zotan has quit [Ping timeout: 272 seconds]
zotan has joined #lisp
random-nick has joined #lisp
Necktwi has joined #lisp
pjb has joined #lisp
Necktwi has quit [Quit: leaving]
Necktwi has joined #lisp
jmercouris has quit [Ping timeout: 245 seconds]
jmercouris has joined #lisp
atgreen has joined #lisp
maxxcan has quit [Quit: maxxcan]
szmer has joined #lisp
<jackdaniel> what does "GG" stand for in this context?
Ricchi has quit [Remote host closed the connection]
m00natic has joined #lisp
<pjb> Good Girl!
<pjb> ?
<Josh_2> Good game
<jackdaniel> and what would be the game?
<pjb> Any game!
<Josh_2> game of lisp
<pjb> You can be the game, yourself!
<ck_> I think he refers to rhetoric
<pjb> Remember, in English, game means prey.
<ck_> pjb: yes, until the prime minister announces that "the game's up"
<pjb> :-)
<pjb> The best game is when the prey is unsuspicious he's prey.
<pjb> cf. "Le Diner de Cons".
<jmercouris> "good game"
<jackdaniel> I can read what you write but GG is still nonsensical to me in this context
<jackdaniel> given it means "good game"
ebrasca has joined #lisp
<Josh_2> At the end of a vidya game people sometimes say "GG" if someone achieves something people sometimes "GG", if people screw up hilariously people sometimes say "GG" It's a very useful phrase
<jackdaniel> that's like a word "rhino", it *does* make sense in *some* contexts
<ck_> I'm personally not familiar with the all-caps version. I suggest very deep true meaning behind it.
<ck_> suspect, even
<jackdaniel> but when you answer rhino to something what has not much to do with zoology or africa (i.e - "aref returns element of the array" - "rhino!") it may be puzzling, like GG here
<jackdaniel> that's why I ask
<no-defun-allowed> I would guess it's an emoticon of some kind.
<no-defun-allowed> LdBeth: any thoughts?
cosimone has quit [Quit: WeeChat 2.4]
Necktwi has quit [Ping timeout: 246 seconds]
<LdBeth> Good Game.
<jackdaniel> and what sense does it make in the context?
<jackdaniel> (plese don't get me wrong, I'm just curious)
<jackdaniel> please*
<LdBeth> jackdaniel: Josh_2 is right
gravicappa has joined #lisp
Josh_2 has quit [Ping timeout: 248 seconds]
Necktwi has joined #lisp
milanj has joined #lisp
<jackdaniel> about meaning of GG? I know, I've looked it up beforehand in urban dictionary. still I'm clueless with answer on my question. I guess I'll just give up and live with a mystery casting shadow on my life ,)
<jackdaniel> s/on/to/
v88m has quit [Ping timeout: 245 seconds]
jmercouris has quit [Ping timeout: 272 seconds]
ssake has joined #lisp
jmercouris has joined #lisp
<jdz> GG is like "Game Over," was fun while it lasted.
lnostdal has quit [Remote host closed the connection]
wilfredh has joined #lisp
<ck_> I believe jd's question is more about an annotation of an instance of the idiom being used here.
<shka__> you guys are having the most interesting of discussions
<ck_> shka__: I take it like a person compaining about creases on their shirt. If that's the worst of their problems, they're doing quite well.
<ck_> complaining*
<jmercouris> capital GG is used often in East Asia
beach has joined #lisp
Bike has joined #lisp
CloseToZero has joined #lisp
pfdietz has joined #lisp
atgreen has quit [Ping timeout: 264 seconds]
manualcrank has joined #lisp
LiamH has joined #lisp
jmercouris has quit [Ping timeout: 245 seconds]
<TMA> jackdaniel: "good game" is the opposite of "oops". and as is the case of the latter, it can be used in opposite senses of "hey loser" AND "hey, you won" ; it is one of the phrases that do not make sense unless you assume it does, but then it's up to you to infer the sense from the context
dale_ has joined #lisp
jmercouris has joined #lisp
dale_ is now known as dale
cosimone has joined #lisp
kushal has quit [Remote host closed the connection]
kushal has joined #lisp
CEnnis91 has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
cosimone has joined #lisp
cosimone has quit [Client Quit]
cosimone has joined #lisp
dale has quit [Quit: dale]
<carmack> Hi! How i can find in cons?
<ck_> if you mean lists, have you tried find?
<carmack> Its look like a:
<carmack> (:+CNY+ (:+ID+ . "R01375") (:*NUM-CODE . "156") (:*CHAR-CODE . "CNY")
<carmack> (:*NOMINAL . 10) (:*NAME . "Китайских юаней") (:*VALUE . 91.8683)
<carmack> (:*PREVIOUS . 92.1211))
<carmack> type-of => CONS
<carmack> and i have many these values
<carmack> well... find always null
<carmack> nil
<pfdietz> What are the values you are passing to FIND?
<carmack> (find :+AUD+ (cdr (assoc :*Valute valute-hash)))
<carmack> => NIL
<pfdietz> What are the values you are passing to FIND? (not the forms you evaluate, the actual values)
atgreen has joined #lisp
<carmack> just name of head
<pfdietz> Look, if you are not going to tell us precisely what you are passing to FIND, how can we possibly answer your question?
cosimone has quit [Quit: WeeChat 2.4]
<dlowe> carmack: what's the other value
FreeBirdLjj has joined #lisp
<carmack> sorry guys i don't understand your questions
<dlowe> FIND takes two values, right?
Inline has joined #lisp
<dlowe> (ignoring keywords)
<pfdietz> You are not giving us enough information to answer your question. If FIND is not doing what you want it to, we need to know the values it is being passed. Not the forms that evaluate to those values, but the precise values you are passing it in a specific case where it is not doing what you think it should.
<carmack> dlowe: yes
<pfdietz> The first argument is apparently a keyword.
<pfdietz> But what is the second argument?
<carmack> sure
<carmack> second argument its cons type list
<dlowe> have you evaluated it to see what it actually is?
<pfdietz> Which is...?
Lord_of_Life_ has joined #lisp
<pfdietz> It's a list of conses?
FreeBirdLjj has quit [Ping timeout: 258 seconds]
<carmack> ^ this is second argument in find
<Bike> that's the second argument to find?
<dlowe> have you pasted (cdr (assoc :*Valute valute-hash)) into your repl???
v88m has joined #lisp
<Bike> right, so, :+aud+ is not in that list
<Bike> it's in the inner lists
<Bike> but find doesn't look into them
<carmack> I want on the key get one of lists
<carmack> well
<pfdietz> Be more precise.
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<pfdietz> You want the element of the list that somehow has :+aud+ inside it?
<carmack> yes
<carmack> i need loop?
<pfdietz> Ok. I think this would do that: (find :+aud+ <yourlist> :key #'car)
<pfdietz> Or, assoc.
<carmack> assoc doesn't work
<pfdietz> (assoc :+aud+ <yourlist>)
dddddd has joined #lisp
<Bike> You need to be more specific than "doesn't work".
<pfdietz> That would return (:+aud+ (...)), which is the element that has :+aud+ inside it.
<Bike> (assoc :+aud+ '((:+aud+ 3 4 5) (:+dip+ 28 29))) => (:+AUD+ 3 4 5)
<carmack> Ok, thank you guys
<pfdietz> I think as a general rule these problems often solve themselves once you define precisely what you are trying to do.
<carmack> Is there a way to find the right list by keys if I use keyboard input?
<carmack> i mean function (read)
<pfdietz> What does keyboard input have to do with anything?
<carmack> and i want type for example USD not :+usd+
<pfdietz> Reading gives you lisp data. It is then just like any other lisp data.
<pfdietz> Ok, keyword are self-evaluating. The value of :FOO is :FOO.
<carmack> but i can't type (assoc :+(read)+ (cdr (assoc :*Valute valute-hash))) like this :)
kdas_ has joined #lisp
<pfdietz> Non-keyword symbols are different (except for NIL and T). They are variables, and are evaluated by the mechanisms for variables.
<pfdietz> So, if you want to search for USD, you need to quote it, so it doesn't get evaluated as a variable.
<pfdietz> (assoc 'usd '(...))
<carmack> ok, thx
kushal has quit [Ping timeout: 260 seconds]
<carmack> you like this (assoc 'usd '(cdr (assoc :*Valute valute-hash)))
<carmack> you mean*
<pfdietz> The important distinction here is between lists that are forms (that are to be evaluated) and lists (or symboils) that are data (that are the result of evaluation).
<pfdietz> No, because you want to evaluate that (cdr ...) form.
<pfdietz> So no quote on it.
Arcaelyx has joined #lisp
<carmack> ofc i want eval (cdr ...)
<carmack> what about :+usd+?
<_death> you can pass a :test function, e.g. (lambda (x y) (equal (remove #\+ (string x)) (remove #\+ (string y)))) assuming all keys are symbols
<pfdietz> It is very rare that you actually want to use eval.
<carmack> And I don't really understand why cl-json creates lists with elements that are surrounded by plus characters
<pfdietz> :+usd+ is a keyword, and evaluates to itself. You can quote it, but that doesn't matter.
<pfdietz> That is odd. cl-json has various ways of converting strings to symbols, but I don't recall + being added.
<pfdietz> Let me look at that (I've been using cl-json lately).
<carmack> (cl-json:decode-json-from-string json-string)
<carmack> i use this one for decode
<pfdietz> I see. When the name of a json attribute is all upper case, it puts + around it.
<carmack> well.. cl-json have flag which not do it?
<carmack> sorry for bad english :S
<pfdietz> I think it probably does.
q3d has left #lisp [#lisp]
<pfdietz> It has to do with the conversion between strings with camel case and keywords.
<pfdietz> "FOO" ==> :+foo+, "Foo" ==> :*foo, "aFoo" ==> :a-foo
<carmack> But I still did not understand how you can find the desired list using keyboard input, is there any example?
<pfdietz> And "foo" ==> :foo
<carmack> pfdietz: thanks for explaining that
<pfdietz> Those are all different json attribute names, so they need to map to different keywords.
<pfdietz> We are not understanding your question.
<carmack> Which one?
<carmack> you know fn (read)?
<carmack> I'm type USD and find my list
<carmack> (cdr (assoc :*value (cdr (assoc :+usd+ (cdr (assoc :*Valute valute-hash)))))) i have this one and where :+usd+ i want use (read) function
<pfdietz> When you type something at the lisp command line, it is treated as a form, and is evaluated.
<pfdietz> So, your question is something like "what form should I evaluated to get this value?"
<carmack> I don't know i can concat :+(read)+ like that?
<pfdietz> Let's suppose you were asking "how can I use the keyboard to add 1 and 2?"
<carmack> I do not know what the right question to ask, it all looks very unusual for me.
<pfdietz> The answer is: "Type (+ 1 2) to the lisp command line and watch it evaluate to 3."
<ck_> look, if cl-json converts strings to keyword symbols in some way, just call that conversion function on your input. What's the problem?
<pfdietz> Calling the READ function seems weird and not related to your problem there.
<carmack> :+USD+ is the SYMBOL type right? I have pattern :++
<pfdietz> Pattern?
<carmack> In short, I will try to deal with it myself. Thanks for help!
<carmack> I don't know how to explain it to you so you know what I want.
<pfdietz> You want a conversion from strings to these symbols, as cl-json would do it?
seok has quit [Ping timeout: 260 seconds]
<pfdietz> Ok. If you have specific intro lisp questions, or confusion that we can try to clear up, I also suggest the #clschool channel.
<dlowe> carmack: what's your native language?
<_death> you are asking how to find the symbol :+USD+ given that you have the symbol USD.. you can either create one from the other and look for that, or you can come up with your own comparison function, which I gave an example of
mr_yogurt has quit [Ping timeout: 268 seconds]
dale has joined #lisp
kdas_ is now known as kushal
<pfdietz> Reverse engineering where questions like these come from makes me respect teachers more. The goal is not to answer the question, but to identify and address underlying misconceptions.
<carmack> Ok i think can ask right question. How i can string "USD" convert to KEYWORD :+usd+?
<Bike> (intern (concatenate 'string "+" string-goes-here "+") "KEYWORD")
<Bike> i would try to avoid being in this sutation, though
<carmack> thx
<carmack> ANSI Common LISP is the good book?
<jackdaniel> carmack: yes, however it doesn't focus on clos as community would like it to
<jackdaniel> excercises are excellent though and I've found the explanations very insightful
<carmack> Author Paul Graham
<jackdaniel> yes
<carmack> What do you mean clos?
<shka__> carmack: good as?
<carmack> shka__: as clisp book for newbies
<jackdaniel> carmack: clos is a common lisp object system
<shka__> i think that it is ok book, but i consider practical common lisp to be a better book in this regard
<jackdaniel> Paul Graham was known for criticism of OOP programming
<shka__> i also have a soft spot for land of lisp
<carmack> I tired of OOP want something new
<jackdaniel> then you'll enjoy reading ANSI Common Lisp
<carmack> I have little bit experience with elisp and want learn clisp
<carmack> ok, thank you guys
<jackdaniel> clisp is one of many common lisp implementations
<carmack> jackdaniel: i know
<jackdaniel> so you want to learn clisp, not common lisp? I'm confused
<jackdaniel> like I would be confused if someone had claimed that they want to learn gcc (not C language)
<carmack> i mean common lisp
<jackdaniel> TMA: thank you
<carmack> clisp
<jackdaniel> carmack: clisp is used to name one particular implementation. CL is an acronym of common lisp
<carmack> Apparently, my cuts don't work. :)
<jackdaniel> clisp is usually read as C Lisp (as in Lisp implemented in C)
<carmack> ye
<carmack> sbcl, clisp
saravia has joined #lisp
sjl has joined #lisp
Posterdati has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #lisp
smazga has joined #lisp
jmercouris has quit [Remote host closed the connection]
jmercouris has joined #lisp
Posterdati has joined #lisp
<pjb> carmack: one question is why you use :+USD+ instead of :USD or just USD ?
<pjb> carmack: in general, you don't need to use keywords when the symbols are not used in an external API, and where there aren't too many such symbols to export (and they could collide with other package export lists).
<pjb> carmack: and also, the + are useless here, in symbols or keywords. If it is a personnal convention, you need to consider and argue for it, given that this makes it more difficult for the user to input those symbols.
orivej has quit [Ping timeout: 245 seconds]
<pjb> (with-input-from-string (input "usd") (find (read input) '((eur 3.92) (usd 5.23) (cny 1.22)) :key (function first))) #| --> (usd 5.23) |#
shrdlu68 has quit [Ping timeout: 245 seconds]
orivej has joined #lisp
<carmack> pjb: because (cl-json:decode-json-from-string json-string) create KEYWORD like a :+USD+
<pjb> Why do you use JSON? Sexps are better.
<carmack> pjb: i grab json from url
amerlyq has joined #lisp
<carmack> I want to write a small program that will learn for me the weather, currency etc
<pjb> (cl-json:decode-json-from-string "[{\"foobar\":3.2},{\"EUR\":4.1}]") #| --> (((:foobar . 3.2)) ((:+eur+ . 4.1))) |# what an horror. Don't use cl-json!!!
<carmack> So I'll learn a little bit about programming in Common Lisp
<carmack> pjb: what i need use?
<carmack> sexps?
<carmack> Never heard before...
<_death> com.gigamonkeys.json works for me
<carmack> :S
z3t0 has quit [Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net]
<carmack> You'll confuse me soon :)
<pjb> or, do the opposite, convert the bad data issued by cl-json into good data: (maptree (lambda (item) (if (and (keywordp item) (< 2 (length (string item))) (char= #\+ (aref (string item) 0)) (char= #\+ (aref (string item) (1- (length (string item)))))) (intern (subseq (string item) 1 (1- (length (string item)))) "KEYWORD") item)) (cl-json:decode-json-from-string "[{\"foobar\":3.2},{\"EUR\":4.1}]")) #| --> (((:foobar . 3.2)) ((:eur
<pjb> . 4.1))) |#
<pjb> and then to compare without taking the package into account, use string=: (with-input-from-string (input "usd") (find (read input) '((:eur 3.92) (:usd 5.23) (:cny 1.22)) :test (function string=) :key (function first))) #| --> (:usd 5.23) |#
FreeBirdLjj has quit [Remote host closed the connection]
<carmack> pjb: i don't have data like this {"foo": 2.03} i have [{"foo": {"bar":{..}, "foo": {...}}]
FreeBirdLjj has joined #lisp
schweers has quit [Ping timeout: 252 seconds]
orivej has quit [Ping timeout: 246 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
orivej has joined #lisp
FreeBirdLjj has joined #lisp
<pjb> carmack: which is why I shown you how to use com.informatimago.common-lisp.cesarum.list:maptree
CloseToZero has quit [Ping timeout: 246 seconds]
<carmack> ok
<carmack> thank you
frgo_ has joined #lisp
frgo has quit [Ping timeout: 258 seconds]
Lycurgus has joined #lisp
jmercouris has quit [Ping timeout: 246 seconds]
frgo_ has quit [Ping timeout: 272 seconds]
orivej has quit [Ping timeout: 258 seconds]
edgar-rft has quit [Quit: Leaving]
<pfdietz> He could just change json:*json-identifier-name-to-lisp* to some other function, for example (lambda (s) (intern s :keyword))
<pfdietz> This would make "FOO" ==> :foo, as he probably wants.
<pfdietz> Hmm. that was not quite right.
<pfdietz> Set it to #'identity
<pfdietz> That will cause "USD" to become :usd, but strings with lower case letters will look weirder. "Foo" ==> :|Foo|
<pfdietz> (let ((json:*json-identifier-name-to-lisp* #'identity)) (json:decode-json-from-string "{ \"USD\" : 1 }")) ==> ((:USD . 1))
<pfdietz> :usd and :USD being identical, due to how the lisp reader works.
kajo has quit [Ping timeout: 250 seconds]
saravia has quit [Quit: Leaving]
jmercouris has joined #lisp
Arcaelyx has quit [Read error: Connection reset by peer]
Arcaelyx has joined #lisp
Arcaelyx has quit [Read error: Connection reset by peer]
gravicappa has quit [Ping timeout: 245 seconds]
Arcaelyx has joined #lisp
Arcaelyx has quit [Read error: Connection reset by peer]
orivej has joined #lisp
Arcaelyx_ has joined #lisp
Arcaelyx_ has quit [Read error: Connection reset by peer]
Lycurgus has quit [Quit: Exeunt]
Arcaelyx has joined #lisp
Arcaelyx has quit [Read error: Connection reset by peer]
Arcaelyx has joined #lisp
Arcaelyx has quit [Read error: Connection reset by peer]
jmercouris has quit [Remote host closed the connection]
femi has quit [Ping timeout: 246 seconds]
<pjb> pfdietz: indeed, it's always better to read the documentation.
orivej has quit [Ping timeout: 245 seconds]
v88m has quit [Ping timeout: 258 seconds]
femi has joined #lisp
stacksmith has joined #lisp
wccoder has joined #lisp
wccoder has quit [Client Quit]
hhdave has quit [Quit: hhdave]
<stacksmith> loke: most people trust Facebook. Go figure.
<ober> they would not if they knew what was on the backside of the Facebook sign
ebrasca has quit [Remote host closed the connection]
<jgkamat> most people don't know what sun is
<alandipert> is a CL conformant if it admits values other than nil as logically false?
Arcaelyx has joined #lisp
<alandipert> such as a platform-specific false value
kajo has joined #lisp
ebrasca has joined #lisp
<pjb> stacksmith: don't they know who did facebook and why?
<pjb> alandipert: what does it mean to accept a value as logically false?
<pjb> true n. any object that is not false and that is used to represent the success of a predicate test. See t[1].
<pjb> false n. the symbol nil, used to represent the failure of a predicate test.
<alandipert> pjb the special form that branches recognizes the value as not true, but it's also not nil
<pjb> alandipert: fundamentally, booleans are defined by the IF operator. (COND expands to IF, and the other tests eventually too).
<pjb> alandipert: so the question is whether definining an object X such as (IF x 1 2) returns 2 is a valid extension of CL. It is not, because it would make existing program (that use this value X) behave differently.
<pjb> alandipert: on the other hand, you could define leave CL:IF unchanged, and provide an EXT:IF that would behave like that. This would be a valid extension.
<alandipert> pjb how could an existing program use the value X if it's only possible to construct in this new hypothetical impl?
nanoz has joined #lisp
<pjb> So basically, you have to be very careful with "extending" existing operators. In some case it's eassy (eg. adding a key argument when &allow-other-keys is possible). But most often, you can extend the language only by adding new operators, not by modifying existing ones.
<alandipert> (or does the fact that it's impossible to construct on any other impl. make it nonconformant?)
<pjb> alandipert: yes, that would be a solution.
hiroaki has joined #lisp
<pjb> in general, but I don't think it would work in the case of CL:IF.
<pjb> (let ((false (make-new-false))) (if false 'hi (assert (eq false 'cl:nil)))) would give different results with or without the extension.
<pjb> ie. there's an expection that something that is not true is CL:NIL.
<pjb> expectation
<alandipert> i thought it might be feasible since clhs re: if doesn't mention 'false' at all
<pjb> How many programs would the result of (make-new-false) break? I'd guess quite a few…
<pjb> it mention true which is defined in terms of false, see above.
<pjb> You can also have a look at the sources of pseudo-scheme, which has to deal with this problem.
<pjb> scheme:if is not cl:if.
<alandipert> i was hoping to avoid that bifurcation, it's unfortunate
<alandipert> i'll just have to decide what's more important to me
<alandipert> thanks for the discussion though
<pjb> alandipert: on the other hand, you can just experiment. There's no reason that this result of (make-new-false) leaks everywhere. So most you could expect most of the quicklisp library to still mostly work.
<pjb> Where would you use it?
<alandipert> it would be one of the possible return values of foreign functions, or an argument to a foreign function
<alandipert> so another approach there would be an intermediate, configurable coercion layer
<pjb> For this, we usually write a wrapper.
<pjb> So we may convert those special values, and also deal with the conversion of error code into signaling conditions.
<alandipert> i'm not sure atm which is more onerous, not being compliant in this particular way or necessarily writing wrappers
m00natic has quit [Remote host closed the connection]
<pjb> alternatively, you can provide a function such as: my-api:is-true and let the user write explicitely (cl:if (my-api:is-true some-boolean-coming-from-my-api-or-not) … …)
FreeBirdLjj has quit [Remote host closed the connection]
<pjb> Notably, I've seen some C libraries that don't use 0/1 or false/true as boolean results…
<pjb> So such a function would be needed anyways in those cases.
<stacksmith> pjb: the name facebook should be sufficient, as it is an old CIA term...
<pjb> stacksmith: without going to those extremities, you start with a geek wanting to extract revenge from the popular guys and girls… Cannot end well.
<pjb> And I'm saying that as a geek, but I'm not a sociopath trying to use computers to extract revenge on people…
akoana has joined #lisp
<stacksmith> pjb: If you follow the money, a three-letter organization was funding it from the start. My working theory is that originally the goal was to get people to voluntarily tag every face in the world for the coming facial recognition AIs, and the friend network information does not hurt either.
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #lisp
<stacksmith> And you don't want to hear my working theory about NASA. Suffice it to say that as the ability to observe and track spacecraft becomes available to the masses, NASA's ability to launch spacecraft goes from moonshots (hundreds of thousands km) to hundreds of km with the space shuttle, to making fun weekly videos. Not to mention 'restoring' photos and videos at Pixar, and destroying old documents.
<Bike> please talk about lisp
<stacksmith> apologies.
mathrick has quit [Ping timeout: 245 seconds]
milanj has quit [Quit: This computer has gone to sleep]
abhixec has joined #lisp
wigust- has quit [Quit: ZNC 1.7.3 - https://znc.in]
wigust has joined #lisp
nowhereman has joined #lisp
CloseToZero has joined #lisp
wigust has quit [Ping timeout: 246 seconds]
edgar-rft has joined #lisp
CloseToZero has quit [Client Quit]
nowhereman has quit [Ping timeout: 245 seconds]
cosimone has joined #lisp
wigust has joined #lisp
abhixec has quit [Ping timeout: 248 seconds]
abhixec has joined #lisp
<carmack> Hi again! Can i do like this (defun f() (let ((a (+ 1 1)) (b (* 2 a))) (print b)))?
igemnace has quit [Ping timeout: 246 seconds]
<carmack> I mean in (let ...) clojure can i use variables?
<ck_> use let* for that
<carmack> wow, thank you!
<carmack> ck_: lihai
lnostdal has joined #lisp
Lycurgus has joined #lisp
ym555 has joined #lisp
sauvin has quit [Read error: Connection reset by peer]
random-nick has quit [Ping timeout: 245 seconds]
cosimone has quit [Quit: WeeChat 2.4]
cosimone has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
Lycurgus has quit [Quit: Exeunt]
random-nick has joined #lisp
amerlyq has quit [Quit: amerlyq]
z0d has quit [Ping timeout: 244 seconds]
z0d has joined #lisp
dialectic has joined #lisp
<dialectic> 5AM seems to barf on #S. A little annoying for writing tests!
<dialectic> Has anyone else run into this or am I making some kind of rudimentary mistake again?
<dialectic> Oh, figured it out. The issue is that the checks in fiveam capture their calling form (hence why I get "don't know how to dump #S(...)"). Since the struct is created at read-time, no form can be captured. So the answer is... use let
wigust has quit [Ping timeout: 272 seconds]
sebboh has joined #lisp
v88m has joined #lisp
<sebboh> hi all. What is this? https://www.cs.colostate.edu/meps/HyperSpec/Body/speope_the.html I mean.. I *read* it, but I don't know what THE is. If the type doesn't match, the results are undefined? What are safety/optimization levels? I mean, I could lean on my knowledge of the C language world: I have a novice-level understanding of the -o flag in gcc. But why 'undefined'? Is the outcome implementation
<sebboh> specific when using THE when the type doesn't match when safety is set to 3? Do the words in my last sentence make sense together at all, or have I made a few assumptions too many?
<Bike> take a breath
<dialectic> he's discovered the complicated parts of CL
<Xach> sebboh: it is a way to promise the compiler something, and if the promise proves false, the compiler is not to be blamed for future problems
<Bike> optimization levels are things you can change for a lexical scope using declare optimize
<Xach> the compiler is allowed to trust you and change what it does based on that trust
<Xach> it is a sacret trust!
<Bike> at safety 3 the compiler is under more obligations than usual
<Xach> sacret bleu? sacred
<Bike> none of those obligations are to check the type in a THE, though
nanoz has quit [Ping timeout: 245 seconds]
<aeth> In practice, the only compiler that ignores THE/DECLARE/etc. is SBCL with (safety 0) afaik. Maybe CMUCL (since SBCL is a fork of that) or a commercial CL.
<aeth> What's far more common is ignoring it entirely.
<Bike> sbcl also does not type check certain complicated types, such as values types with a &rest
<dialectic> sebboh: There are many implementations of Common Lisp and they all do varying degrees of optimization. On SBCL for instance, type declarations, if they cannot be proven by the compiler, and SAFETY > SPEED or SPEED < 3, will result in runtime type-checks. At Speed 3 and Safety 2 or less, you are telling the compiler that it's free to just trust you.
<Bike> even at safety 3
<dialectic> As usual, consult the manual for your lisp
<dialectic> I got the predicate wrong for when SBCL elides the runtime type checks but that should at least give you a rough idea.
<karlosz> a conforming implementation is allowed to ignore any declaration which isnt (decalre (special...))
<aeth> SBCL also might simplify a hard to check type to a simpler to check type at lower optimization levels, such as (or (integer -3 -1) (integer 1 3)) to (integer -3 3) ignoring the hole at 0.
<aeth> At least according to the manual.
<sebboh> Is there a cannonical search engine term for the special operator named THE? cf. "golang"
<Bike> karlosz: it also has to do certain things at safety 3
<aeth> SBCL does appear to have 0 as invalid here by default. (defun foo (x) (declare (type (or (integer -3 -1) (integer 1 3)) x)) x)
<Bike> i'd just google "clhs the" i guess
<White_Flame> also, the disassembler is your friend, to see what actually changes with declarations
<dialectic> sebboh: Are you familiar with the hyperspec? The relevant section is Types and Declarations
<pjb> clhs the
<dialectic> er... types and classes.
<pjb> or /msg specbot clhs the for private querying.
<aeth> I do "!l1sp the" in duckduckgo but ddg has 5-6 other alternatives for CL
<aeth> I find the actual hyperspec search is too powerful, since it searches the body text when you probably just want to search for the names of the functions/macros/etc.
<White_Flame> there's also the symbol index
<aeth> The CLHS search would be "!clhs the" in ddg and it takes you to http://www.lispworks.com/cgi-bin/search.cgi?q=the&cmd=Search%21&t=-D--HB- and the first result is the correct result
<aeth> (but after that it's just stuff with the word "the")
<sebboh> ...I didn't notice that the link I provided to a clhs (the THE entry) wasn't the clhs on lispworks.
<aeth> sebboh: that appears to be an older version with a gray background, but not the oldest version, which had purple images
<aeth> White_Flame: one advantage of l1sp even there is that it has a few common libraries in addition to the standard, and sometimes I find that what I was looking for is actually in alexandria
<aeth> there are some documentation sites that have even more libraries
<sebboh> I think the copy on my old laptop has purple images. It's a thinkpad. This conversation is better.
v88m has quit [Read error: Connection reset by peer]
v88m has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
vlatkoB has quit [Remote host closed the connection]
wigust has joined #lisp
cosimone has joined #lisp
<sebboh> Thank you all for the guidance. At what point does sbcl throw an error because a thing's type was wrong?
<sebboh> s/throw and error/interrupt the flow of execution/
<dialectic> Many functions will signal a condition of SIMPLE-TYPE-ERROR or more generally TYPE-ERROR if they are passed the wrong arguments. If you add declarations to a function and your implementation chooses to add runtime checks, you will also trigger those exceptions.
<dialectic> Additionally you can add your own typechecks anywhere with (ASSERT (TYPEP ... ...)) or (ASSERT (SUBTYPEP ... ...)) within your program.
<sebboh> ah, I've seen those, sure. Ok. Well, for your amusement, here is what made me ask these questions. It was this old ABCL blog post: http://abcl-dev.blogspot.com/2009/08/type-checking-or-safety-belt-on-with.html
<sebboh> Yes, I've used my own ASSERTs.
orivej has joined #lisp
<dialectic> sebboh: btw, for sbcl, here is the relevant documentation, which you might find illuminating
<dialectic> Very reaganesque. Trust but verify.
scymtym has quit [Ping timeout: 252 seconds]
warweasle has quit [Quit: You cheeky dick waffle.]
<pfdietz> There is one CL symbol I missed when I wrote ansi-test, because it didn't have its own page. The symbol index entry for it points to 7.6.6.2
<Bike> standard?
<pfdietz> Yes
<Bike> method combinations: who cares
pfdietz has quit [Remote host closed the connection]
pfdietz has joined #lisp
<pfdietz> They are sometimes useful, but not very often.
<Bike> i'm not sure why i would ever use the symbol, though
<pfdietz> SBCL sometimes screws up the type checks on some very complicated types. I wish they'd fix that, but the type normalizer in sbcl is impenetrable.
quazimodo has joined #lisp
amerlyq has joined #lisp
<aeth> dialectic: assert typep? That's rarely needed, normally check-type can be used. I only have to resort to assrt when I need the type to be quoted, i.e. when it's not known in advance
<aeth> sebboh: ^
xkapastel has joined #lisp
scymtym has joined #lisp
<pfdietz> Assert and check-type share one annoyance: the existence of rather heavyweight restart machinery. If you just want your program to signal the damned error, it makes sense to roll your own lightweight assert. SBCL internally calls that aver.
<dialectic> What do you mean?
<dialectic> pfdietz
Bike has quit [Remote host closed the connection]
Bike has joined #lisp
<pfdietz> Being able to invoke restarts for correctable errors makes the compiled code larger. When one doesn't care for that (and personally I almost never do) then simply signalling an error without the restart stuff gives smaller code.
<dialectic> Ah, I've never considered the code size implications for restarts, especially spread across a whole a program.
<pfdietz> If you have to expand to that stuff for every assert, it adds up.
quazimodo has quit [Ping timeout: 244 seconds]
<dialectic> Are you one of the CLEAVIR hackers or something?
<pfdietz> It has less of an impact if the compiler is smart enough to move all that code off away from "hot" code, but I'm not sure lisp compilers are that smart.
<pfdietz> No
<pfdietz> I break things.
<dialectic> lol
<Bike> yeah i pretty much never want to recover from check-type or assert either
<Bike> and they result in, what, some dynamic variable bindings, a loop, some closures
pfdietz has quit [Remote host closed the connection]
<sebboh> I enjoyed recovering in various situations, for example, by providing an alternative value to use in place of something. Past tense because if I'm just going to go back and change the code and try again from the top *anyway*...
pfdietz has joined #lisp
atgreen has quit [Ping timeout: 244 seconds]
<sebboh> Though I reserve the right to demand that the whole restart concept remain available forever. You know, in case I need to write an application that operates a floppy drive or an internal combustion engine.
<pfdietz> Oh, restarts are nice. I got the sbcl people to add some internally for some standard errors. Not required by the standard, but not prohibited either.
<Bike> yeah, restarts themselves are fine
<Bike> it's just, when i assert something, i mean it, you know?
<pfdietz> Now, granted, that restart machinery doesn't need to be fired up unless the assert fails. So maybe I'm whining too much. In the common case of an empty place list there are no site-specific actions that need to be coded for.
<pfdietz> check-type will always have code for setting the place.
d4ryus has quit [Ping timeout: 248 seconds]
nckx has quit [Ping timeout: 248 seconds]
nckx has joined #lisp
d4ryus has joined #lisp
<stacksmith> aeth: regarding our previous convo re rebinding and cffi structures... I made a pull request fixing CFFI's with-foreign-slots macro - to allow choosing binding names different from slot-names, and therefore giving it the ability to rebind in the local package.
<stacksmith> aeth: I also wrote a monstrous 'withc' macro that works with any cffi type and automatically rebinds, creates bindings for all slots or selectively from a parameter, can use existing instances or create new heap or stack ones, creates value accessors for simple types like :int, binds multiple foreign objects with optional per-instance prefix for local symbols, and a few other useful things...
<stacksmith> aeth: it sure beats generating gobs of accessors and stuff.
<makomo> stacksmith: where can i see this withc macro? :)
<aeth> pfdietz: Yes, SBCL's nonzero-safety DECLARE/THE semantics are much better since they, among other things, don't let you recover with a new value like with CHECK-TYPE. Too bad it's not standard behavior.
<aeth> stacksmith: Did you do it the most intuitive way, which is making it foobar or (foo foobar) with the latter like with-accessors? although it looks like cffi:with-foreign-slots accepts either name or (:pointer name) so you'd probably have to modify that a bit more.
random-nick has quit [Ping timeout: 248 seconds]
random-nick has joined #lisp
<aeth> I wrote a with-accessors* that basically goes the other way and lets you do with-accessors* (foo bar baz (barfoo foobar))
VTToonses has joined #lisp
<dialectic> SBCL keeps barfing on the #S reader dispatch character and I don't know what's going on.
<dialectic> Getting "don't know how to dump #S(MY-STRUCT) (default MAKE-LOAD-FORM method called)"
<aeth> define a make-load-form method
<aeth> Most of the time it's as simple as (defmethod make-load-form ((object class) &optional environment) (make-load-form-saving-slots object :environment environment))
<dialectic> Before I do that, I think I'm misunderstanding. Am I not supposed to use #S(MY-STRUCT :SLOT VALUE) as a shorthand in my own code for the constructor function MAKE-MY-STRUCT?
<aeth> no, they're different
<dialectic> Got it.
<aeth> afaik, it's sort of like "foo" vs. (make-array 3 :element-type 'character :initial-contents '(#\f #\o #\o))
<dialectic> I should make a reader macro on { that expands into the constructor...
<aeth> so #S is shorthand for the constructor function called with #. so at read time
<aeth> So it makes sense that you'd have to define a make-load-form because you need that for objects created in macros, too, which happen after read time
keep_learning has quit [Ping timeout: 246 seconds]
Ricchi has joined #lisp
quazimodo has joined #lisp
<aeth> I guess you'd want something closer to (defmacro foo (&rest args) `(make-foo ,@args)) while this is closer to (defmacro foo (&rest args) (apply #'make-foo args)) and I'm not sure if that can be done in the reader because I've never done that
<aeth> it's probably possible
Lycurgus has joined #lisp
LiamH has quit [Quit: Leaving.]
atgreen has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
Bike has quit [Quit: Bike]
uplime is now known as ^
daniel1302 has quit [Quit: leaving]
Xach has quit [Ping timeout: 268 seconds]
sjl_ has joined #lisp
sjl has quit [Ping timeout: 272 seconds]
v88m has quit [Ping timeout: 258 seconds]
VTToonses has quit [Ping timeout: 260 seconds]
dialectic has quit [Ping timeout: 248 seconds]
random-nick has quit [Read error: Connection reset by peer]
quazimodo has quit [Ping timeout: 248 seconds]
hiroaki has quit [Ping timeout: 248 seconds]
dialectic has joined #lisp
Bike has joined #lisp
rsawrecht has quit [Ping timeout: 246 seconds]
<dialectic> Is there a way to treat a constructor function as one that takes positional args instead of keyword args?
<_death> (defstruct (foo (:constructor make-foo (a b))) a b) (make-foo 1 2)
<dialectic> hm...
<_death> it's called a "boa constructor"
<dialectic> That's the best pun in all of computer science.
<_death> clhs defstruct
<dialectic> I read that a long time ago and thought "I will never need that." Now I need it.
<dialectic> Cannot tell you how many things in the language I have said that about.
<_death> ;)
<_death> sleepytime
<dialectic> "It is permissible to use the :constructor option more than once, so that you can define several different constructor functions, each taking different parameters. "
<dialectic> Feeling very much like that wayne's world "we're not worthy" scene
<Bike> incidentally, you'll need that if you want positional args but also to use #s
<dialectic> Oh, well, I'm never messing with *that* thing again.
Xach has joined #lisp
Arcaelyx has quit [Quit: Arcaelyx]
smazga has quit [Quit: leaving]
Arcaelyx has joined #lisp
VTToonses has joined #lisp
metallicus has joined #lisp
metallicus has quit [Quit: WeeChat 2.5]
DGASAU has quit [Remote host closed the connection]
DGASAU has joined #lisp