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
akater has quit [Remote host closed the connection]
akater has joined #lisp
bexx has joined #lisp
<bexx> i'm trying to understand reduce from the end
<bexx> why (reduce #'expt '(2 3 2) :from-end t) is 512 but (reduce #'expt '(2 3 2)) is 64?
<bexx> isn't the same?
<Bike> (expt 2 (expt 3 2)) versus (expt (expt 2 3) 2), i think
<bexx> oooh i see
<bexx> so reduce takes two elements?
<Bike> expt takes two arguments
FreeBirdLjj has joined #lisp
<Bike> reduce takes a function of two arguments, such as expt
<bexx> ha!
<bexx> now i can see!
<bexx> thanks Bike!
<Bike> you're welcome
<LdBeth> because expt is not associative
holycow has joined #lisp
holycow has quit [Quit: Lost terminal]
<bexx> LdBeth: which means?
<bexx> s/which/that/
<bexx> i have terrible english skills
<bexx> sorry
<Bike> it means that (expt x (expt y z)) does not equal (expt (expt x y) z).
<LdBeth> which means (expt a b) is not guaranteed to (expt b a)
<Bike> * is associative, so (* x (* y z)) = (* (* x y) z).
<Bike> well that's commutativity.
techquila has joined #lisp
techquila has quit [Remote host closed the connection]
techquila has joined #lisp
<LdBeth> GG, associative means 1+2+3 is (1+2)+3
<LdBeth> My bad, expt is right associative, + is left associative
<LdBeth> So 2^3^2 is 2^(3^2) if write out the parentheses
<Bike> that's just a property of parsing
<grewal> Except + is associative in most systems we talk about
<LdBeth> APL, haha
<grewal> By convention, ^ is right associative because (2^3)^2 = 2^6
<Bike> that's not really relevant.
<LdBeth> I guess many would understand reduce as insert infix operator in between each elements of the list
<Bike> maybe, but it doesn't associate differently based on the function. it's just left associative.
<Bike> or right-associative if you do :from-end t.
<grewal> Yes, I guess my point was more that if you're transcribing a math formula, you need to know what the conventions are and how to implement that in lisp
wxie has joined #lisp
catchme has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #lisp
lucasb has quit [Quit: Connection closed for inactivity]
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
bexx has quit [Remote host closed the connection]
atgreen has quit [Ping timeout: 250 seconds]
atgreen has joined #lisp
jason_m has joined #lisp
jason_m has quit [Ping timeout: 245 seconds]
jason_m has joined #lisp
jason_m has quit [Ping timeout: 246 seconds]
ricekrispie2 has joined #lisp
ricekrispie has quit [Ping timeout: 250 seconds]
dale has quit [Quit: dale]
piku has joined #lisp
_whitelogger has joined #lisp
anewuser has joined #lisp
noobineer has joined #lisp
anewuser has quit [Read error: Connection reset by peer]
<akater> LdBeth: I'd say “insert infix” would be #'apply. I could never understand reduce at all and consider it misguided at best and meaningless at worst, a malformed and crippled fold.
<Bike> but it is fold.
ebrasca has joined #lisp
noobineer has quit [Read error: Connection reset by peer]
<stylewarning> apply is absolutely not “insert infix” except for a few corner cases
noobineer has joined #lisp
<White_Flame> the fact that reduce calls its function even with zero arguments is odd, though. I would think that should be a separate operation, not a reduction of pairs
<White_Flame> it really only makes sense for + and *
<akater> Bike: fold accepts functions X⨯Y→X, while reduce accepts mere X⨯X→X. Clearly, reduce is expressible through fold but not (sanely) vice versa.
<Bike> you can use :initial-element.
<Bike> it's not as pretty, but it's definitely fold
<akater> Bike: I have fold defined with reduce and initial-element, of course. Nevertheless, reduce accepts functions that are less general than those accepted by fold, if one cares about types. fold always makes sense when you deal with empty sequences, reduce does not.
<Bike> oh, i misunderstood.
<Bike> but i still don't understand. if you restrict yourself to using :initial-value, empty sequences work fine. and you can do the former type.
<Bike> (reduce (lambda (x y) (check-type x integer) (check-type y list) (cons x y)) '(1 2 3) :initial-value nil :from-end t)
<akater> If you restrict yourself this way, it *is* indeed fold. It's great that Common Lisp has reduce. Actually it probably *should* have reduce and not fold as the more basic component, if there has to be one, I'd say.
dddddd has quit [Remote host closed the connection]
Aruseus has quit [Remote host closed the connection]
<beach> Good morning everyone!
arescorpio has joined #lisp
<akater> By the way, fold generalizes cleanly to mulitiple sequences, unlike reduce with its need for keywords.
caltelt_ has joined #lisp
<akater> Also, one can imagine foldf but reducef would be quite ugly.
torbo has joined #lisp
patlv has quit [Quit: patlv]
igemnace has joined #lisp
dale has joined #lisp
Tordek has quit [Ping timeout: 246 seconds]
Tordek has joined #lisp
piku has left #lisp ["Leaving"]
<LdBeth> why care about funcion type? lisp is unitype.
<LdBeth> T * T -> T
<aeth> oh wow, so apparently #'reduce sets initial-value to (+) or (*) or whatever the function is if you don't provide one
<aeth> Yes, that does seem like it's just a shortcut so * and + are more concise
<Bike> pretty much, yes.
_whitelogger has joined #lisp
<LdBeth> good evening
<aeth> hi \{_}
<Josh_2> aeth: but can you turn CL into a girlfriend?
<\{_}> does it take a lot of *magic* to implement something like the &key in a macro?
<\{_}> say if I want to make something that has a structure similar to defun itself?
<Bike> usually you can use destructuring-bind or a lambda or something and thus not implement it yourself.
<aeth> A key is just a plist tail
<\{_}> hm!
<LdBeth> Josh_2: GG, make AI
<aeth> If you didn't have destructuring-bind you could use plist functions to handle it, although you'd probably have to do something like walk through it first to make sure that it's well-formed (even length, every other as a key, no double key...)
<\{_}> aeth: right, that was I worrying about, didn't know about defstructuring-bind though
<\{_}> let me check it out
<aeth> destructuring-bind does all the work for you
<aeth> It's very fun
<\{_}> and to think I was to reimplement (poorly ofc) something already in the language
<aeth> destructuring-bind makes sure it's valid. If you take car and cadr, the list might look like (1 2 3 4 5 6 7) and you're just taking the first two. If you do (destructuring-bind (first second) your-list ...) you know that it must look like (1 2) unless you e.g. (first second &rest rest) and then (declare (ignore rest)) in the body or maybe do a blank keys like (first second &key &allow-other-keys)
<aeth> And that's just taking the first two elements! plist tails (since the key doesn't have to start at the first element) are much trickier, and destructuring-bind handles it.
<aeth> you can do (destructuring-bind (foo &key bar baz quux) (list 42 :quux 42 :bar 43 :baz 44) (values foo bar baz quux))
Bike has quit [Quit: Lost terminal]
<aeth> I wouldn't want to write code to make sure that that's valid, but I don't have to.
<\{_}> my head hurts. but I'll get the hang of this at some point
<\{_}> I'm starting to understand the function
<\{_}> cl surely has some spooky stuff
arescorpio has quit [Quit: Leaving.]
<\{_}> thanks for the help! I'm off work now g2g
\{_} has quit [Quit: \{_}]
wxie has quit [Ping timeout: 250 seconds]
ltriant has quit [Quit: leaving]
caltelt_ has quit [Ping timeout: 255 seconds]
nopf has quit [Remote host closed the connection]
orivej has joined #lisp
noobineer has quit [Read error: Connection reset by peer]
torbo has quit [Remote host closed the connection]
_whitelogger has joined #lisp
_whitelogger has joined #lisp
sauvin has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
anewuser has quit [Ping timeout: 250 seconds]
norserob has joined #lisp
frodef has joined #lisp
_whitelogger has joined #lisp
vlatkoB has joined #lisp
gxt has quit [Ping timeout: 252 seconds]
JohnMS_WORK has joined #lisp
pjb has joined #lisp
_whitelogger has joined #lisp
Inline has quit [Quit: Leaving]
jprajzne has quit [Remote host closed the connection]
varjag has joined #lisp
<pjb> aeth: to see how difficult it is to parse lambda-list, you can have a look at com.informatimago.common-lisp.lisp-sexp.source-form:parse-lambda-list
<pjb> (not very difficult).
Ukari has quit [Remote host closed the connection]
Ukari has joined #lisp
nicolas23[m] has quit [Remote host closed the connection]
djeis[m] has quit [Read error: Connection reset by peer]
Manny8888 has quit [Remote host closed the connection]
rudi[m] has quit [Read error: Connection reset by peer]
akanouras has quit [Read error: Connection reset by peer]
illandan[m] has quit [Remote host closed the connection]
Gnuxie[m] has quit [Read error: Connection reset by peer]
sielicki has quit [Read error: Connection reset by peer]
LdBeth has quit [Remote host closed the connection]
Woazboat has quit [Remote host closed the connection]
no-defun-allowed has quit [Read error: Connection reset by peer]
colelyman has quit [Read error: Connection reset by peer]
xylef has quit [Write error: Connection reset by peer]
Jachy has quit [Read error: Connection reset by peer]
juristi has quit [Remote host closed the connection]
dtw has quit [Read error: Connection reset by peer]
irdr has quit [Max SendQ exceeded]
ricekrispie2 is now known as ricekrispie
irdr has joined #lisp
varjag has quit [Ping timeout: 268 seconds]
ggole has joined #lisp
Manny8888 has joined #lisp
jprajzne has joined #lisp
shrdlu68 has joined #lisp
<splittist> morning
Josh_2 has quit [Remote host closed the connection]
Josh_2 has joined #lisp
gigetoo has quit [Ping timeout: 255 seconds]
gigetoo has joined #lisp
norserob has quit [Quit: leaving]
dtw has joined #lisp
xylef has joined #lisp
akanouras has joined #lisp
colelyman has joined #lisp
Woazboat has joined #lisp
illandan[m] has joined #lisp
Jachy has joined #lisp
sielicki has joined #lisp
no-defun-allowed has joined #lisp
esrse has joined #lisp
<shrdlu68> morning, splittist.
Arcaelyx has quit [Quit: Textual IRC Client: www.textualapp.com]
rumbler31 has quit [Remote host closed the connection]
libertyprime has quit [Quit: leaving]
rumbler31 has joined #lisp
plugd has joined #lisp
scymtym has quit [Ping timeout: 246 seconds]
shifty has joined #lisp
rumbler31 has quit [Ping timeout: 250 seconds]
asarch has joined #lisp
asarch has quit [Quit: Leaving]
aindilis has joined #lisp
wigust- has joined #lisp
wigust has quit [Ping timeout: 268 seconds]
yCrazyEdd has joined #lisp
CrazyEddy has quit [Ping timeout: 244 seconds]
yCrazyEdd is now known as CrazyEddy
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 246 seconds]
m00natic has joined #lisp
wxie has joined #lisp
flamebeard has joined #lisp
gxt has joined #lisp
flamebeard has quit [Remote host closed the connection]
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 255 seconds]
flamebeard has joined #lisp
flamebeard has quit [Remote host closed the connection]
schweers has quit [Remote host closed the connection]
scymtym has joined #lisp
flamebeard has joined #lisp
flamebeard has quit [Remote host closed the connection]
spoeplau has joined #lisp
flamebeard has joined #lisp
spoeplau has quit [Ping timeout: 268 seconds]
wxie has quit [Ping timeout: 268 seconds]
spoeplau has joined #lisp
sielicki has quit [Remote host closed the connection]
Woazboat has quit [Read error: Connection reset by peer]
Manny8888 has quit [Remote host closed the connection]
akanouras has quit [Remote host closed the connection]
no-defun-allowed has quit [Read error: Connection reset by peer]
xylef has quit [Read error: Connection reset by peer]
colelyman has quit [Remote host closed the connection]
illandan[m] has quit [Write error: Connection reset by peer]
dtw has quit [Read error: Connection reset by peer]
Jachy has quit [Remote host closed the connection]
irdr has quit [Max SendQ exceeded]
Ukari has quit [Ping timeout: 245 seconds]
irdr has joined #lisp
aindilis has quit [Read error: Connection reset by peer]
Inline has joined #lisp
Zaab1t has joined #lisp
aindilis has joined #lisp
Manny8888 has joined #lisp
<flip214> https://common-lisp.net/project/iterate/ says to use darcs, but doing that gives me
<flip214> darcs failed: Not a repository: http://www.common-lisp.net/project/iterate/darcs/iterate (HTTP response code said error 404)
<flip214> is that a setup problem on c-l.net, or has the repository moved?
Ukari has joined #lisp
techquila has quit [Ping timeout: 250 seconds]
Essadon has joined #lisp
<jackdaniel> as far as I recall year or two ago Eric made a shoutout on the mailing list if anyone has problem with migrating all cl-net repositories to git
<jackdaniel> and make them available on gitlab instance
<jackdaniel> flip214: ↑
<flip214> jackdaniel: yeah, thanks, saw that. so it's moved to git.... I'll take a look.
<flip214> minion: memo for _death: I've got a couple of (old!) patches up at github.com/phmarek/dbus.git ... Would you please take a
<minion> Remembered. I'll tell _death when he/she/it next speaks.
<flip214> minion: memo for _death: look? Thanks!
<minion> Remembered. I'll tell _death when he/she/it next speaks.
akanouras has joined #lisp
colelyman has joined #lisp
xylef has joined #lisp
dtw has joined #lisp
no-defun-allowed has joined #lisp
sielicki has joined #lisp
Jachy has joined #lisp
illandan[m] has joined #lisp
Woazboat has joined #lisp
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
j-r has quit [Quit: Page closed]
dddddd has joined #lisp
ebrasca has quit [Remote host closed the connection]
Ukari has quit [Ping timeout: 264 seconds]
JohnMS_WORK has quit [Read error: Connection reset by peer]
JohnMS_WORK has joined #lisp
akoana has left #lisp [#lisp]
frodef has quit [Ping timeout: 250 seconds]
Ukari has joined #lisp
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
juristi has joined #lisp
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
frodef has joined #lisp
amerlyq has joined #lisp
LdBeth has joined #lisp
asedeno has quit [Ping timeout: 252 seconds]
asedeno has joined #lisp
lnostdal has quit [Excess Flood]
lnostdal has joined #lisp
orivej has quit [Ping timeout: 245 seconds]
X-Scale has quit [Read error: Connection reset by peer]
rumbler31 has joined #lisp
esrse has quit [Read error: Connection reset by peer]
rumbler31 has quit [Ping timeout: 264 seconds]
__jrjsmr_ has joined #lisp
vlatkoB_ has joined #lisp
frodef has quit [Ping timeout: 244 seconds]
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
vlatkoB has quit [Ping timeout: 250 seconds]
warweasle has joined #lisp
igemnace has quit [Quit: WeeChat 2.4]
random-nick has joined #lisp
patlv has joined #lisp
shifty has quit [Ping timeout: 245 seconds]
Lord_of_Life_ has joined #lisp
Josh_2 has quit [Read error: Connection reset by peer]
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
Lord_of_Life has quit [Ping timeout: 255 seconds]
Lord_of_Life_ is now known as Lord_of_Life
orivej has joined #lisp
Bike has joined #lisp
orivej has quit [Ping timeout: 250 seconds]
LiamH has joined #lisp
__jrjsmr_ has quit [Read error: Connection reset by peer]
djeis[m] has joined #lisp
atgreen has quit [Ping timeout: 250 seconds]
<pfdietz> I had wanted to go to ELS this year. Maybe if there's one next year.
<beach> Of course.
<beach> There is one every year.
cage_ has joined #lisp
X-Scale has joined #lisp
<splittist> I have enjoyed reading the beta-peta paper
pankajgodbole has joined #lisp
__jrjsmrtn__ has joined #lisp
__jrjsmrtn__ has quit [Client Quit]
__jrjsmrtn__ has joined #lisp
__jrjsmrtn__ has quit [Client Quit]
__jrjsmrtn__ has joined #lisp
lucasb has joined #lisp
atgreen has joined #lisp
shrdlu68 has left #lisp ["WeeChat 2.3"]
lumm has joined #lisp
ralt has joined #lisp
rumbler31 has joined #lisp
hhdave has joined #lisp
atgreen has quit [Ping timeout: 245 seconds]
Ukari has quit [Remote host closed the connection]
Ukari has joined #lisp
rxf has joined #lisp
igemnace has joined #lisp
varjag has joined #lisp
jmercouris has joined #lisp
<jmercouris> how to get slime to recognize environment variables from my login shell?
<jmercouris> this is what I get http://dpaste.com/1WNN3F1
<jmercouris> but it doesn't seem to want to load env varabiles
<dlowe> you'll have to start your lisp implementation from the shell, load and start swank, then connect to it with M-x slime-connect
<jmercouris> no way to do it via some emacs configuration?
<nirved> jmercouris: create a shell script which starts lisp, and set it as the one slime should run
__jrjsmrtn__ has quit [Quit: __jrjsmrtn__]
<dlowe> jmercouris: if you start emacs in the shell, it should inherit the environment vars
<pjb> jmercouris: your question is strange. what do you mean?
<pjb> jmercouris: eg. how is slime related at all with environment variables?
<pjb> jmercouris: What would for slime to "recognize" environment variables mean?
spoeplau has quit [Ping timeout: 245 seconds]
<jmercouris> I mean that when I do a setting of a term environment variable
<jmercouris> and then I do an osicat test, it will appear
<nirved> jmercouris: setting it where? if lisp is already running, how would it know that you set it?
<jmercouris> I have it set before I even launch emacs...
<jmercouris> whether lisp is already running or not is irrelevant
<jmercouris> I'm talking about: (osicat:environment-variable "APP_ENV") returning the value of APP_ENV
<jmercouris> because in a term I can easily echo $APP_ENV and get the value, but in Slime it does not appear
<Bike> environment variables you set in a shell are only in that one shell.
<nirved> or its child processes
<nirved> (at the fork time)
<jmercouris> I am also using the emacs package that inherits the environment vars from the shell
<jmercouris> I forget the name
<Bike> i mean, if you start a program from the shell, and then alter a variable in the shell, the program will still have the old value because it got a copy of the environment, they don't all share the same environment.
<Bike> i think.
__jrjsmrtn__ has joined #lisp
angavrilov has joined #lisp
flamebeard has quit []
JetJej has joined #lisp
<jmercouris> Yes, but in this case I've already set the variable
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
varjag has quit [Ping timeout: 245 seconds]
atgreen has joined #lisp
<Bike> i see. well, i think a lisp started by a slime in an emacs run from a shell should inherit that shell's environment variables. but it's a little indirect.
<Bike> let me see if i can test this in some non stupid way
Ukari has quit [Ping timeout: 250 seconds]
<Bike> yep, if i `export FOO=347`, `/path/to/emacs`, then M-x - slime, launch sbcl, and do (sb-ext:posix-getenv "FOO"), i get "347"
<Bike> that's the kind of thing you have in mind, yes?
jprajzne has quit [Quit: Leaving.]
varjag has joined #lisp
rumbler31 has quit [Remote host closed the connection]
JohnMS_WORK has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
mercourisj has joined #lisp
jmercouris has quit [Ping timeout: 250 seconds]
Ukari has joined #lisp
Lycurgus has joined #lisp
atgreen has quit [Ping timeout: 246 seconds]
shka_ has joined #lisp
plugd has quit [Quit: rcirc on GNU Emacs 26.1]
m00natic has quit [Remote host closed the connection]
random-nick has quit [Read error: Connection reset by peer]
random-nick has joined #lisp
ym has joined #lisp
hhdave has quit [Ping timeout: 245 seconds]
nanoz has joined #lisp
datajerk has joined #lisp
<p_l> Unix env vars are passed as one of the arguments to "real" main function
khisanth_ has quit [Ping timeout: 246 seconds]
<pjb> minion: memo for jmercouris see process-environment
<minion> memo for jmercouris see process-environment: I can't be expected to work when CLiki doesn't respond to me, can I?
<pjb> minion: memo for jmercouris: see process-environment, getenv, setenv
spoeplau has joined #lisp
<minion> Remembered. I'll tell jmercouris when he/she/it next speaks.
ralt has quit [Quit: Connection closed for inactivity]
spoeplau has quit [Ping timeout: 268 seconds]
khisanth_ has joined #lisp
asarch has joined #lisp
<asarch> How do you export a class from a package?
<dlowe> you only export symbols from a package
<dlowe> so you export the class name in the same way you export function names
<dlowe> using :export in defpackage or explicitly (export 'class-name)
<dlowe> (you should probably do the defpackage one)
<asarch> ;; point.lisp: (defclass point () ...) ;; asarch.lisp: (defpackage :asarch (:use :common-lisp) (:export :point)) ;; myprog.lisp: (load "asarch.lisp") (let ((a (make-instance 'asarch:point))...
<asarch> Ok
zigpaw has joined #lisp
<asarch> BTW, point is actually in its own file
<asarch> So, asarch.lisp is something like: (defpackage :asarch (:use :common-lisp) (:export :point)) (in-package :asarch) (load "point.lisp")
<dlowe> Usually we use asdf to load multi-file projects into our lisp image
<asarch> Oh :-(
<asarch> Ok
<dlowe> also, you are exporting :point when you should probably be exporting point
mercourisj has quit [Remote host closed the connection]
<dlowe> I don't think it'll hurt anything, though
<dlowe> so, in point.lisp, without an in-package form, it's not reliably going to be asarch:point. It could be cl-user:point.
<dlowe> and then myprog.lisp wouldn't be able to find it
<dlowe> but in order for that to work, asarch.lisp needs to be loaded first
<dlowe> which is something asdf will do for you
<dlowe> or you can do it manually yourself in myprog.lisp
Ukari has quit [Remote host closed the connection]
Ukari has joined #lisp
atgreen has joined #lisp
<asarch> asarch.lisp is actually loaded in myprog.lisp
<asarch> myprog.lisp: (load "asarch.lisp") (let ((chokoreto (make-instance 'asarch:point)) (format t "Value of x-axis is: ~d~%" (slot-value chokoreto 'x)))
<dlowe> yes, but it has to be loaded *before* point.lisp
<dlowe> *and* point.lisp needs its *package* set
<asarch> Oh :-(
<asarch> myprog.lisp loads asarch.lisp which loads point.lisp
<dlowe> okay, then yeah, that'll probably work
<dlowe> does it not?
<asarch> No
<dlowe> sigh.
<asarch> Let me paste the code..
<dlowe> in a pastebin?
cyraxjoe has quit [Ping timeout: 245 seconds]
cyraxjoe has joined #lisp
<dlowe> you kno, the let binding is malformed
<dlowe> it should be (let ((chokoreto (make-instance 'asarch:point))) (format t "Value of x-axis is: ~d~%" (slot-value chokoreto 'x))
<asarch> Yeah, my mistake
<dlowe> it should be (make-instance 'asarch:point)
<dlowe> you didn't include the error message
<asarch> Ok
atgreen has quit [Ping timeout: 250 seconds]
cyraxjoe has quit [Ping timeout: 246 seconds]
<dlowe> oh, I know what it is. Your slot name is asarch::x and you are using just x in myprog
cyraxjoe has joined #lisp
<dlowe> which probably resolves to cl-user::x if you're using it on the repl without changing the package
rippa has joined #lisp
MichaelRaskin has joined #lisp
<asarch> D'oh!
<asarch> I though (:export :point) automatically would export the slot values
cage_ has quit [Remote host closed the connection]
* asarch burns his notebook and gets a new one...
<asarch> I am still thinking CLOS classes as a single unit as with C++ classes
<asarch> THANK YOU!!
<pjb> asarch: you type H-e with the cursor in front of the defclass form.
zotan has quit [Ping timeout: 250 seconds]
<dlowe> Everything in CL is named with symbols. Symbols are always in packages.
<asarch> THANK YOU VERY MUCH dlowe!!!
<dlowe> some closer reading of the error message would have granted you this insight too
<dlowe> Symbols are always in packages except when they're not in a package.
<asarch> H-e?
<asarch> Where?
<asarch> Slime?
<pjb> asarch: with H-e bound to pjb-cl-export-definition-at-point in https://github.com/informatimago/rc/blob/master/emacs-redshank.el
* dlowe strokes his zen beard.
<pjb> asarch: H- = Hyper
<pjb> dlowe: nope. packages and symbols are named with strings, not with symbols.
<pjb> dlowe: setters are named with lists such as (setf foo).
zotan has joined #lisp
<asarch> I thought it was something a la C/C++ headers files: #include "foo.h" also #include "bar.h" which also #include "baz.h"
<pjb> asarch: what does it mean to export a value? You sound crazy…
<pjb> asarch: can you export 42 from a C++ class? or "duh!" ?
<dlowe> pjb: "string designators" but yes
<pjb> strings.
<pjb> (package-name :cl) #| --> "COMMON-LISP" |# a string!
<pjb> (symbol-name '#:foo) #| --> "FOO" |# again a string!
<dlowe> (defpackage #:foo) ; not a string!
<asarch> One stupid question: why (:use :common-lisp) and not (:use :common-lisp-user) if the latter is a super package of the first one?
<dlowe> (intern 'baz) ; also not a string!
<pjb> (intern 'baz) #| ERROR: The value baz is not of the expected type string. |#
<Xach> asarch: it is not a super package
<dlowe> whoops, haha
<asarch> ?
<pjb> dlowe: yes, defpackage accepts string designators, but it uses strings.
<pjb> asarch: the pacakge common-lisp-user doesn't export anything, usually. It's implementation dependent if it does. And its content is entirely implementation dependent.
<pjb> asarch: the firs thing you should do, is to delete the common-lisp-user package and recreate it the same in all implementations!
<asarch> Ok
atgreen has joined #lisp
pankajgodbole has quit [Ping timeout: 268 seconds]
<asarch> Which one is the preferred way, (defpackage :asarch ...) or (defpackage "asarch" ...)?
<dlowe> There's no consensus
<dlowe> I like (defpackage #:asarch)
<dlowe> You'll probably want to uppercase it in someway though
slyrus__ has quit [Quit: Leaving]
<asarch> Ok
<pjb> asarch: I use (defpackage "ASARCH" …)
<pjb> asarch: you can use (defpackage "asarch" …), but then you will have either to set (readtable-case *readtable*) or write |asarch|:foo etc.
<asarch> Oh :-(
<asarch> Can I have both the name of a class with the same name of the package?
<Xach> asarch: yes
<Xach> asarch: package names and symbol names are distinct.
<asarch> Ok
<pjb> Classes are named with symbols. Packages are named with strings.
<Xach> it is no big deal to have a symbol that prints as bob:bob
<pjb> You know a lot of symbols that are eql to strings?
<pjb> Tsk! Tsk!
<asarch> Wow!
<asarch> Ok, ok
<asarch> Let's finish this
<asarch> BTW, a moment of silence for Google+
<jdz> What is Google+?
<dlowe> please take it to #lispcafe
sauvin has quit [Ping timeout: 246 seconds]
shifty has joined #lisp
rumbler31 has joined #lisp
Josh_2 has joined #lisp
<aeth> asarch: I go with dlowe's #:foo style because visually it stands out when syntax highlighted
<aeth> (and even without, since #: is rare)
<aeth> asarch: Packages are just namespaces for symbols. They import/export/etc. symbols. Symbols themselves have multiple namespaces (this is the other namespace concept) which can be associated with things.
ebrasca has joined #lisp
<aeth> So you can have a class and a function both named FOO, whose real name is YOUR-PACKAGE:FOO (two :: instead of : if it isn't an exported symbol)
gxt has quit [Ping timeout: 268 seconds]
<Josh_2> I also use #:
<aeth> asarch: So there's no reason why you can't have FOO:FOO because those are different parts of the symbol
moei has joined #lisp
varjag has quit [Ping timeout: 246 seconds]
<aeth> asarch: The package prefix allows you to not have name collisions, and can be removed in certain cases (and usually is for CL:FOO). What that symbol in the package means depends on context, which is how you can get a variable, a function, and a type with the same name (there are others, but these three are common)
<aeth> And in case you wonder about the difference between classes and types, afaik classes are a subset of types. Types let you do things like (integer 0 42) so you can be more specific than classes
<asarch> Ok
<aeth> And now for some heresy. Properly written CL is case-insensitive, so you can ignore the upcasing by (setf *print-case* :downcase) in the REPL since the original FOO was probably upcased from foo so now you get the original foo back in errors/etc. You just have to know that some code might not obey this, such as a package mistakenly named "foo" instead of "FOO" or #:foo
<aeth> So it works 99.9% of the time, but sometimes you would have to disable it to debug properly. I usually turn it on because I macroexpand-1 all of the time
<asarch> Ok
<aeth> The only two cases I can think of where you might see lower case symbols are in hash-table keys or in people implementing another, case-sensitive language inside of CL
<asarch> I see
<aeth> You can get them by escaping, like '|foo| or '|fooBar| as well as from interning or changing the readtable's rules.
<asarch> How can you set aliases for your package?
<aeth> nicknames, but those aren't popular because they make name collisions very easy
<aeth> Some implementations have package-local-nicknames.
<asarch> COMMON-LISP-USER -> CL-USER
<asarch> ?
<aeth> asarch: defpackage has a :nicknames and COMMON-LISP-USER probably has a (:nicknames #:cl-user) in its defpackage
atgreen has quit [Ping timeout: 264 seconds]
<aeth> asarch: If you want to provide an additional nickname to it locally to you, you can use package-local-nicknames, which unfortunately doesn't seem to be complete at the moment. https://github.com/3b/package-local-nicknames
<aeth> SBCL has an implementation-specific way to do package local nicknames, and other implementations might have similar capabilities.
atgreen has joined #lisp
__jrjsmr_ has joined #lisp
momozor has joined #lisp
__jrjsmr_ has quit [Client Quit]
<momozor> hi
<Josh_2> hi
<aeth> hi
<momozor> I wanted to make a series of book for me to learn new programming concepts (design patterns, higher order functions, BDD, etc)
<momozor> in Lisp
<momozor> I'm working on SOLID OOP principles currently
<momozor> and my focus now is to make examples in Lisp (very hard to find such SOLID examples written in Lisp)
<momozor> can I get some feedbacks for this on progress mini cookbook?
<momozor> my Open/Closed principle explanations sucks really bad
<momozor> so sorry for that
<momozor> i'm going to rewrite them soon
<Xach> momozor: i generally think it is better to start from generic functions, not classes, for clos design.
<Xach> starting from classes and using arguments named "self" is a sign of writing another OOP style using CLOS, which in my view is generally a mismatch
atgreen has quit [Ping timeout: 245 seconds]
<momozor> Xach: thank you. I will consider rewriting the examples with generic functions instead. :)
<LdBeth> momozor: it is redundant to wrap around accessor because accessor itself is defined as a generic function
<aeth> What do you all use instead of self? (I haven't really seen self in CL, either, because it isn't a good name in CL methods.) Is it generally (foo foo) instead of (self foo)?
<Bike> i don't use anything "instead of" self, because i don't think in those terms.
<grewal> I usually use (foo foo)
<Bike> i just like, write what the parameter is for or does or is, like in any function
slyrus_ has joined #lisp
<momozor> LdBeth: Do you mean that for Single Responsibility topic? If yes, yeah. I realized I can just call them with (brand object) or use :reader (or to set them, use :accessor)
lemoinem has quit [Killed (verne.freenode.net (Nickname regained by services))]
lemoinem has joined #lisp
<momozor> LdBeth: but thank you :)
<aeth> Bike: I was saying "instead of" because the linked PDF has "self" all over the place
<Bike> because the author is thinking more in message passing terms, i guess.
<momozor> I'm using https://lispcookbook.github.io/cl-cookbook/clos.html this a reference
<momozor> should I uh..use obj instead?
<Bike> you should use whatever would be descriptive for the particular function you are writing
<momozor> okay. thanks!
<Bike> which is probably not "obj", since "object" says nothing specific.
<Bike> sometimes one gets lazy, though.
<Xach> sometimes an object is just an object.
<Xach> and a list is just a list.
asarch has quit [Ping timeout: 246 seconds]
<pfdietz> A sigh is just a sigh...
<aeth> I usually use object in the defgeneric, not the defmethod
<aeth> If I generate the defmethod from a macro, I use object, though
<aeth> Looks like I inconsistently sometimes use object in a defmethod if it's extremely trivial. Maybe I should do a large renaming or maybe it's not worth it.
<LdBeth> momozor: https://github.com/LdBeth/CLFSWM/blob/msg_passing/new/mul-flavors.lisp Flavor provides message passing style although it’s only for historical references
<aeth> Sometimes I use an established acronym or abbreviation e.g. (id identification)
<Xach> the fundamental things eval as funs apply
Lycurgus has quit [Quit: Exeunt]
<momozor> LdBeth: thanks! I'll check it out
scymtym has quit [Ping timeout: 268 seconds]
caltelt_ has joined #lisp
caltelt_ has quit [Remote host closed the connection]
lumm has quit [Remote host closed the connection]
lumm has joined #lisp
nowhereman has joined #lisp
atgreen has joined #lisp
vlatkoB_ has quit [Remote host closed the connection]
khrbt has joined #lisp
Jesin has quit [Quit: Leaving]
adip has quit [Ping timeout: 255 seconds]
momozor has quit [Quit: Leaving]
shka_ has quit [Ping timeout: 246 seconds]
Bike_ has joined #lisp
Bike has quit [Disconnected by services]
hugotty has quit [Quit: freenode]
Bike_ is now known as Bike
hugotty has joined #lisp
Jesin has joined #lisp
Wayfarer has joined #lisp
<Wayfarer> (greeting . "Hello")
<Josh_2> (format t "hello~%")
<Wayfarer> well now you are beyond my understanding
<Josh_2> xD
<Wayfarer> is this a good place for Rackett BSL/*SL ?
hugotty has quit [Client Quit]
<LdBeth> GG
<Wayfarer> or is #racket better?
<Josh_2> This is a Common Lisp channel
<Wayfarer> ah ok
<LdBeth> see /topic
<Josh_2> The superior language :P
hugotty has joined #lisp
<Wayfarer> thank you
Wayfarer has left #lisp [#lisp]
orivej has joined #lisp
angavrilov has quit [Remote host closed the connection]
<makomo> a couple of interesting interviews with lisp legends (not all on the topic of lisp though)
Zaab1t has quit [Quit: bye bye friends]
rdap has quit [Remote host closed the connection]
rdap has joined #lisp
rxf has quit [Ping timeout: 264 seconds]
ggole has quit [Quit: Leaving]
techquila has joined #lisp
lnostdal has quit [Ping timeout: 246 seconds]
<stylewarning> What's the fastest way to zero out a (simple-array bit (* *))?
<stylewarning> anything besides DOTIMES + [ROW-MAJOR-]AREF?
<aeth> stylewarning: I would assume replace could be the fastest way
<aeth> stylewarning: oh sorry, fill
<stylewarning> FILL works on sequences
<aeth> ah, now I see it
<aeth> If you're concerned about efficiency, then it would probably actually be more efficient to write your own aref (if possible) than to write your own fill, since the fill could potentially fill one byte at a time if optimized for bit arrays.
<Bike> i don't think there's a more efficient way than the obvious. bit arrays are missing some stuff in CL
<aeth> Bike: the issue here is that 2D arrays are missing stuff, not bit arrays
lnostdal has joined #lisp
kenu has joined #lisp
<kenu> I would like to run my system from command line
<kenu> sbcl --eval '(progn (require "ASDF") (asdf:load-system "mysystem"))'
<kenu> but above doesn't work, any suggestions how it could be done?
<MichaelRaskin> What does it say when it doesn't work?
<aeth> kenu: The easiest thing to do is to have a separate file do all of that stuff ime
<kenu> debugger invoked on a SB-INT:SIMPLE-READER-PACKAGE-ERROR in thread
<kenu> #<THREAD "main thread" RUNNING {10005385B3}>:
<kenu> Package ASDF does not exist.
<LdBeth> GG
<Xach> kenu: that is because the form must be read before any of it is evaluated.
<Xach> kenu: so the (require "ASDF") does not happen in time to read asdf:load-system.
<aeth> kenu: If you put that logic in a separate file then you can just run sbcl --non-interactive --load /some/dir/path/file-that-loads-your-system.lisp
<MichaelRaskin> You can use two different --eval
<aeth> kenu: It's a lot easier to reason about a .lisp file than arguments to a command line argument... and the file is portable, the ways to load it are specific
<aeth> s/to a command line argument/to a command/
nanoz has quit [Ping timeout: 245 seconds]
Arcaelyx has joined #lisp
<kenu> @MIchalRaskin two different --evals do the trick
<kenu> and the other thing I wonder about, I've got my system in common-lisp folder but it depends on some systems from quicklisp, at the moment I've got them quickloaded at the top of .asd file. I assume it's not the right approach as it works only once all required systems are already instaled with quicklisp
<TMA> kenu: (progn (require :asdf) (funcall (find-symbol (string :load-system) :asdf) "mysystem"))
<TMA> kenu: if the system depends on something, make the system depend on that something explicitely
<nirved> stylewarning: maybe (fill (make-array (reduce #'* (array-dimensions array)) :element-type 'bit :displaced-to array) 0)
varjag has joined #lisp
<TMA> kenu: do not hide the dependency by (ab)using the fact that .asd files are loaded as a lisp file
varjag has quit [Ping timeout: 250 seconds]
rippa has quit [Read error: Connection reset by peer]
LiamH has quit [Quit: Leaving.]
amerlyq has quit [Quit: amerlyq]
dale_ has joined #lisp
dale has quit [Disconnected by services]
dale_ is now known as dale
whartung_ has joined #lisp
benkard has joined #lisp
scymtym has joined #lisp
orivej_ has joined #lisp
irdr_ has joined #lisp
malm has joined #lisp
jxy_ has joined #lisp
lemoinem has quit [Killed (hitchcock.freenode.net (Nickname regained by services))]
moei has quit [Ping timeout: 255 seconds]
irdr has quit [Ping timeout: 255 seconds]
whartung has quit [Ping timeout: 255 seconds]
runejuhl has quit [Ping timeout: 255 seconds]
flazh has quit [Ping timeout: 255 seconds]
Ekho has quit [Ping timeout: 255 seconds]
shifty has quit [Ping timeout: 255 seconds]
random-nick has quit [Ping timeout: 255 seconds]
khisanth_ has quit [Ping timeout: 255 seconds]
aindilis has quit [Ping timeout: 255 seconds]
Demosthenex has quit [Ping timeout: 255 seconds]
buhman has quit [Ping timeout: 255 seconds]
stux|RC-only has quit [Ping timeout: 255 seconds]
DGASAU has quit [Ping timeout: 255 seconds]
APic has quit [Ping timeout: 255 seconds]
jxy has quit [Ping timeout: 255 seconds]
makomo has quit [Ping timeout: 255 seconds]
Mon_Ouie has quit [Ping timeout: 255 seconds]
whartung_ is now known as whartung
malm_ has quit [Ping timeout: 246 seconds]
datajerk has quit [Ping timeout: 246 seconds]
mulk has quit [Ping timeout: 246 seconds]
keep_learning has quit [Ping timeout: 246 seconds]
igemnace has quit [Ping timeout: 246 seconds]
CyL has quit [Ping timeout: 246 seconds]
brocco has quit [Ping timeout: 246 seconds]
mingus has quit [Ping timeout: 246 seconds]
brandonz has quit [Ping timeout: 246 seconds]
Lord_of_Life has quit [Ping timeout: 246 seconds]
fouric has quit [Ping timeout: 246 seconds]
_death has quit [Ping timeout: 246 seconds]
orivej has quit [Ping timeout: 246 seconds]
TMA has quit [Ping timeout: 246 seconds]
myrkraverk has joined #lisp
flazh has joined #lisp
buhman has joined #lisp
brandonz has joined #lisp
random-nick has joined #lisp
makomo has joined #lisp
igemnace has joined #lisp
Mon_Ouie has joined #lisp
khisanth_ has joined #lisp
benkard is now known as mulk
terpri has quit [Remote host closed the connection]
datajerk has joined #lisp
terpri_ has joined #lisp
nefercheprure has joined #lisp
nefercheprure is now known as TMA
Ukari has quit [Ping timeout: 244 seconds]
varjag has joined #lisp
scymtym has quit [Ping timeout: 245 seconds]
Lord_of_Life has joined #lisp
stux|RC-only has joined #lisp
Ekho has joined #lisp
Ukari has joined #lisp
bmansurov has joined #lisp
bmansurov has left #lisp ["Later"]
rumbler31 has quit [Remote host closed the connection]
kenu has quit [Quit: Leaving]
<Josh_2> how do I concatenate "\" to the start of a string
<Josh_2> how do I escape the escape character :O
<TMA> Josh_2: use an escape character to escape it
<Josh_2> I tried that
<Josh_2> then it just inserts two \\
<jgkamat> Josh_2: (format t "\\")
<TMA> Josh_2: the string contains one \ and no " ; however when it is printed it contains two of each of those
<Josh_2> o
<Josh_2> so its just cos its printing that way
<TMA> Josh_2: or more precisely: the printed representation suitable for being read of a string containing a lone backslash is "\\"
<Josh_2> okay well that might be an issue hmm
<Josh_2> i'll see later
trocado has joined #lisp
<TMA> Josh_2: (format t "~a ~s" "\\" "\\") ; try this
<TMA> Josh_2: or try (princ "\\") and (prin1 "\\") if you are still baffled
<Josh_2> I got it
nowhereman has quit [Ping timeout: 250 seconds]
varjag has quit [Ping timeout: 268 seconds]
random-nick has quit [Ping timeout: 250 seconds]
orivej_ has quit [Ping timeout: 245 seconds]
<Josh_2> how do I loop over a string 2 elements at time?
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 246 seconds]
_whitelogger has joined #lisp
lumm has quit [Quit: lumm]
aindilis has joined #lisp
keep_learning_M has joined #lisp
troydm has quit [Ping timeout: 245 seconds]
troydm has joined #lisp
<trocado> Josh_2: (loop :for (a b) :on (coerce "abcdefg" 'list) :do ...)
<trocado> unless there's a better way...