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
ricekrispie has joined #lisp
Oladon has joined #lisp
orivej has quit [Ping timeout: 246 seconds]
clothespin has joined #lisp
cpc26 has quit [Read error: Connection reset by peer]
cpc26 has joined #lisp
ym555 has joined #lisp
aautcsh has quit [Ping timeout: 248 seconds]
Patzy has quit [Ping timeout: 246 seconds]
Patzy has joined #lisp
bexx has quit [Remote host closed the connection]
bexx has joined #lisp
varjag has joined #lisp
varjag has quit [Ping timeout: 245 seconds]
Oladon has quit [Ping timeout: 245 seconds]
refpga has quit [Ping timeout: 272 seconds]
refpga has joined #lisp
ym555_ has joined #lisp
ym555 has quit [Ping timeout: 248 seconds]
anewuser has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
techquila has quit [Remote host closed the connection]
bexx has quit [Remote host closed the connection]
techquila has joined #lisp
Lord_of_Life has quit [Ping timeout: 246 seconds]
Lord_of_Life has joined #lisp
esrse has joined #lisp
shifty has joined #lisp
rpg has joined #lisp
torbo has quit [Remote host closed the connection]
dacoda has joined #lisp
libertyprime has quit [Ping timeout: 246 seconds]
dacoda has quit [Remote host closed the connection]
libertyprime has joined #lisp
rpg has quit [Ping timeout: 245 seconds]
dvdmuckle has quit [Quit: Bouncer Surgery]
dvdmuckle has joined #lisp
jessup has quit [Ping timeout: 264 seconds]
Jesin has quit [Quit: Leaving]
zotan has quit [Ping timeout: 248 seconds]
zotan has joined #lisp
refpga has quit [Ping timeout: 248 seconds]
refpga has joined #lisp
beach has joined #lisp
<beach> Good morning everyone!
<ck_> Good morning, beach
dddddd has quit [Remote host closed the connection]
pankajgodbole has joined #lisp
dale has quit [Quit: dale]
actuallybatman has quit [Ping timeout: 245 seconds]
nullman has quit [Ping timeout: 245 seconds]
notzmv has joined #lisp
zhlyg has joined #lisp
Bike has quit [Quit: Lost terminal]
refpga has quit [Ping timeout: 258 seconds]
libertyprime has quit [Remote host closed the connection]
refpga has joined #lisp
orivej has joined #lisp
vlatkoB has joined #lisp
marusich has joined #lisp
varjag has joined #lisp
nullman has joined #lisp
varjag has quit [Ping timeout: 245 seconds]
actuallybatman has joined #lisp
Zaab1t has joined #lisp
anewuser has quit [Quit: anewuser]
shka_ has joined #lisp
Zaab1t has quit [Client Quit]
Inline has quit [Quit: Leaving]
shka_ has quit [Quit: Konversation terminated!]
igemnace has quit [Read error: Connection reset by peer]
chipolux has quit [Quit: chipolux]
sauvin has joined #lisp
p9fn has quit [Ping timeout: 248 seconds]
libertyprime has joined #lisp
igemnace has joined #lisp
GoldRin has joined #lisp
<GoldRin> Bah, simple question, just having trouble with syntax. How would I apply an initial expression to an arugment within an flet in common lisp.
<loke> GoldRin: I could probbaly tell you, but I'm not sure I understand the question
<loke> Do you have an example
<loke> ?
<GoldRin> Basically just this: (let dup ([i 0]) ... I just don't know how I would translate from scheme to CL.
<loke> I don't know scheme very well. What does that do?
<loke> I thought Scheme used the same syntax for LET as Common Lisp, but that's not a notation I'm familiar with.
<GoldRin> local binding for a function named "dup" with the argument i which is initialised to 0 and local to "dup"
<d4ryus> i think something like: (flet ((dup (i) ...)) (dup 0))
<mfiano> (flet ((dup (&optional (i 0)) ..)) ..)
<GoldRin> (I suck at IRC, so I hope this works) loke: I've found that scheme and CL have slightly different ordering of parenthesis and it just has been throwing me off.
<GoldRin> Alright, thanks. I'll try out those suggestions
<d4ryus> GoldRin: if you want to call dup from within dup, you have to use labels. labels/flet is like let*/let respectively
<GoldRin> Ah, I thought that labels was basically letrec, and flet was a named let.
<pjb> d4ryus: not flet, which doesn't allow for recursive functions.
<pjb> d4ryus: instead, use labels
<pjb> or loop
<pjb> GoldRin: named let are rather loop.
<GoldRin> Alright, I think I need to do some more reading and research then. This isn't anything really important at least.
<beach> GoldRin: It is better to use explicit iteration when appropriate in Common Lisp.
<pjb> (let dup ((d '()) (e l)) (if (null? e) d (dup (cons (car e) (cons (car e) d)) (cdr e)))) would be written: (loop :named dup :for x :in e :collect x :collect x)
<pjb> GoldRin: but nothing prevents you to write a named-let macro.
<beach> GoldRin: The Common Lisp standard does not require tail-call optimization, so you can't rely on that. Plus, tail-recursive functions are often less readable form of iteration.
<pjb> It's rather trivial.
pankajgodbole has quit [Ping timeout: 272 seconds]
<loke> GoldRin: Also remembe rthat you really shouldn't do looping with recursion in Common Lisp. Instead, CL has a very strng LOOP construct that should be used.
JohnMS_WORK has joined #lisp
<loke> Self recursion is quite rare
<GoldRin> Oh, I didn't know most of that.
<beach> loke: You are right when it comes to linear structures. But it is common for tree-like structures.
clothespin has quit [Ping timeout: 252 seconds]
<beach> GoldRin: Scheme and Common Lisp are very different languages, especially when it comes to what is considered idiomatic code. It is preferable not to have a "Scheme accent" when you "speak Common Lisp".
<GoldRin> I didn't realise this.
eschatologist has quit [Remote host closed the connection]
eschatologist has joined #lisp
<beach> I am willing to bet that object-oriented programming is used a lot more in Common Lisp than in Scheme. I may be wrong about that, of course.
<GoldRin> Well I'm not highly familiar with either, just I had studied scheme for a bit before studying common lisp. Thanks for all the info btw
karlosz_ has joined #lisp
<loke> GoldRin: Common Lisp is a multiparadigm language, while Scheme is more of a "true" functional language (if there is such a thing)
xrash has joined #lisp
<pjb> beach: of course, 1- CL has a standard object system. 2- CL has the best object system of the world. :-)
xrash has quit [Read error: Connection reset by peer]
<beach> pjb: Of course. Just preparing GoldRin for a surprise.
<GoldRin> I hadn't been using CLOS specifically, but when I reached the functional programming part of the CL book I'm going through, I guess I just assumed that scheme ideas would just translate over.
<pjb> GoldRin: yes, mostly.
SaganMan has joined #lisp
<pjb> GoldRin: the only thing that doesn't translates well in CL from scheme, are generalized continuations. Delimited continuations are ok.
<GoldRin> Yeah, I've heard about that. I never really got too far with continuations when I was studying scheme, but I'll probably go back once I've finished this book.
iovec has joined #lisp
SaganMan has quit [Ping timeout: 248 seconds]
karlosz_ has quit [Quit: karlosz_]
donotturnoff has joined #lisp
nullman has quit [Ping timeout: 246 seconds]
SaganMan has joined #lisp
alexanderbarbosa has quit [Remote host closed the connection]
alexanderbarbosa has joined #lisp
GoldRin has quit [Ping timeout: 246 seconds]
marusich has quit [Remote host closed the connection]
scymtym has joined #lisp
shifty has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
ggole has joined #lisp
JohnMS has joined #lisp
JohnMS_WORK has quit [Ping timeout: 245 seconds]
SaganMan has quit [Ping timeout: 248 seconds]
aeth has quit [Ping timeout: 244 seconds]
aeth has joined #lisp
GoldRin has joined #lisp
varjag has joined #lisp
moldybits has quit [Ping timeout: 272 seconds]
actuallybatman has quit [Ping timeout: 245 seconds]
polezaivsani has joined #lisp
_whitelogger has joined #lisp
polezaivsani has quit [Ping timeout: 258 seconds]
polezaivsani has joined #lisp
ricekrispie has quit [Read error: Connection reset by peer]
ricekrispie has joined #lisp
moldybits has joined #lisp
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
themsay has quit [Ping timeout: 268 seconds]
scymtym has quit [Ping timeout: 248 seconds]
ym555_ is now known as ym555
srji has quit [Quit: leaving]
m00natic has joined #lisp
lavaflow has quit [Ping timeout: 248 seconds]
refpga has quit [Read error: Connection reset by peer]
refpga has joined #lisp
esrse has quit [Ping timeout: 248 seconds]
themsay has joined #lisp
notzmv has quit [Read error: Connection reset by peer]
notzmv has joined #lisp
orivej has quit [Ping timeout: 248 seconds]
dddddd has joined #lisp
themsay has quit [Ping timeout: 268 seconds]
themsay has joined #lisp
hhdave has joined #lisp
scymtym has joined #lisp
bendersteed has joined #lisp
<bendersteed> hello people
<beach> Hello bendersteed.
ebrasca has quit [Read error: Connection reset by peer]
ym555 has quit [Quit: leaving...]
catalinbostan has joined #lisp
xkapastel has joined #lisp
JohnMS_WORK has joined #lisp
w37 has joined #lisp
GoldRin has quit [Ping timeout: 245 seconds]
JohnMS has quit [Ping timeout: 258 seconds]
refpga has quit [Read error: Connection reset by peer]
cromyr has quit [Quit: leaving]
powerbit has quit [Ping timeout: 245 seconds]
refpga has joined #lisp
<Godel[m]> When managing quicklisp with roswell, is it expected to symlink the project directory to local-project directory both in `~/.roswell/local-projects` and `~/.roswell/lisp/quicklisp/local-projects` ? That is the only way I can see to load the project via quicklisp in both slime and ros-repl.
ykm has joined #lisp
<no-defun-allowed> I usually symlink stuff into ~/quicklisp/local-projects to get them recognised by Quicklisp, and it does seem intentional given the pathname and that there's a function QL:REGISTER-LOCAL-PROJECTS so I'd guess so.
ludston has joined #lisp
<jackdaniel> Godel[m]: I think you'll get more lucky by pasting question on roswell repository
<jackdaniel> I think that its devs are not on #lisp
<Godel[m]> jackdaniel: I think I solved it. But now I'm having trouble with `~/.sbclrc` which doesn't load on startup anymore (once I installed quicklisp and sbcl via roswell).
<Godel[m]> I see.
<flip214> How would I access an Oracle DB from sbcl? I know about PostModern etc., but the best choice for Oracle is CL-DBI? does CLSQL work?
amerlyq has joined #lisp
<no-defun-allowed> If it uses the SQL wire protocol (which IIRC is a standardised thing), probably.
<jackdaniel> Godel[m]: I've tried roswell and I had a lot of problems like that (so the experiment lead to software rejection)
jessup has joined #lisp
<no-defun-allowed> I tried to work on refactoring some code in Roswell and it was very nasty. Maybe that is just how "contrib" code goes being a lower priority, but it doesn't make me think too nicely of Roswell as a whole.
<no-defun-allowed> And I basically spend all my CL work time in git or SLIME so I don't see why I want a Unix-y interface to CL system management either.
<flip214> no-defun-allowed: what is an "SQL wire protocol"? every database has it's own (binary) protocol. I don't know about something like TELNET for SQL.
<no-defun-allowed> Oh, maybe it isn't a standardised thing. I assumed every database used the same protocol.
<no-defun-allowed> In the output of (ql:system-apropos "oracle") I see "dbd-oracle" and "hu.dwim.rdbms.oracle" which look promising though.
<aeth> I like the concept of Roswell, but the implementation is a very buggy C program that's hard to upgrade. Someone should make a similar tool that assumes that the host already has a Common Lisp installed, just not literally every Common Lisp ever. That would greatly simplify things imo.
Lord_of_Life has quit [Ping timeout: 248 seconds]
dddddd has quit [Remote host closed the connection]
ykm has quit [Remote host closed the connection]
Lord_of_Life has joined #lisp
<aeth> no-defun-allowed: The point of Roswell, at least to me, is so you can test with CLs that are either newer than your Linux distro offers or that your Linux distro doesn't offer.
dddddd has joined #lisp
<no-defun-allowed> Sure. I'm just not sure it's executed very well.
<aeth> Last time I tried Roswell for testing literally everything, it works for me for everything except for MKCL (not provided... but apparently it's provided now) and clasp (takes forever to compile and then fails for me... they really need a clasp-bin)
orivej has joined #lisp
<no-defun-allowed> Now I don't remember which file I thought I could clean up. Happens every time.
<aeth> The main downside to Roswell seems to be that I have to close my current emacs+slime and launch emacs specially through "ros use foo && ros emacs &" in the terminal. And then I have to put "ros use sbcl-bin &&" in front of every other command because ros will remember and use foo for everything, and might have issues with using foo over SBCL.
<aeth> Or at least, last time I really looked into it.
<jackdaniel> another problem is that you couldn't plug it with your own builds of desired software
<aeth> it seems to detect my ~/quicklisp/local-projects. Do you mean your own builds of the implementations?
<jackdaniel> yes
<aeth> ah, yes, that would be problematic
<aeth> I'm sure *someone* would hve made a clasp-bin by now.
<aeth> I guess it also means you probably can only use the trial versions of allegro and lispworks there.
jessup has quit [Remote host closed the connection]
<no-defun-allowed> Oh, here is the file that spooked me: https://github.com/roswell/roswell/blob/master/lisp/extend-quicklisp.lisp
<no-defun-allowed> Most of the read-from-string madness could be fixed with a #+asdf, unless it's uncertain if it'll get loaded before or after ASDF and Quicklisp maybe.
bendersteed has quit [Read error: Connection reset by peer]
bendersteed has joined #lisp
<no-defun-allowed> But again, I don't run a pragmatic get-work-done-now ~1000 star project for making Lisp more digestible for a shitstain of an OS, I am just an armchar critic. I'll stop whinging now.
JohnMS has joined #lisp
Bike has joined #lisp
paul0 has joined #lisp
JohnMS_WORK has quit [Ping timeout: 244 seconds]
donotturnoff has quit [Ping timeout: 248 seconds]
donotturnoff has joined #lisp
<aeth> no-defun-allowed: that file looks pretty ugly
<no-defun-allowed> But I can't tell if all this is intentional because we don't know if it will be loaded before Quicklisp and/or ASDF (in which case: what is the purpose of loading it?) or if it is just because the author did not consider it (which would hopefully lead to someone pointing out it could be cleaned up, or someone complaining at least)
test1600 has joined #lisp
<no-defun-allowed> And now this problem will ponder my dreams if I'm not lucky. Eh well, night.
test1600 has quit [Client Quit]
igemnace has quit [Ping timeout: 244 seconds]
jmercouris has joined #lisp
<jmercouris> any reason not to use subseq to trim a list down from '(0 1 2 3 4) to '(0 1 2 3)?
<jmercouris> I have this feeling in the back of my head that there is some other function I am not thinking of
<lieven> BUTLAST
<jmercouris> ok, sorry, bad example
<jmercouris> to trim X amount of elements off the end of a list where X varies
<lieven> that one is totally reasonable with SUBSEQ
<jmercouris> ok, thank you for the confirmation
<lieven> of course, the usual wisdom applies that if the list becomes big or this is a common operation, a list might not be the best datastructure for the job
<jmercouris> we're talking about lists of length 5-10 here
<jmercouris> so should be OK
<jdz> BUTLAST has an N parameter.
<jdz> With SUBSEQ one first has to find out the length of the list.
<jmercouris> Well, this is quickly turning into X Y
<jmercouris> I am trying to keep the list of a length of X elements
<jmercouris> s/of/to
<jdz> Pre-allocating a circular list and destructively modifying it might work.
<jdz> Depending on how you want to use it.
<jmercouris> The list is given to me by a function and I must trim it down
<jmercouris> The valid list length is computed by some other function
dale_ has joined #lisp
dale_ is now known as dale
<jmercouris> I think SUBSEQ will be OK
<jmercouris> I do however have another problem I am trying to think of, I want to avoid writing a conditional here
<jmercouris> I want to do X - Y, and return any number greater than 0
<jmercouris> maybe a conditional is what I need...
<aeth> (max 0 (- x y))
<jmercouris> or that, indeed
<jmercouris> thank you
scymtym has quit [Ping timeout: 248 seconds]
kajo has quit [Ping timeout: 258 seconds]
mindCrime has joined #lisp
FreeBirdLjj has joined #lisp
byronkatz has joined #lisp
<byronkatz> Good morning
X-Scale` has joined #lisp
bendersteed has quit [Ping timeout: 245 seconds]
FreeBirdLjj has quit [Ping timeout: 258 seconds]
X-Scale has quit [Ping timeout: 248 seconds]
X-Scale` is now known as X-Scale
xkapastel has quit [Quit: Connection closed for inactivity]
jmercouris has quit [Ping timeout: 258 seconds]
jmercouris has joined #lisp
<shka__> hey
<shka__> is there anything like INTEGER-LENGTH but for finding the first position of the least significant 1 bit?
<Xach> shka__: I seem to remember a trick in hacker's delight
<Xach> shka__: nothing built-in
<shka__> ok, no problem
<shka__> thanks for help
<ggole> x & -x
<ggole> Gives the lowest set bit for a two's complement number
<beach> jmercouris: BUTLAST is more specific than SUBSEQ.
<beach> You should always use the most specific construct that will work.
<beach> Hello byronkatz.
JohnMS has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<jmercouris> beach: what make BUTLAST more specific than SUBSEQ?
<jmercouris> because it works on lists rather than sequences?
xkapastel has joined #lisp
myrkraverk has quit [Ping timeout: 248 seconds]
<dtw> I wouldn't say "always" but for type checking it is useful to use specific functions.
myrkraverk has joined #lisp
refpga has quit [Read error: Connection reset by peer]
refpga has joined #lisp
jmercouris has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #lisp
wxie has joined #lisp
<flip214> no-defun-allowed: ah, thanks... didn't try that yet.
jmercouris has joined #lisp
saravia has joined #lisp
sjl_ has joined #lisp
hhdave_ has joined #lisp
wigust has joined #lisp
libertyprime has quit [Ping timeout: 246 seconds]
hhdave has quit [Ping timeout: 272 seconds]
hhdave_ has quit [Ping timeout: 248 seconds]
themsay has quit [Ping timeout: 245 seconds]
themsay has joined #lisp
Inline has joined #lisp
hhdave has joined #lisp
byronkatz has quit [Quit: Going offline, see ya! (www.adiirc.com)]
v88m has quit [Ping timeout: 245 seconds]
dddddd has quit [Ping timeout: 248 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
ludston has quit [Ping timeout: 245 seconds]
v88m has joined #lisp
khisanth_ has quit [Ping timeout: 245 seconds]
themsay has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #lisp
mindCrime has quit [Ping timeout: 258 seconds]
moei has joined #lisp
jmercouris has quit [Ping timeout: 245 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
wxie has quit [Quit: wxie]
dddddd has joined #lisp
FreeBirdLjj has joined #lisp
khisanth_ has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
chipolux has joined #lisp
<pfdietz> The LOG... functions in CL are effectively "infinite" 2's complement, so that trick works.
q9929t has joined #lisp
t58 has joined #lisp
themsay has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
v88m has quit [Ping timeout: 245 seconds]
FreeBirdLjj has quit [Ping timeout: 272 seconds]
nicksmaddog has joined #lisp
simendsjo has joined #lisp
FreeBirdLjj has joined #lisp
q9929t has quit [Quit: q9929t]
rpg has joined #lisp
<pjb> Always use the most generic operators, so that your functions are generic functions that can be applied on more types. So when you change your data structures, you don't have to rewrite all your program!
rippa has joined #lisp
<pjb> (defun foo (x) (subseq x 0 (1- (length x)))) (mapcar 'foo '( (1 2 3) #(1 2 3) "123")) #| --> ((1 2) #(1 2) "12") |#
<pjb> (defun foo (x) (butlast x 1)) (mapcar 'foo '( (1 2 3) #(1 2 3) "123")) #| ERROR: The value #(1 2 3) is not of the expected type list. |# DUH!
t58_ has joined #lisp
igemnace has joined #lisp
lnostdal has quit [Ping timeout: 245 seconds]
t58 has quit [Ping timeout: 258 seconds]
mindCrime has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
lavaflow has joined #lisp
shka_ has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
catalinbostan has quit [Quit: Textual IRC Client: www.textualapp.com]
PuercoPop has quit [Quit: ZNC 1.6.3 - http://znc.in]
<flip214> I'm using CL-STORE and override SERIALIZABLE-SLOTS to not include an open stream in a class' instances. Upon restoring I don't get the :INITFORM NIL, but an unbound slot.
<flip214> I'm fairly sure that did give back the :INITFORM a few years back; does someone know about an intentional change in CL-STORE?
<flip214> Or do I have to do something to get my NIL?
<grewal> 200 / p
themsay has quit [Ping timeout: 258 seconds]
<Bike> you want the initform to be evaluated at load time?
<flip214> well, (CL-STORE:RESTORE ...) should use the initform for unbound (ie. not serialized) slots
PuercoPop has joined #lisp
cosimone has joined #lisp
<Bike> according to the blame the default backend has not had different behavior for standard objects in the last twelve years, and it doesn't look like it does anything with initforms
<Bike> it just does allocate-instance and a bunch of (setf slot-value)
<Bike> maybe i'm looking at the wrong repo...
lnostdal has joined #lisp
lavaflow has quit [Ping timeout: 248 seconds]
lavaflow_ has joined #lisp
<Bike> general initforms are forms that may refer to a lexical environment, so they aren't really serializable
<Bike> (of course they're usually constants)
<Bike> if the class was defined normally i guess you could use that, though
hhdave has quit [Quit: hhdave]
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
v88m has joined #lisp
actuallybatman has joined #lisp
themsay has joined #lisp
karlosz has quit [Remote host closed the connection]
karlosz has joined #lisp
lavaflow has joined #lisp
m00natic has quit [Remote host closed the connection]
lavaflow_ has quit [Ping timeout: 246 seconds]
rpg has joined #lisp
themsay has quit [Read error: Connection reset by peer]
themsay has joined #lisp
amerlyq has quit [Quit: amerlyq]
polezaivsani has quit [Ping timeout: 246 seconds]
polezaivsani has joined #lisp
lnostdal has quit [Ping timeout: 245 seconds]
t58_ is now known as t58
warweasle has quit [Quit: later]
v88m has quit [Read error: Connection reset by peer]
cosimone has quit [Quit: WeeChat 2.4]
v88m has joined #lisp
bobby has joined #lisp
orivej has quit [Ping timeout: 248 seconds]
LiamH has joined #lisp
cantstanya has joined #lisp
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kajo has joined #lisp
Jesin has joined #lisp
lucasb_ has joined #lisp
Jesin has quit [Excess Flood]
Jesin has joined #lisp
lnostdal has joined #lisp
sauvin has quit [Read error: Connection reset by peer]
szmer has joined #lisp
orivej has joined #lisp
ggole has quit [Quit: Leaving]
hiroaki has joined #lisp
rpg has joined #lisp
donotturnoff has quit [Ping timeout: 245 seconds]
themsay has quit [Read error: Connection reset by peer]
themsay has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
<pfdietz> If you want a slot to have a default value even if not initialized, I suggest writing a method for slot-unbound.
<pfdietz> I use that for slots that implement caches. When unbound, do the expensive computation, then cache the value in the slot.
nowhereman has joined #lisp
cosimone has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
powerbit has joined #lisp
shka_ has quit [Ping timeout: 258 seconds]
nicksmaddog has quit [Quit: Leaving]
vlatkoB has quit [Remote host closed the connection]
dyelar has joined #lisp
dyelar has quit [Client Quit]
hdasch has quit [Quit: ZNC 1.7.3 - https://znc.in]
<rpg> pfdietz: Why not `:initform`?
<rpg> oh, I see -- because you're using this for memoizing. Never mind.
simendsjo has quit [Ping timeout: 246 seconds]
polezaivsani has quit [Remote host closed the connection]
<jackdaniel> pfdietz: I've once heard you saying doing that and I've used this technique a few times since
akoana has joined #lisp
mindCrime has quit [Ping timeout: 248 seconds]
zhlyg has quit [Ping timeout: 245 seconds]
<Xach> I do that quite a bit and sometimes I forget how a slot is initialized. I should start writing describe-object methods that mention how a particular slot is populated.
<Xach> I'm not sure it fits in :documentation - maybe that's better.
Bike has quit []
anlsh has joined #lisp
<anlsh> Ok, so I need some help: I have the following definitions (ignore the names :)
<anlsh> (defmacro safe-square (x) (once-only (x) `(* ,x ,x)))
rpg has quit [Quit: Textual IRC Client: www.textualapp.com]
<anlsh> (defmacro once-only ((&rest names) &body body) `(+ 3 4))
<no-defun-allowed> So, you get (+ 3 4) in the end.
<anlsh> When I do (safe-square (incf *a*)), I expect it to return the (once-only (x) `(* ,x ,x)), and once-only returns '(+ 3 4) no matter what, so I expect (safe-square (incf *a*)) => (+ 3 4)
<no-defun-allowed> If you're looking to bind x, then you need to create a let form around the body.
sjl_ has quit [Ping timeout: 248 seconds]
<anlsh> But when I call macroexpand-1 on (safe-square (incf *x*)), I get 7
<anlsh> I'm wondering where (+ 3 7) is actually being evaluated
orivej has joined #lisp
<no-defun-allowed> Yes.
<no-defun-allowed> (+ 3 7) is being macroexpanded in the body of safe-square.
LiamH has quit [Quit: Leaving.]
<no-defun-allowed> Remember that macros function just like normal functions and are subject to normal evaluation rules, they just happen to output code and have slightly different lambda lists.
<anlsh> See here's where I'm confused: lisp functions always return the result of evaluating their last form, correct? (aside from some when some special operators are used)
iovec has quit [Quit: Connection closed for inactivity]
<anlsh> so when evaluating the once-only, the result is `(+ 3 4), so I guess I'm wondering why that isn't just passed up
<anlsh> I suppose the result is evaluated once more since once-only is a macro?
cosimone has quit [Ping timeout: 248 seconds]
wigust- has joined #lisp
cosimone has joined #lisp
hhdave has joined #lisp
wigust has quit [Ping timeout: 246 seconds]
<no-defun-allowed> Well yes, `(+ 3 4) is evaluated in the macro body to yield (+ 3 4), which is then evaluated by the code containing the macro call.
igemnace has quit [Quit: WeeChat 2.5]
<anlsh> I see, I guess not evaluating a macro post-expansions would just make their return values useless haha
<no-defun-allowed> Yes it would.
<anlsh> So am I correct that, aside from a few things like destructuring parameters lists and &body, the forms (labels ((op-name <some-definition>)) (eval (op-name args))) are (macrolet ((op-name <some-definition>)) (op-name args)) are pretty much equivalent?
moei has quit [Quit: Leaving...]
<no-defun-allowed> I'm not sure, macros can get some insight on the environment they're evaluated in. Also, the compiler can optimise macros better.
cosimone has quit [Quit: WeeChat 2.4]
<pjb> anlsh: wrong.
<moldybits> (you need to quote the args, at least)
<anlsh> I mean I guess that macros can do critical stuff like control evaluation order which you can't do with the function definition, but the point being the extra eval when written as function call
<anlsh> fair, let's take quoted args then
<pjb> anlsh: For example: (defun foo (x) (return-from foo (+ 42 x)) 33) The last form is 33. But the result is the result of evaluating (+ 42 x).
<moldybits> extra eval?
<pjb> (foo 0) #| --> 42 |#
nowhereman has quit [Ping timeout: 257 seconds]
nowhere_man has joined #lisp
<pjb> prog1 is not a special operator. But a macro.
<pjb> (defun foo (x) (prog1 (+ 42 x) 33))
hhdave has quit [Quit: hhdave]
<pjb> anlsh: (+ 3 7) is never evaluated. The result of `(+ 3 4), which is (+ 3 4) is evaluated at run-time, after the macroexpansions have been done.
<pjb> Now, in (defmacro once-only ((&rest names) &body body) `(+ 3 4)) (defmacro safe-square (x) (once-only (x) `(* ,x ,x)))
<pjb> (once-only (x) `(* ,x ,x)) is expanded when the safe-square macro is compiled, and the returned expansion (+ 3 4) is evaluated when the safe-square macro itself is expanded.
<pjb> (macroexpand '(once-only (x) `(* ,x ,x))) #| --> (+ 3 4) ; t |# (macroexpand '(safe-square (incf *x*))) #| --> 7 ; t |#
<pjb> after the macroexpansion of the call to once-only, it's like if (defmacro safe-square (x) (+ 3 4)) had been written.
<pjb> When expanding (safe-square (incf *x*)), (+ 3 4) is evaluated returning 7, and this is the expansion returned by safe-square.
<anlsh> I see, realizing macroexpansion consists of both an expansion step and an evaluation step clears things up a lot
<pjb> wrong.
<pjb> Macroexpansion only consists in the expansion step.
<pjb> There's no evaluation step.
<pjb> Macroexpansion consists in calling the macro-function with the macro form.
<pjb> This is a mere function call, so you have evaluation of the macro function body.
<pjb> But the resulting expansion that is returned by the macro function is not evaluated AT ALL!
<pjb> It is used as source to be compiled instead of the macro call.
python476 has joined #lisp
<python476> people, do you know lisp jobs in Paris FR ?
<pjb> python476: not currently. Coarsely, I've seen job offers about once every 4 or 5 years, not more.
<python476> wow, poor lisp market
<python476> is it better in other countries ?
<pjb> python476: over the whole European Union, there's about one per year.
<python476> super sad, but not surprising
<pjb> python476: the best is to start your own company, and use lisp to develop solutions for your customers, like dim does with his sql tools.
<python476> yeah but I was seeking mentoring in a way
<python476> semi newb -> expert through a company
<python476> maybe later, when I have a stable situation I'll do [common]lisp project in-house
<python476> pjb: are you still working in lisp ?
<pjb> python476: everyday.
<python476> cool
<python476> I sense you wouldn't change for any other thing in the world
<pjb> For example, when I have to write code in C, I write it in CL first, debug it, and when it's good, I translate it to C.
<pjb> Or since I use emacs, I may write emacs lisp code to help me produce the code in the programming languages I need to use.
Bike has joined #lisp
<python476> pjb: do you have stub generators or do you translate by hand ?
<python476> I sense that this dynamic prototyping for near optimal solution to optimized rewrite is becoming a skill to spread
<pjb> python476: I recently improved my LINC translator: https://github.com/informatimago/lisp/tree/master/languages/linc which let me generate C code from sexps.
<python476> read a few articles about people ditching straight c++ for python or else on first drafts
<pjb> So I can easily write lisp programs to generate C programs.
<python476> fun
<python476> very fun
ltriant has joined #lisp
libertyprime has joined #lisp
mathrick has quit [Ping timeout: 252 seconds]
mathrick has joined #lisp
sindan has quit [Ping timeout: 248 seconds]
saravia has quit [Remote host closed the connection]
libertyprime has quit [Ping timeout: 248 seconds]
bexx has joined #lisp
actuallybatman has quit [Ping timeout: 248 seconds]
chipolux has quit [Quit: chipolux]
szmer has quit [Ping timeout: 244 seconds]
Lord_of_Life_ has joined #lisp
ricekrispie has quit [Quit: YEET]
Lord_of_Life has quit [Ping timeout: 248 seconds]
Lord_of_Life_ is now known as Lord_of_Life
python476 has quit [Ping timeout: 258 seconds]
ricekrispie has joined #lisp