<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.
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>
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.
<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!
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]
<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 :)
<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>
(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.