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
zotan has quit [Ping timeout: 258 seconds]
zotan has joined #lisp
shangul has joined #lisp
nowhereman has quit [Ping timeout: 246 seconds]
nowhereman has joined #lisp
mr_yogurt has joined #lisp
<mr_yogurt> is my emacs not indenting correctly or is the else part of an if supposed to be indented less than the then part
<no-defun-allowed> common-lisp-mode
<no-defun-allowed> in elisp, IF is defined like (defmacro if (test then &body else) ...) when in CL it is (defmacro if (test then else) ...)
lumm has quit [Ping timeout: 258 seconds]
<mr_yogurt> oh, slime-mode is a minor mode
Arcaelyx has joined #lisp
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
makomo has quit [Ping timeout: 245 seconds]
<aeth> that would explain the difference.
lumm has joined #lisp
q-u-a-n has quit [Ping timeout: 246 seconds]
cyberoctopi has joined #lisp
zotan has quit [Ping timeout: 255 seconds]
zotan has joined #lisp
lumm has quit [Quit: lumm]
<anamorphic> In ACL there's a feature of the inspector that shows the objects that reference the object you're inspecting. Is there anything like that for SBCL or CCL?
<no-defun-allowed> It wouldn't be trivial to implement.
<p_l> no-defun-allowed: ehhh... semi-trivial
<p_l> you need to dump GC's trace data somewhere
<aeth> yeah, I was just thinking about that
<p_l> since that's exactly what GC has to track
<no-defun-allowed> Typically, you just mark a trace with a bit in mark-sweep, or you just copy it.
<no-defun-allowed> And the data wouldn't be around till you GC too, and in the case of copying it would be invalidated quickly.
<p_l> no-defun-allowed: at that point you can write down somewhere (from . to)
<White_Flame> anamorphic: how quickly does that operation run?
<White_Flame> it might just be doing a heap scan
<p_l> no-defun-allowed: and you could store post-copy
<no-defun-allowed> I hope you don't intend to free that too.
<White_Flame> make a bajillion-length list of boxed items and see if that slows it down
<no-defun-allowed> Then I think there would be another mark step needed too, but this is above my pay grade.
<p_l> no-defun-allowed: special region that isn't GCed with normal algorithm (for example ZL:DEFRESOURCE or essentially a large unboxed array)
<aeth> It would be cool if it was more than just working with the heap. It would be fun to see what objects have "42" in them.
<anamorphic> White_Flame, seems to be near instant
<White_Flame> TIME it
<White_Flame> oh, if it's in the inspector, you might not be able to
<White_Flame> still, then stuff the heap and see if it slows down
<anamorphic> Yeah it's a gui thing
<White_Flame> (although if it's under 100msec it might still be unnoticeable)
<p_l> 700msec might be unnoticeable in practice
<anamorphic> I can't put much on the heap to really try it out. It's the "express" edition of ACL and has memory limits
<p_l> 700msec is enough to theoretically scan ~24 GB on my machine
<aeth> You can notice 100 ms. That's 6 frames on a 60 Hz monitor.
<aeth> You have to pay close attention, but I'm sure you can notice that sort of thing. And 700 definitely
<p_l> aeth: that's why I mentioned "in practice"
<White_Flame> ah. Well, my guess is that it's a heap scan. SBCL has a heap scanner, but maybe not something to detect references like that
<aeth> It's weird when you make yourself pay attention to lag, e.g. move your mouse one pixel and see the delay.
<p_l> is it "under threshold of notice as long task"
<p_l> 700msec often works as "I noticed it took time but it was pretty much instant"
mindCrime_ has quit [Ping timeout: 258 seconds]
<p_l> of course this varies, these days I might move from happy go lucky to "stop blocking the isle you ......" in 700msec ;)
<anamorphic> Oh cool, CCL does seem to have something similar: map-heap-objects, find-references ...
<anamorphic> find-referencers, rather
lavaflow_ has joined #lisp
lavaflow_ has quit [Ping timeout: 268 seconds]
lavaflow_ has joined #lisp
nowhereman has quit [Ping timeout: 255 seconds]
mindCrime_ has joined #lisp
_whitelogger has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 244 seconds]
cyberoctopi has quit [Ping timeout: 245 seconds]
cyberoctopi has joined #lisp
libertyprime has quit [Ping timeout: 258 seconds]
Bike has quit [Quit: Lost terminal]
libertyprime has joined #lisp
_whitelogger has joined #lisp
jeosol_ has quit [Quit: Page closed]
vlatkoB has joined #lisp
<beach> Good morning everyone!
torbo has joined #lisp
defunkydrummer has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
sjl_ has quit [Ping timeout: 258 seconds]
slyrus_ has joined #lisp
anamorphic has quit [Ping timeout: 258 seconds]
Achylles has quit [Ping timeout: 258 seconds]
_whitelogger has joined #lisp
gabbiel has joined #lisp
<gabbiel> Hey guys, I have this: (defun perfect-square-p (n) (= (expt (sqrt n) 2) n))
<gabbiel>
orivej has quit [Ping timeout: 268 seconds]
<gabbiel> how do I make it so that (perfect-square 8.99999) doesn't return true
dddddd has quit [Remote host closed the connection]
<no-defun-allowed> Use isqrt instead of sqrt, so you don't have floats.
<no-defun-allowed> Also, numbers with decimal parts will never be perfect squares, so you could test for that too, but 8.99999 is getting uncomfortably close to 9 for single floats.
<gabbiel> but 9.0 is a perfect square
<beach> gabbiel: I think you need to follow the advice of no-defun-allowed and only work with integers.
<gabbiel> tried, isqrt, but 9.0 asserts an error
meepdeew has joined #lisp
<no-defun-allowed> clhs isqrt
<no-defun-allowed> Sorry I didn't mention what isqrt did, it only handles positive integers and gives you the (lower) closest integer to the square root of that number.
libre-man has quit [Ping timeout: 255 seconds]
<no-defun-allowed> Your initial definition for perfect-square-p is also incorrect as you forgot to do something with the square root (eg floor it) to make its square not the number you started with, gabbiel.
ricekrispie has joined #lisp
<aeth> gabbiel: Convert floats to integers with truncate (or any of the other similar functions). Use multiple-value-bind like this: (multiple-value-bind (n remainder) (truncate n) ...)
<beach> gabbiel: Try something like (defun perfect-square-p (n) (let ((root (isqrt n))) (= n (* root root))))
<aeth> gabbiel: if the remainder isn't 0 (or use some epsilon e.g. 0.01 or something) then it cannot pass anyway
<aeth> but e.g. 43f0 or 43d0 will have 0.0f0 or 0.0d0 respectively as their remainders, so they are potential candidates, as 43
<aeth> If you use truncate, you actually have to check for closeness to both 0 and 1 if you're not doing an exact zerop on the remainder. round will be closeness to 0 on either side (positive and negative), and the others will all have their own quirks.
ricekrispie2 has quit [Ping timeout: 258 seconds]
<no-defun-allowed> Just...avoid floats since they'll never be perfect squares, mkay?
<aeth> no-defun-allowed: except for e.g. 144d0
<no-defun-allowed> s/floats/floats with decimal parts in this case, and floats in general/
<aeth> no-defun-allowed: yes, you get the decimal parts from the second value of truncate.
<aeth> The real question there, though is if you only want to count 1d0 or if you do want to count 0.99999999d0 as 1
<aeth> Naturally, doing the latter is going to complicate things, and probably have two cases, for when you're very close above and very close below.
<aeth> I guess round probably is the simplest because there the second value is the diff between the old value and the new value.
<aeth> If you only want to do zerop on the remainder, then truncate is the simplest, though.
libre-man has joined #lisp
<aeth> I think it would look something like this, if you're going the zerop route: (defun perfect-square-p (n) (let ((n (ctypecase n (integer n) (float (multiple-value-bind (n* remainder) (truncate n) (if (zerop remainder) n* nil))) (number nil)))) (if n (= (expt (isqrt n) 2) n) nil)))
<aeth> If you're doing the more complicated route and you want to count 0.99999999d0 as 1, then you have to replace TRUNCATE with ROUND and do a more complicated check than ZEROP on the remainder. Something like (< (abs remainder) epsilon)
<aeth> This introduces a lot of branching so there's probably a variation with less branches.
<aeth> gabbiel: I hope that helps!
torbo has quit [Remote host closed the connection]
<gabbiel> sorry just came back, let me read all that
<gabbiel> truncate seems nice, then I can test for zero on the second value
<gabbiel> and know if its an integer
caltelt has quit [Ping timeout: 245 seconds]
<gabbiel> does this chat have a lisp interpreter?
<gabbiel> hmm, I'm not sure whether to cover cases like 0.999999
<aeth> gabbiel: if you were going to cover 0.999999 you'd need to break up the floats into each different kind of float because they'd all have a different optimal epsilon there. You could even use some multiple of short-float-epsilon, single-float-epsilon, double-float-epsilon, and long-float-epsilon as your epsilons.
<aeth> You'd probably want to do the order single-float double-float long-float short-float and unfortunately SBCL will warn you about deleting unreachable code for the latter two cases because in SBCL short-float is single-float and long-float is double-float
ludston has quit [Quit: Leaving]
ludston has joined #lisp
<aeth> Well, actually, I guess you can just have a second typecase that returns the epsilon.
<gabbiel> seems complicated. but it would be useful for computed values which are meant to be 1, but come 0.99999
<gabbiel> for now, I think I'll do the truncate implementation, and maybe later I'll do the round version
<gabbiel> ill screencap that post for help
<gabbiel> thanks aeth & no-defun-allowed
pankajgodbole has joined #lisp
mihaiolteanu has joined #lisp
<gabbiel> is 0 a perfect square?
<no-defun-allowed> 0 * 0 = 0 i suppose
<gabbiel> this is weird, I ended up with this https://pastebin.com/wK7xN2TS:, but 63.9999999999 still passes the predicate
<gabbiel> https://pastebin.com/wK7xN2TS , no colon sorry
<gabbiel> mvb is synonym for multiple-value-bind
<gabbiel> I guess the implementation rounds it
<no-defun-allowed> gabbiel: https://floating-point-gui.de
<no-defun-allowed> You can't expect that much precision from floating point numbers.
<no-defun-allowed> Just try evaluating that number and see if it comes back as 63.999...
<no-defun-allowed> Hint: it doesn't on CLISP, CCL, SBCL or ECL.
<beach> gabbiel: I really, really think you should stick to integers, and not trying floating point numbers, because you seem to lack some understanding in how they work.
pierpal has quit [Ping timeout: 252 seconds]
<no-defun-allowed> I agree with beach here, it'd be much less work to just use integers, remembering there are no non-integer perfect squares.
<gabbiel> I got the cases like 9.0 where it should work, I don't think I require the cases like 0.9999999
<gabbiel> yeah I haven't dealt much with floats, and never read the standard on floats/doubles
<gabbiel> all i know is there's contagion
<no-defun-allowed> You might want to skip through a video like https://www.youtube.com/watch?v=jsLiDQyyBXk where the loss of precision in floating point numbers has an effect in a game.
<no-defun-allowed> The calculation here that goes wrong could be something like (+ (float (expt 2 21)) 0.1). If you evaluate that, you'll notice the 0.1 seemingly isn't added.
<White_Flame> single precision tracks 7.22 decimal digits; double precision tracks 15.95 decimal digits
<no-defun-allowed> If you keep incrementing that 0.1 slowly, you'll notice that past 0.15 it jolts up to 2097152.3. This is why you see the video jump between positions, and is also (although, with numbers scaled down) why you can't get 0.9999999 to not "equal" 1.0.
<gabbiel> yeah I always knew floating point was crazy and not precise
<gabbiel> somebody here talked about a cl library where decimal arithmetic was precise but I forgot the name
meepdeew has quit [Remote host closed the connection]
ym555 has quit [Quit: leaving...]
<gabbiel> goodnight guys
gabbiel has quit [Quit: ERC (IRC client for Emacs 26.1)]
meepdeew has joined #lisp
ludston has quit [Quit: Leaving]
atgreen__ has quit [Remote host closed the connection]
atgreen__ has joined #lisp
FreeBirdLjj has joined #lisp
sunset_NOVA has joined #lisp
Arcaelyx has quit [Ping timeout: 268 seconds]
Oladon has quit [Quit: Leaving.]
FreeBirdLjj has quit [Ping timeout: 258 seconds]
shangul has quit [Remote host closed the connection]
wigust- has joined #lisp
wigust has quit [Ping timeout: 258 seconds]
FreeBirdLjj has joined #lisp
meepdeew has quit [Remote host closed the connection]
pierpal has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
cyberoctopi has quit [Ping timeout: 255 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
nowhereman has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
ravenousmoose has joined #lisp
Nomenclatura has joined #lisp
pierpal has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 244 seconds]
<aeth> well, nothing is perfectly precise unless you have symbols for things like "pi"... but even then you'd probably quickly wind up with stuff like 23434/3495935*pi as your numbers
nowhereman has quit [Ping timeout: 252 seconds]
eschatologist has quit [Quit: ZNC 1.7.2+deb2 - https://znc.in]
eschatologist has joined #lisp
<pjb> aeth: there's an infinite number of trancendantal numbers. So you would need to express your numbers as vectors of rationals of infinite size.
mihaiolteanu has quit [Quit: Page closed]
elinow has joined #lisp
<aeth> pjb: I'm assuming this system wouldn't be able to represent all numbers, but would be able to represent some like pi and e, which would probably be good enough for most calculations.
<aeth> It would very quickly take up a lot of memory, as rationals tend to do
<saturn2> any number that you thought up without taking infinite time can be represented with finite space
<pjb> aeth: square roots are often irrational. And they can often be encountered in real problem as solutions of equations.
<pjb> aeth: so already you'd need an infinite number of the square roots of all prime numbers…
ricekrispie2 has joined #lisp
<aeth> pjb: true, so you'd have to have square roots represented... although maybe not, maybe they'd just be a special case of powers.
ricekrispie has quit [Ping timeout: 258 seconds]
crystalball has joined #lisp
crystalball has quit []
lumm has joined #lisp
<pjb> aeth: then you cannot use a vector, you need expressions. You're back to step 1.
<pjb> primes or the square root of primes in the basis makes it infinite in either case.
lumm has quit [Read error: Connection reset by peer]
igemnace has joined #lisp
lumm has joined #lisp
igemnace has quit [Ping timeout: 258 seconds]
karlosz has joined #lisp
lumm has quit [Quit: lumm]
dale has quit [Quit: dale]
lumm has joined #lisp
siarhei has joined #lisp
random-nick has joined #lisp
elinow has quit [Ping timeout: 246 seconds]
siarhei has quit [Quit: Leaving]
techquila has quit [Ping timeout: 248 seconds]
lnostdal has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
shangul has joined #lisp
Manny8888 has left #lisp ["User left"]
gxt has joined #lisp
igemnace has joined #lisp
lnostdal has quit [Ping timeout: 252 seconds]
karlosz has quit [Quit: karlosz]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
atgreen__ has quit [Remote host closed the connection]
lnostdal has joined #lisp
TheWild has joined #lisp
<phoe> dim: reviewed. I don't have the domain knowledge yet so I've mostly commented on Lisp-related stuff.
ggole has joined #lisp
ebrasca has joined #lisp
dkmueller has joined #lisp
TheWild has quit [Ping timeout: 244 seconds]
v0|d has quit [Ping timeout: 246 seconds]
<shangul> beach, Isn't what I'm gonna do just a waste of time and re-inventing the wheel?
<phoe> shangul: what are you trying to do?
<no-defun-allowed> shangul: reinventing the wheel is a hip thing to do now, don't worry about it!
<shangul> phoe, solving problems with just functions from the original LISP and building my own LISP
Demosthenex has quit [Ping timeout: 258 seconds]
<phoe> shangul: I'd say that would be reinventing the wheel only if you've already done that exercise
<phoe> doing these things, e.g. writing your own mapcar, reduce, map, assoc, assoc-value, etc.. is a pretty good exercise in list processing in general
dkmueller has quit [Quit: WeeChat 1.6]
<phoe> as for building your own, that's also pretty good - projects like BYOL and MAL exist exactly for that
Demosthenex has joined #lisp
<phoe> or implementing the Lisp described in Graham's Roots of Lisp
<shangul> It is getting interesting!
<no-defun-allowed> i would not reccomend BYOL and MAL tbh, usually the ordering of parts in the book just confuses the reader
<no-defun-allowed> the really big sin i've spoken up about is trying to write eval before you have a proper environment model, which really throws you off, and if you're writing a Lisp in Lisp quite a bit of both books is not really necessary since they assume you are working in C for BYOB or who knows for MAL
<phoe> I've mostly implemented Roots of Lisp myself and consider it worth it
<phoe> (don't look at the comments)
<shangul> why phoe-trash?
<no-defun-allowed> BYOB is also mostly an excercise in writing C, not a Lisp interpreter too
<phoe> shangul: that's for projects I don't want on my main github page
<phoe> no-defun-allowed: I laughed at the BYOB (;
<no-defun-allowed> some shit like that
<no-defun-allowed> bring-your-own-brain was the motto of the author
<shangul> phoe, what is that? Can I build my own LISP with that?
<shangul> I think it will be interesting if I build my Lisp in Lisp, with a few blocks as base
<shangul> I like Lego :)
<phoe> shangul: nah, I'm just being silly - BYOB is an acronym for Bring Your Own Booze, among others
<phoe> as for building Lisp in Lisp, you can write a metacircular evaluator - that would be the simplest thing to do
<phoe> since you already have lists and symbols provided by the base Lisp
<shangul> writing my own eval thing?
<no-defun-allowed> It really isn't hard to make a Lisp out of Lisp pieces. Just implement lambda, cond, defun and copy in some host functions and you're set.
<shangul> no-defun-allowed, right
<White_Flame> man, I wish TAGBODY didn't return NIL. It really screws with tail calling
<no-defun-allowed> put a block around it maybe, eg (block nil (tagbody ..... (return foo)))
<White_Flame> hmm, will try
<phoe> write a TAGBODY* macro that actually returns the results of the last form via what no-defun-allowed has suggested
<no-defun-allowed> surely there is something more appropriate than TAGBODY too
Lycurgus has joined #lisp
<White_Flame> yeah, that seems to get around it. Didn't think of that. Was thinking I might have to rewrite this as a LOOP or seomthing
<White_Flame> it's emulator guts where it does some work and then goes back and retries prior stuff again
<White_Flame> so "GOTO START" makes sense in the context
<no-defun-allowed> oh aight
<no-defun-allowed> anyways making a metacircular evaluator is really easy, after some practise you can probably write one in about 15 minutes (cause DSLs are fun)
crystalball has joined #lisp
crystalball has quit [Client Quit]
<White_Flame> wow, x86 is pretty amazing. SBCL inserted a 10-byte NOP, plus a 1-byte NOP for alignment
<White_Flame> I didn't even know you could construct a 10-byte NOP
<shangul> a 10 byte nop?!
<no-defun-allowed> SBCL nopped the fuck out of there
<shangul> isn't nop=no operation?
<White_Flame> oops, "just" a 9-byte NOP
<pjb> shangul: building your own lisp, look at what beach's doing with sicl.
<no-defun-allowed> could be alignment
<White_Flame> shangul: so that the next instruction starts on a 16-byte alignment, for whatever reason
<White_Flame> probably has to do with where the tag is
<shangul> White_Flame, no idea. nop doesn't need 9 bytes anyway
Lycurgus has left #lisp ["Deus Ex"]
<White_Flame> ; 86: 660F1F840000000000 NOP
lnostdal has quit [Ping timeout: 255 seconds]
<no-defun-allowed> pjb: SICL is probably a bit much for someone who hasn't written an interpreter before
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
<shangul> I don't want to write an interpreter at all
<shangul> just building Lisp out of certain blocks
mindCrime_ has quit [Ping timeout: 258 seconds]
Oddity has quit [Read error: No route to host]
<pjb> shangul: you mean you're only interested in library functions?
<pjb> shangul: you don't want to implement your own QUOTE operator?
<TMA> White_Flame: shangul: you can turn it up to eleven: https://stackoverflow.com/a/36361832
<no-defun-allowed> Everything is reducible to lambda if you try hard enough.
<phoe> no-defun-allowed: except (let ((&rest 42)) (+ &rest 2))
<phoe> #justclaspthings
<no-defun-allowed> No comment.
<phoe> sure thing, there's no #\; on the line
<shangul> pjb, my own quote operator? I don't think so.
<phoe> why not though
<no-defun-allowed> Or, if you don't hate yourself, labels, lambda, cons, eq , cond and quote are also enough to make a decent Lisp.
<phoe> if you write your own EVAL, you can (and should) write your own QUOTE
<phoe> no-defun-allowed: it's hard to use CONS without CAR and CDR, you should have those too
<no-defun-allowed> Oh yeah, use those too.
<no-defun-allowed> Maybe look into some example Kilo LISP programs to see what that does: http://t3x.org/klisp/index.html
<shangul> no-defun-allowed, interesting
<shangul> I should use my floppy drive for that. This way it's funnier
makomo has joined #lisp
Folkol has quit [Quit: Textual IRC Client: www.textualapp.com]
Folkol has joined #lisp
<no-defun-allowed> And Kilo LISP (and most Lisp making resources) use an environment model, whereas that AIM-8 interpreter uses substitution evaluation which just substitutes, making side effects about as friendly for the user as in Haskell for the programmer
Lord_of_Life has quit [Ping timeout: 258 seconds]
<TMA> phoe: that too can be reduced to a dumb enough lambda (like the one scheme with dotted lists for &rest)
Lord_of_Life has joined #lisp
<TMA> s/scheme with/scheme uses with/
<phoe> TMA: I know, just not in CL
<TMA> phoe: you can rename the free occurences of &rest in let's &body
<TMA> there might be a bigger problem with funcall/apply absence
TheWild has joined #lisp
troydm has joined #lisp
<shangul> no-defun-allowed, thanks for Kilo LISP
Achylles has joined #lisp
<no-defun-allowed> phoe: disadvantages of Scheme macros: a bunch. advantages: i don't have to work out the inverse transformation of that cursed LET in my head
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
<no-defun-allowed> and actually there is no transform, i'm just stupid and didn't remember &rest is a variable name too
<LdBeth> The inner sin of lexical macros: gives the writer a excuse for not finish the design
<LdBeth> “Oh, that can be implemented with macro
<no-defun-allowed> also, are there any books beside the end of SICP and Lisp In Small Pieces that go over making a Lisp compiler?
<no-defun-allowed> school seems to be looking for books to get maybe
<ggole> There are various interesting papers
<pjb> shangul: in AIM-8 there's an implementation of QUOTE, and IF, etc.
wxie has joined #lisp
<LdBeth> Autonomy of LISP
<shangul> pjb, right
Fr0stBit has joined #lisp
<no-defun-allowed> I was thinking of something like "The Implementation of Functional Programming Languages" but on Lisp instead of ML
Fr0stBit has left #lisp ["WeeChat 2.4"]
Fr0stBit has joined #lisp
<LdBeth> Then I don’t think a lisp compiler would be very differently
<ggole> "Design of An Optimizing, Dynamically Retargetable Compiler for Common Lisp", maybe
<ggole> Of course it isn't in the same detail as the Peyton-Jones book, as it is a paper
another-user has joined #lisp
<another-user> hi
<no-defun-allowed> Seems interesting.
<no-defun-allowed> Hello another-user
<another-user> how can i abort uiop:run-program after specific timeout?
<another-user> i tried (sb-sys:with-deadline (:seconds 3) (uiop:run-program '("aplay" "/dev/urandom")))
<ggole> "Essentials of Compilation" is also worth a look, it iterates through a series of more interesting compilers, culminating in a Scheme-like thing
<another-user> but it didn't work - aplay was still running even after timeout
troydm has joined #lisp
<ggole> And roughly a million other papers on functional languages have ideas that can profitably be applied to Lisp
<no-defun-allowed> Is this the Essentials of Compilation you have in mind? https://jeapostrophe.github.io/courses/2017/spring/406/notes/book.pdf
<LdBeth> Today ppl trends to handle arch spec things to a compiler backend
lumm has quit [Remote host closed the connection]
lumm has joined #lisp
<no-defun-allowed> I don't know much about compilation to a low level target so I'm not sure I'd get most of the papers you suggest too.
arkaitz has joined #lisp
<no-defun-allowed> The preface to EoC seems to suggest they tried to make it easy to get into.
xuxuru has joined #lisp
<ggole> Yeah, that's the one
<ggole> I would start by writing a compiler for a (much) simpler language before tackling something like Common Lisp
<ggole> And EoC does pretty much take that approach
eabarbosa has joined #lisp
Bike has joined #lisp
<no-defun-allowed> Alright, thanks, I'll probably read that for a while.
lumm has quit [Remote host closed the connection]
another-user has quit [Ping timeout: 258 seconds]
another-user has joined #lisp
another-user has quit [Client Quit]
xuxuru has quit [Quit: xuxuru]
hiroaki has joined #lisp
arkaitz has quit [Quit: arkaitz]
lumm has joined #lisp
shifty has joined #lisp
oni-on-ion has quit [Read error: Connection reset by peer]
lumm has quit [Quit: lumm]
lumm has joined #lisp
makomo has quit [Ping timeout: 244 seconds]
nirved has joined #lisp
<TheWild> hello
eabarbosa has quit [Remote host closed the connection]
nirved_ has quit [Ping timeout: 258 seconds]
<TheWild> the question is about the detail of Lisp design. Between (xxx ...) and (... xxx ...), the xxx not only differs in meaning but also refers to something else. Is that correct?
<phoe> TheWild: if you are in a Lisp-2, yes
<phoe> Lisp-2 meaning that there are different namespaces for functions and variables
<phoe> (defun foo (x) (+ x 1)) (defvar foo 42) (foo foo) ;=> 43
<phoe> Common Lisp is a Lisp-2
<TheWild> ok, thanks
<TheWild> yeah, that's not going to work: (let ((f (lambda (x) (* x x)))) (f 5))
<TheWild> I'm curious how it was handled pre-Lisp-2
<phoe> (funcall f 5)
<phoe> TheWild: look at Scheme
<phoe> this code runs as expected on https://repl.it/languages/scheme
<no-defun-allowed> TheWild: (flet ((f (x) (* x x))) (f 5))
lumm has quit [Quit: lumm]
<phoe> oh right, CL has flet and labels for that
lumm has joined #lisp
pankajgodbole has quit [Ping timeout: 244 seconds]
wxie has quit [Quit: wxie]
Inline has quit [Quit: Leaving]
sunset_NOVA has quit [Quit: Leaving]
cosimone has joined #lisp
crystalball has joined #lisp
crystalball has quit [Client Quit]
<TheWild> I suspect I can define in Lisp such a function/macro that doesn't have their arguments immediately evaluated, just takes them straight as if they were quoted, right?
<phoe> that is how macros work
crystalball has joined #lisp
_whitelogger has joined #lisp
<LdBeth> Until it supports function pointer/higher order function stuff it doesn’t really matter
<TheWild> ALGOL doesn't remind the Lisp syntax though
crystalball has quit [Client Quit]
crystalball has joined #lisp
FreeBirdLjj has joined #lisp
<pjb> phoe: Algol report was published in 1958, just like AIM-8. Since AIM-8 is from March, chances are it was first.
crystalball has quit [Remote host closed the connection]
crystalball has joined #lisp
<edgar-rft> there were dinosaurs before lisp-2
<Bike> algol lets you reference functions. i don't know if they're "first class" exactly, but you can pass them as arguments.
<Bike> also closures, i think
crystalball has quit [Client Quit]
<Bike> probably not upward funargs
<pjb> This reports refers in the past to dates up to June 2, 1958, so it was posterior to AIM-8. LISP was first!
<phoe> pjb: hmm
<ggole> The lambda calculus predates all of that sort of thing
<pjb> Now, of course, JMC heard about the works on Algol, and because they refused to include COND, he forked out LISP and beat them.
<pjb> You can notice that in 1960, there was already SEVERAL algol implementations…
<ggole> Of course it's a calculus and not a concrete language, but the ideas are there
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #lisp
Lycurgus has joined #lisp
<beach> TheWild: when the arguments are not evaluated until they are needed, we call it "lazy evaluation" or "outermost evaluation", and it is what Haskell is doing.
neeasade has quit [Ping timeout: 268 seconds]
nirved_ has joined #lisp
nirved has quit [Ping timeout: 258 seconds]
Lycurgus has left #lisp ["Deus Ex"]
nirved has joined #lisp
<pjb> edgar-rft: :-)
nirved_ has quit [Ping timeout: 258 seconds]
cosimone has quit [Quit: WeeChat 2.3]
<pjb> Before macros, there were FEXPR and EXPR. You could write in LISP 1.5 special FEXPR functions that would get their arguments un-evaluated, and they would decide at run-time what to do with them. Normal functions were SUBR or FSUBR. see https://pastebin.com/pSgKMGeZ
cosimone has joined #lisp
tasdinq has joined #lisp
frodef has joined #lisp
v0|d has joined #lisp
LunarJetman has joined #lisp
caltelt has joined #lisp
<LunarJetman> I'm looking forward to implementing lisp. :)
dddddd has joined #lisp
tasdinq has quit [Quit: Textual IRC Client: www.textualapp.com]
kajo has quit [Ping timeout: 248 seconds]
cosimone has quit [Quit: WeeChat 2.3]
cosimone has joined #lisp
Arcaelyx has joined #lisp
rippa has joined #lisp
rdh has joined #lisp
kajo has joined #lisp
varjag has joined #lisp
<TheWild> In the context of designing an experimental dialect of Lisp, from time to time I take a peek how Lisp does a thing
<TheWild> (lambda (x) x). I suspected that lambda itself cannot be evaluated any further, and indeed it was the case. (eval (lambda (x) x))
<TheWild> this works: ((lambda (x) x) 123)
<Bike> symbols and cons are the only types of objects the evaluator deals with. everything else is just returned as-is.
<Bike> you don't need to experiment with this stuff, it's all in the manual.
<TheWild> but why this doesnt? ((eval (lambda (x) x)) 123) ?
<Bike> because in CL the only thing allowed at the head of a form is a symbol or (lambda ...)
<Bike> "If the car of the compound form is not a symbol, then that car must be a lambda expression,"
<TheWild> *lambda form n.* a [form] that is a [list] and that has a first element which is a [lambda expression] representing a [function] to be called on [arguments] which are the result of evaluating subsequent elements of the [lambda form].
* TheWild clicks the link [lambda form]
* TheWild ends up in infinite loop
<TheWild> okay, don't get anything from it. I only suspect that it's not yet a phase in which *eval* works, that's why that expression wasn't considered a lambda
<TheWild> going to try it in Scheme
<Bike> in scheme it'll work.
<Bike> you looked up "Lambda form" but what you want to look up is "lambda expression"
<Bike> these are different things
<Bike> all the bit i quoted said is that the only thing allowed at the head of a form is a symbol or (lambda ...)
<Bike> a lambda expression means a list (lambda ...)
<TheWild> its name derives from the fact that its first element is the symbol lambda
<TheWild> ^ citation
<TheWild> yeah, so Lisp looks for this specific symbol
<phoe> yes, it must be the symbol cl:lambda
skidd0 has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
cosimone has quit [Ping timeout: 252 seconds]
cosimone has joined #lisp
drdo has quit [Quit: ...]
drdo has joined #lisp
Lycurgus has joined #lisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
nowhereman has joined #lisp
JetJej has joined #lisp
lumm has quit [Quit: lumm]
lumm has joined #lisp
TMA has quit [Ping timeout: 246 seconds]
TMA has joined #lisp
q9929t has joined #lisp
lumm has quit [Client Quit]
lumm has joined #lisp
nowhereman has quit [Ping timeout: 255 seconds]
orivej has joined #lisp
q9929t1 has joined #lisp
q9929t has quit [Ping timeout: 268 seconds]
q9929t1 is now known as q9929t
q9929t1 has joined #lisp
q9929t has quit [Ping timeout: 258 seconds]
q9929t1 is now known as q9929t
eabarbosa has joined #lisp
baiyang has quit [Quit: EliteBNC - http://elitebnc.org (Auto-Removal: idle account/not being used)]
TMA has quit [Ping timeout: 246 seconds]
TMA has joined #lisp
Josh_2 has joined #lisp
TMA has quit [Ping timeout: 252 seconds]
TMA has joined #lisp
TMA has quit [Ping timeout: 245 seconds]
TMA has joined #lisp
asarch has joined #lisp
slyrus__ has joined #lisp
samlamamma has joined #lisp
slyrus_ has quit [Ping timeout: 255 seconds]
cosimone has quit [Quit: WeeChat 2.3]
q9929t has quit [Read error: Connection reset by peer]
anamorphic has joined #lisp
lumm has quit [Remote host closed the connection]
karlosz has joined #lisp
TheWild has quit [Ping timeout: 246 seconds]
benkard has joined #lisp
ravenousmoose has joined #lisp
mulk has quit [Ping timeout: 246 seconds]
benkard is now known as mulk
makomo has joined #lisp
* dim waves hi!
<Josh_2> Hey
<skidd0> i'm thinking i should add testing to my codebase. how much pain am I in for having only barely every done testing, and having a significant amount of work already invested into the code?
<skidd0> probably: a lot
<dim> only one way to figure it out
<Josh_2> THeres lots of testing libraries tho
<skidd0> which come recommended?
<dim> good news is that any incremental improvement is good on itself
<dim> you don't need to make a single PR/commit with “implemented testing” as one swoop
<dim> skidd0: just add a couple test where you miss them the most, that's a good starting point
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<skidd0> I don't know where I miss them though
<skidd0> i'm new to testing
<skidd0> well, automated testing
<dim> anytime you edit code and you wonder if you're breaking use cases that used to work before, that's where you miss testing
<dim> “if I change this API, or this data structure, what's going to break downstream?”
<skidd0> okay yeah that's pretty much what i thought
<dim> run unit tests and you *know*
<skidd0> do you (or others here) do TDD?
<skidd0> i know testing /= tdd
shangul has quit [Quit: sudo rm -rf /usr/*]
<dim> I mostly do RDD, though sometimes I don't write the readme in a file and just have it in my head
<skidd0> rdd being readme driven?
<skidd0> ah
<dim> yeah, write the README first, as in how are the users going to benefit from any code you wirte
random-nick has quit [Ping timeout: 246 seconds]
<skidd0> i see
<skidd0> i am my user though, as my code feeds a frontend i'm build
<skidd0> but i see the point
<skidd0> Once i have a readme, i'll probably have a good idea of where to start with testing, too
<skidd0> which, again, any recommendations?
pankajgodbole has joined #lisp
<dim> I'm not good at tests, so I'll pass at any reco on that
pierpal has quit [Ping timeout: 252 seconds]
<pfdietz> I think fiveam, and then prove and stefil, are the most popular unit testing packages.
<pfdietz> But automated testing includes automated test generation, which is a separate thing.
<pfdietz> I personally have used RT for unit testing, but that's old school.
<pfdietz> There's a CL "port" of the Haskell Quickcheck test generator. cl-quickcheck
<dim> I've used fiveam in some projects
<dim> what's hard for me with testing is choosing what to test in a way that makes the tests a good security to feel free to change the implementation while not adding useless work when changing your mind about some implementation choices
nanoz has joined #lisp
<dim> that, for me, is the struggle
pankajgodbole has quit [Ping timeout: 258 seconds]
<pfdietz> Well, you want to test through the public interface(s), which should be less likely to change. Failing that, test at the major internal interfaces, which also should be somewhat stable. Tiny unit tests of low level functions? Arguably not a good idea.
<dim> yeah finding the proper boundaries where tests are going to be a net bonus... I'm not good at that
karlosz has quit [Quit: karlosz]
Folkol has quit [Read error: Connection reset by peer]
random-nick has joined #lisp
Folkol has joined #lisp
kajo has quit [Ping timeout: 252 seconds]
kajo has joined #lisp
<skidd0> there are two seperate documents titled The Common Lisp Cookbook
<skidd0> this is confusing
<skidd0> i shouldn't complain. multiple curated and annotated resources is a good thing
<pfdietz> I suggest Common Lisp Recipes.
<skidd0> now a third
<skidd0> ゚☆.*゚・。yay゚☆.*゚・。
<skidd0> oh but this one i must purchase
<pfdietz> I try to collect Lisp books. Still looking for a Chine Nual.
<dim> I like PAIP intro, https://github.com/norvig/paip-lisp
<skidd0> the hope was to get actual work done today..
<dim> it is Sunday after all
<pjb> skidd0: first you have to decide what level of testing you want to do. https://yandex.com/collections/card/5aedac160265c1e2e48c40d5/
<skidd0> oh goodness there's so much to this
<pjb> skidd0: in particular, unit-testing can require internal module knowledge and hooks. If the code is not designed to be tested, this will be the most difficult part to implement. On the other hand, if you do bottom-up programming in lisp, testing subexpressions in the repl, etc, it can be rather easy to just save the testing expression into a unit-test file.
<pjb> skidd0: component testing should be rather easy and straighforward, unless you defined crazy APIs.
<skidd0> i'm reading On Lisp currently to get a better understanding of the lang and bottom-up
<pjb> skidd0: system integration testing may require more resources, since you may have to launch servers, test user interfaces, etc.
jeosol has joined #lisp
<pjb> skidd0: as will system testing. This will usually require manual testing by users.
oystewh has joined #lisp
<pjb> and acceptance testing, well, it's beyond the scope of a mere programmer.
<skidd0> heh
<pfdietz> When evaluating your tests, coverage information is useful. sbcl lets you compile code with coverage enabled and then see which parts are executed by your tests. Anything not executed has not been tested.
<pfdietz> Coverage is not a guarantee the tests are sufficient, but lack of coverage means they probably aren't.
<pjb> and then, when tests are complex, you may also have to test your tests…
<pjb> checking that your tests have good coverage is part of testing the tests.
<pfdietz> I need to get back to work on my mutation testing framework, which is intended to test tests.
<skidd0> so sbcl can be made aware of my testing setup (with a library), then report line coverage?
<skidd0> that's not just a part of the testing lib?
JetJej has quit [Quit: [Quit]]
<pfdietz> skidd0: if you explore various quicklisp systems, you will find many are sadly lacking in tests. Some are just dead though.
<pfdietz> Line coverage requires support of some kind. In general tests just see if the program does the right thing; the tests have no hooks into the source code to do coverage themselves.
<skidd0> coverage sounds more like a TDD aspect though
<pfdietz> sbcl just lets your find out what parts of a program have been executed, line (or branch) by line. It doesn't care whether that execution was in a "test framework".
<skidd0> oh i see
<pfdietz> There's also a public domain implementation-independent coverage package, COVER (in quicklisp now). It has some drawbacks, though.
<skidd0> so with sbcl coverage, i run by tests, i see coverage
<pfdietz> Yes
<skidd0> excellent
<pfdietz> See the online sbcl manual
<pfdietz> Coverage reports get dumped to disk, in html.
<pjb> And yes, one difficulty with coverage, is to also test it with all implementations and combinations of features, so you're sure you've covered all #+/#- cases.
<skidd0> ah, i've experienced similar with Ruby on Rails (for a soft. eng. class..)
<skidd0> well i'm building this appliaction with only a single implementation
<skidd0> as it's just for the employer's use
<skidd0> not a lib for other programmers to use
meepdeew has joined #lisp
<pjb> Ok, it simplifies things.
TheWild has joined #lisp
<pjb> in that case you can #-your-implementation (error "~S not implemented yet for ~A" 'name-of-function (lisp-implementation-type))
samlamamma has quit [Ping timeout: 258 seconds]
ravenousmoose has joined #lisp
random-nick has quit [Read error: Connection reset by peer]
mindCrime_ has joined #lisp
fivo has joined #lisp
<skidd0> so for testing, i'd want to create a test/ dir with my tests that pulls in my library, and keep the library in it's own src/, right?
<anamorphic> Tha
<anamorphic> Yeah that's pretty typical, skidd0
random-nick has joined #lisp
<skidd0> i see that t/ is a common dir name
<skidd0> but is that merely convention?
<anamorphic> That usually means the author used to code in Perl
samlamamma has joined #lisp
<pjb> better use test/ than t/
<skidd0> i see
<pjb> skidd0: i don't even put them in a different directory, just foo.lisp -> foo-test.lisp
<pjb> then, there's a <system>.asd and a <system>.test.asd
<skidd0> ah, hmm
<pjb> So I can (asdf:oos 'asdf:test-op :<system>) and it will compile and load the <system>.test and run the forms defined in it to run the test.
oystewh has quit [Quit: .]
grewal has quit [Quit: Lost terminal]
lumm has joined #lisp
grewal has joined #lisp
shifty has quit [Ping timeout: 246 seconds]
Lycurgus has quit [Quit: Exeunt]
asarch has quit [Quit: Leaving]
dmiles has quit [Ping timeout: 252 seconds]
Inline has joined #lisp
lumm has quit [Quit: lumm]
Oladon has joined #lisp
lumm has joined #lisp
nanoz has quit [Ping timeout: 246 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
fivo has quit [Quit: WeeChat 1.9.1]
Xach has quit [Ping timeout: 246 seconds]
Xach has joined #lisp
hiroaki has quit [Ping timeout: 252 seconds]
ym has quit [Read error: Connection timed out]
ym has joined #lisp
random-nick has quit [Ping timeout: 257 seconds]
Achylles has quit [Ping timeout: 252 seconds]
lumm_ has joined #lisp
arkaitz has joined #lisp
lumm has quit [Ping timeout: 252 seconds]
lumm_ is now known as lumm
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
random-nick has joined #lisp
dmiles has joined #lisp
meepdeew has quit [Remote host closed the connection]
anamorphic has quit [Ping timeout: 246 seconds]
meepdeew has joined #lisp
anamorphic has joined #lisp
<anamorphic> how does one get the "error message" part from a condition?
<Xach> anamorphic: one way is to print it.
ggole has quit [Quit: Leaving]
<Xach> anamorphic: print-to-string will give it to you as a string.
varjag has quit [Ping timeout: 246 seconds]
ym555 has joined #lisp
<anamorphic> Cool thanks Xach. I was overthinking it perhaps
vlatkoB has quit [Remote host closed the connection]
eabarbosa has quit [Remote host closed the connection]
<pjb> anamorphic: the thing is that not all conditions have a message.
<pjb> anamorphic: (define-condition example-condition (error) ()) #| --> example-condition |# (make-condition 'example-condition) #| --> #<example-condition #x30227DDBE9ED> |# (princ-to-string (make-condition 'example-condition)) #| --> "Error #<example-condition #x30227DE5E9CD>" |#
<pjb> anamorphic: some conditions have a format-string and format-argument that they format when asked to be printed, like simple-error.
<pjb> some just print themselves from their slots by their report function.
dkmueller has joined #lisp
<anamorphic> I see. Similarly for restarts, does one just princ them too and hope for something that makes sense to the user?
<anamorphic> (I'm having a go at writing my own *debugger-hook*)
meepdeew has quit [Remote host closed the connection]
meepdeew has joined #lisp
meepdeew has quit [Remote host closed the connection]
igemnace has quit [Quit: WeeChat 2.4]
dkmueller has quit [Quit: WeeChat 1.6]
anewuser has joined #lisp
techquila has joined #lisp
dkmueller has joined #lisp
manualcrank has joined #lisp
dkmueller has quit [Quit: WeeChat 1.6]
TheWild has quit [Quit: TheWild]
Necktwi has quit [Ping timeout: 246 seconds]
Necktwi has joined #lisp
MichaelRaskin has quit [Quit: MichaelRaskin]
random-nick has quit [Ping timeout: 268 seconds]
Achylles has joined #lisp
arkaitz has quit [Quit: arkaitz]
Lord_of_Life has quit [Ping timeout: 258 seconds]
Lord_of_Life has joined #lisp
samlamamma has quit [Ping timeout: 246 seconds]
<gjvc> GREGULUS
<gjvc> oops misfire ignore
frodef has quit [Ping timeout: 255 seconds]
anamorphic has quit [Ping timeout: 244 seconds]
Josh_2 has quit [Ping timeout: 258 seconds]
lumm has quit [Quit: lumm]
sauvin has quit [Ping timeout: 246 seconds]
sauvin has joined #lisp
rumbler31 has joined #lisp
skidd0 has quit [Quit: WeeChat 2.4]
<phoe> If I declare multiple FOR bindings in LOOP, are they equivalent to a LET or a LET*?
<Bike> let*, i think
<makomo> ^^
<phoe> (loop for x = (foo) for y = (bar) for x = (baz) ...)
<Bike> i do "for x in y for z = (foo x)" all the time, anyway
<makomo> not sure about duplicate variables though
<makomo> yeah, same
<Bike> "If multiple iteration clauses are used to control iteration, variable initialization and stepping[1] occur sequentially by default. The and construct can be used to connect two or more iteration clauses when sequential binding and stepping[1] are not necessary. The iteration behavior of clauses joined by and is analogous to the behavior of the macro do with respect to do*. "
<makomo> however, there's also ":for x ... :and y ..."
<dim> phoe: depends if you're using for/for/for or for/and/and
<phoe> dim: I see.
<dim> I think my fav example of that are the following examples: (loop repeat 10 for a = 1 then b for b = 1 then (+ a b) collect a) and then (loop repeat 10 for a = 1 then b and b = 1 then (+ a b) collect a)
<phoe> makomo: dim: TIL about for/and/and
<makomo> :-)
<dim> one of them is a nice fibonacci implementation, the other one is not ;-)
<makomo> hah, true that
<makomo> can anyone else try to indent the top-level form corresponding to this ONCE-ONLY definition https://gitlab.common-lisp.net/alexandria/alexandria/blob/master/macros.lisp#L58 and tell me if anything changes
<makomo> (i'm assuming SLIME)
<makomo> i.e. i'm specifically interested in SLIME's behavior
<makomo> and more specifically, regarding its behavior when indenting operators (MAPCAR in this case) that are unquoted
<makomo> the 2nd and 3rd arguments to the MAPCAR on line 58 get shifted to the left, under "MAPCAR"
<makomo> (when i indent it)
<makomo> same for the MAPCAR on line 65
<makomo> but not for the MAPCAR on line 61
<phoe> dim: hope that my review makes sense so far
<dim> it does! thanks
<dim> I pushed a clean-up patch to the PR already, and now I'm seeing more that the github UI did hide from me before
<dim> the (format nil (sql "some/file/in/the/source/tree/foo.sql") param param param ...) is my poor man's attempt at cl-yesql, because at the time it wasn't ready for this
<phoe> yes, I understand that
<dim> I could improve my system just a little bit or maybe re-evaluate cl-yesql
<phoe> cl-yesql only has support for postgresql and sqlite so far though
<dim> we could win a lot by just moving the (format nil ... ...) inside the SQL call
<dim> ok, so I'll keep my little thing some more
<phoe> sure - formatting queries this way is good as long as you don't care about SQL injections
<phoe> and I think if you're doing pgloader, you usually trust your input and output and the pgloader itself.
<dim> maybe I could introduce named arguments or stop relying so much on the format string facilities in my SQL templates and use something else instead, but I'm not sure about that
<dim> SQL injection on Postgres with postmodern is a non issue, because it uses the parse/bind/execute query protocol
<phoe> yes, but here we're creating raw SQL strings with FORMAT - normally that would be an issue
<dim> you can't fool Postgres around with some parameters suddenly being interpreted as SQL statement when using parse/bind/execute, becase at PARSE time Postgres didn't receive the parameters yet
<dim> true, sorry
<phoe> dim: or just create a macro-wrapper around DEFUN and FORMAT, something like (define-query-generator my-query (foo bar baz) "SELECT ~A FROM ~A JOIN ~A" foo bar baz)
<dim> I went on with my usual answer without thinking about the exact use case I have under my eyes, not good :/
<phoe> this would be a dumb way to create something like (defun my-query (foo bar baz) (format nil "
<dim> I want the queries to be in the source code as .sql files
<phoe> oh - yes, I see
<dim> that's #1 thing happening here
<phoe> that's doable
<phoe> it's possible to write a poor man's yesql that uses flat files and FORMAT to create SQL strings
<dim> yeah I've done it, though not in a pretty/good way yet
<phoe> I could prettify it a little bit
<phoe> throw an issue at pgloader's github, I can pick it up someday
<dim> yeah, if you want to work on that in a separate PR by my guest!
<phoe> I shall - I need to run to sleep now though
<phoe> so please throw an issue there so it is not forgotten
<phoe> good night and thanks for the pgloader work!
<dim> I'm just thinking of doing (defun sql (url &rest args) (apply #'format nil (gethash url *fs*) args)) now
<dim> good night! we'll see about improving that sql integration later!
<phoe> sure, that's an idea
<phoe> or use asdf:system-relative-pathname inside the function - I think you already do that
<phoe> to avoid the hashtable call, I mean
<dim> the hashtable is necessary: we want the SQL to be in the binary image
<dim> I don't want to ship the SQL files along with /usr/bin/pglaoder
<dim> mmm, or /usr/bin/pgloader even
<Xach> i want a virtual filesystem in dumped sbcl images
<Xach> every time i get worked up to make it i do something else instead
<dim> I've been using a hash-table as a proxy for that, the key being an absolute pathname, here for the SQL queries it looks like (sql "/mysql/list-all-columns.sql")
<dim> works well enough for my taste; I did that first with static assets for a website that ends up all being into the image, that's a nice delivery then
rumbler31 has quit [Remote host closed the connection]
<Xach> that's cool and will actually work today
ym555_ has joined #lisp
ym555 has quit [Ping timeout: 246 seconds]
<dim> hehe
ravndal has quit [Ping timeout: 246 seconds]
<Xach> still, for functions not directly under your control that expect to work with files/pathnames, would be fun to bundle files along with the image somehow.
<Xach> (i know that you can make everything under your control if you want)
<dim> the derivative in pgloader is at https://github.com/dimitri/pgloader/blob/master/src/utils/queries.lisp ; same idea, different taste, specialized in load .sql files from the source tree
<dim> well then you need to hack things more seriously so that open/close/file-position and many other things just work on top of your image based file system, right?
<Xach> yes
<Xach> things outside the gray streams extension
<dim> maybe you can do a logicial pathname translation unit (or something, can't remember the proper terminology) and make it happen that way? I think pjb has implemented something AGPL for that
ravndal has joined #lisp
aautcsh has joined #lisp
moldybits has quit [Quit: WeeChat 2.4]
anewuser has quit [Ping timeout: 246 seconds]
wxie has joined #lisp
caltelt_ has joined #lisp
Josh_2 has joined #lisp
<dim> ah, now that I have fixed Travis I'm waiting until it's passing on my PRs...
<dim> (and I had to manually restart two builds that wouldn't pass the first time, no code changes, and pass the second time; Travis being unable to fetch some apt key or something again) (damn it)
<dim> <insert old man yells at cloud GIF>
<Josh_2> Is Travis a race car driver?
wxie has quit [Quit: wxie]
meepdeew has joined #lisp
caltelt_ has quit [Ping timeout: 246 seconds]
khisanth_ has quit [Ping timeout: 246 seconds]
jack_rabbit has joined #lisp
campy_fellow has quit [Ping timeout: 245 seconds]