p_l changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | ASDF 3.3.4
ayuce has quit [Read error: Connection reset by peer]
wxie1 has quit [Ping timeout: 256 seconds]
karlosz has quit [Quit: karlosz]
karlosz has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Lycurgus has joined #lisp
gko has joined #lisp
gko has quit [Ping timeout: 264 seconds]
EvW has quit [Ping timeout: 244 seconds]
Lycurgus has quit [Quit: Exeunt]
buffergn0me has joined #lisp
karayan has joined #lisp
bitmapper has quit [Ping timeout: 264 seconds]
cg505 has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
Kundry_Wag has quit [Ping timeout: 256 seconds]
Kundry_Wag has joined #lisp
pjb has quit [Ping timeout: 244 seconds]
Kundry_Wag has quit [Ping timeout: 258 seconds]
oxum has joined #lisp
GuerrillaMonkey has joined #lisp
oxum has quit [Read error: Connection reset by peer]
gigetoo has joined #lisp
Jeanne-Kamikaze has quit [Ping timeout: 265 seconds]
cg505 has joined #lisp
Bike has quit [Quit: Lost terminal]
renzhi has joined #lisp
pjb has joined #lisp
ralt has quit [Quit: Connection closed for inactivity]
srazzaque has quit [Ping timeout: 265 seconds]
Kundry_Wag has joined #lisp
Bourne has quit [Read error: Connection reset by peer]
karlosz has quit [Quit: karlosz]
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
karlosz has joined #lisp
pjb has quit [Ping timeout: 272 seconds]
asarch has joined #lisp
hdasch has quit [Read error: Connection reset by peer]
hdasch has joined #lisp
madage has quit [Ping timeout: 240 seconds]
ebrasca has quit [Remote host closed the connection]
mono has joined #lisp
madage has joined #lisp
SGASAU has quit [Remote host closed the connection]
monok has quit [Ping timeout: 265 seconds]
SGASAU has joined #lisp
shifty has joined #lisp
karayan has quit [Ping timeout: 244 seconds]
shifty has quit [Ping timeout: 246 seconds]
pjb has joined #lisp
Bourne has joined #lisp
karlosz has quit [Read error: Connection reset by peer]
karlosz has joined #lisp
asarch_ has joined #lisp
asarch has quit [Ping timeout: 272 seconds]
GuerrillaMonkey has quit [Quit: Leaving]
karayan has joined #lisp
renzhi has quit [Ping timeout: 240 seconds]
yankM has quit [Quit: Leaving.]
Kundry_Wag has quit [Remote host closed the connection]
Lycurgus has joined #lisp
<beach> Good morning everyone!
pjb has quit [Ping timeout: 272 seconds]
shifty has joined #lisp
dddddd has quit [Ping timeout: 265 seconds]
Lycurgus has quit [Quit: Exeunt]
narimiran has joined #lisp
pjb has joined #lisp
amerlyq has joined #lisp
gravicappa has joined #lisp
Kundry_Wag has joined #lisp
Oladon has joined #lisp
Kundry_Wag has quit [Ping timeout: 240 seconds]
shifty has quit [Ping timeout: 265 seconds]
shifty has joined #lisp
duuqnd has joined #lisp
fitzsim has quit [Remote host closed the connection]
asarch_ is now known as asarch
<solrize> hey all
<beach> Hello solrize.
doesthiswork has quit [Ping timeout: 265 seconds]
duuqnd has quit [Read error: Connection reset by peer]
duuqnd has joined #lisp
Kundry_Wag has joined #lisp
PuercoPope has quit [Remote host closed the connection]
Kundry_Wag has quit [Ping timeout: 240 seconds]
shka_ has joined #lisp
duuqnd has quit [Remote host closed the connection]
duuqnd has joined #lisp
sdumi has quit [Ping timeout: 256 seconds]
sdumi has joined #lisp
Kundry_Wag has joined #lisp
sdumi has quit [Read error: Connection reset by peer]
sdumi has joined #lisp
Kundry_Wag has quit [Ping timeout: 256 seconds]
frodef`` has joined #lisp
holycow has quit [Quit: Lost terminal]
shifty has quit [Ping timeout: 265 seconds]
shifty has joined #lisp
Oladon has quit [Quit: Leaving.]
shifty has quit [Ping timeout: 265 seconds]
Bourne has quit [Read error: Connection reset by peer]
Fare has quit [Quit: Leaving]
thonkpod has quit [Ping timeout: 260 seconds]
thonkpod has joined #lisp
HDurer has quit [Remote host closed the connection]
HDurer has joined #lisp
gxt has quit [Ping timeout: 240 seconds]
asarch has quit [Quit: Leaving]
Cymew has joined #lisp
v88m has quit [Ping timeout: 260 seconds]
Bourne has joined #lisp
varjag has joined #lisp
Kundry_Wag has joined #lisp
jprajzne has joined #lisp
refpga has quit [Read error: Connection reset by peer]
Kundry_Wag has quit [Ping timeout: 264 seconds]
refpga has joined #lisp
random-nick has joined #lisp
orivej has joined #lisp
buffergn0me has quit [Ping timeout: 260 seconds]
orivej has quit [Read error: Connection reset by peer]
refpga has quit [Read error: Connection reset by peer]
orivej has joined #lisp
refpga has joined #lisp
akoana has quit [Quit: leaving]
orivej has quit [Quit: No Ping reply in 180 seconds.]
ralt has joined #lisp
orivej has joined #lisp
hiroaki_ has quit [Ping timeout: 260 seconds]
rogersm has joined #lisp
duuqnd has quit [Ping timeout: 256 seconds]
pve has joined #lisp
duuqnd has joined #lisp
libertyprime has joined #lisp
orivej_ has joined #lisp
orivej has quit [Ping timeout: 265 seconds]
shifty has joined #lisp
orivej_ has quit [Read error: Connection reset by peer]
orivej has joined #lisp
liberliver has joined #lisp
ljavorsk has joined #lisp
Inline has joined #lisp
orivej has quit [Ping timeout: 246 seconds]
ljavorsk has quit [Ping timeout: 256 seconds]
orivej has joined #lisp
Inline has quit [Client Quit]
X-Scale` has joined #lisp
X-Scale has quit [Ping timeout: 260 seconds]
X-Scale` is now known as X-Scale
jurov_ has joined #lisp
heisig has joined #lisp
jurov has quit [Ping timeout: 260 seconds]
Inoperable has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 240 seconds]
shka_ has quit [Ping timeout: 258 seconds]
Cymew has quit [Ping timeout: 260 seconds]
Cymew has joined #lisp
ayuce has joined #lisp
orivej has joined #lisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #lisp
solene has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
<solene> hello, I face an issue and I can't find a solution so here I am :) I reduced the whole thing to a few lines of code to try to figure out what's happening. when I read a file containing characters like ↓ , when I save that string into a file, sbcl adds 0x0 characters for each one found, and ecl adds 0x20 characters. I made an example easy to run here https://pastebin.com/pL0HiyGW
<p_l> aeth: Having met Shinmera, he is just that productive of a person :<
<no-defun-allowed> Could you try specifying :element-type :utf-8 in SAVE-FILE?
<solene> sure no-defun-allowed , I didn't try it, only found :external-format :utf-8 but didn't help.
<phoe> no-defun-allowed: wait a second
<phoe> :element-type :utf-8?
<phoe> :utf-8 is not an element type
<no-defun-allowed> Pardon me, :external-format.
<solene> no-defun-allowed, already tried without success
* no-defun-allowed fixes her brain's implementation of complete-symbol
<solene> I have this bug since years, I didn't notice it with ecl because spaces in an xml file wasn't an issue (but I'm not happy they are there) but when I switched to sbcl, adding 0x0 characters did break everything of course so I spotted that behavior.
<phoe> I can reproduce that
Inline has joined #lisp
<no-defun-allowed> solene: I think that FILE-LENGTH is counting the number of bytes, not characters, in the file.
<phoe> no-defun-allowed: the dumped file has an extra padding of 0x00 or 0x20.
<no-defun-allowed> But then READ-SEQUENCE reads in characters, leaving a gap at the end of the string.
<phoe> oh right!
rogersm has quit [Ping timeout: 240 seconds]
<no-defun-allowed> phoe: Compare the results of (make-string 20) on SBCL and ECL. SBCL fills it with (code-char 0), and ECL fills with spaces.
<phoe> correct
twelvemonkeys has quit [Ping timeout: 256 seconds]
<phoe> (coerce (load-file "test.txt") 'list) ;=> (#\DOWNWARDS_ARROW #\RIGHTWARDS_ARROW #\Newline #\Nul #\Nul #\Nul #\Nul)
<solene> this make sense. How to read the correct number of characters?
shifty has quit [Ping timeout: 256 seconds]
<no-defun-allowed> In this case, I would have expected FILE-LENGTH to count characters, but I think that would require decoding the file.
<phoe> solene: alexandria:read-file-into-string
<solene> I'd prefer to avoid external libraries, I use this in a 200 lines lisp program. But if this is the only way
<phoe> solene: copy it over then
cods has quit [Ping timeout: 256 seconds]
twelvemonkeys has joined #lisp
<solene> phoe, I switched to using alexandria from quicklisp. Less work and I guess I'll be able to live with this :) thank you very much phoe and no-defun-allowed
cods has joined #lisp
cods has quit [Changing host]
cods has joined #lisp
<phoe> solene: <3
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
jprajzne has quit [Client Quit]
karlosz has quit [Quit: karlosz]
jprajzne has joined #lisp
Kundry_Wag has joined #lisp
frodef``` has joined #lisp
frodef`` has quit [Ping timeout: 256 seconds]
Kundry_Wag has quit [Ping timeout: 256 seconds]
refpga has quit [Ping timeout: 260 seconds]
Lord_of_Life_ has joined #lisp
anticrisis has quit [Quit: Leaving]
Lord_of_Life has quit [Ping timeout: 272 seconds]
Lord_of_Life_ is now known as Lord_of_Life
orivej has joined #lisp
dddddd has joined #lisp
cosimone has joined #lisp
refpga has joined #lisp
<phoe> Only partially Lisp-related question: is it possible to get something equivalent to (lambda () (go :foo)) or (lambda () (return-from :bar 42)) in some of the currently-popular programming languages? We assume that these lambdas were established in suitable lexical environments within proper TAGBODY/BLOCK forms.
<phoe> I'm thinking about this since I'm currently chewing on one comment related to my book that touches this topic.
<no-defun-allowed> I usually use exceptions to imitate the latter.
libertyprime has quit [Ping timeout: 265 seconds]
<phoe> I see, so instead of invoking a function that came from the provided lexical environment, one can emulate TAGBODY/BLOCK using an try-catch form, and transfer control via throwing that exception.
<phoe> OK - thanks. (I need to wake up.)
yankM has joined #lisp
<phoe> _death: I actually started re-reading that article moments before you posted it now; it was posted recently
libertyprime has joined #lisp
<_death> another good resource is the book Lisp in Small Pieces, which has a chapter about throw/catch
duuqnd_ has joined #lisp
duuqnd has quit [Read error: Connection reset by peer]
<_death> in metacircular, the catch macro in catch/throw emulated by tagbody/go is missing a parenthesis :x
libertyprime has quit [Remote host closed the connection]
duuqnd_ is now known as duuqnd
frgo has quit [Read error: Connection reset by peer]
frgo_ has joined #lisp
sdumi has quit [Ping timeout: 272 seconds]
<jackdaniel> I've read that anything in parenthesis should be ignored
hiroaki_ has joined #lisp
<_death> since it was a closing paren, how are you still functioning?
* jackdaniel lies on the ground and does not function :(
* phoe evaluates #'jackdaniel
duuqnd has quit [Read error: Connection reset by peer]
toorevitimirp has joined #lisp
sdumi has joined #lisp
<jackdaniel> (values)
<phoe> but hey, at least you function now
<phoe> you could have signaled an error
dmiles has quit [Read error: Connection reset by peer]
<jackdaniel> do you have any return value to (p)rove that?
<adlai> ; note: type assertion too complex to check:
<adlai> ; (VALUES &OPTIONAL . #1=(NIL . #1#))
<phoe> jackdaniel: damn
<no-defun-allowed> (disassemble #'jackdaniel)
<phoe> you got me; I should have called you from within MULTIPLE-VALUE-CALL
<phoe> no-defun-allowed: hey that's rude
<flip214> or with a HANDLER-CASE and :NO-ERROR ;)
dmiles has joined #lisp
bowfin has joined #lisp
bowfin has left #lisp ["freenode is pro-censorship"]
Bike has joined #lisp
Inline has quit [Ping timeout: 272 seconds]
<flip214> but the basic question might whether jackdaniel ever terminates at all?
scymtym_ has quit [Ping timeout: 256 seconds]
<jackdaniel> speaking of terms, any volunteers for proofreading and testing the terminal access tutorial?
<jackdaniel> (from cl of course)
<ck_> sure, as long as it isn't urgent
ayuce has quit [Remote host closed the connection]
ayuce has joined #lisp
kopiyka has quit [Remote host closed the connection]
<jackdaniel> thank you, I'll let you know when I upload the draft (probably this evening)
kopiyka has joined #lisp
<phoe> jackdaniel: please ping me with it, I'll gladly review and test it
<jackdaniel> thanks, will do
scymtym has joined #lisp
milanj has joined #lisp
SAL9000 has joined #lisp
holycow has joined #lisp
pjb has quit [Ping timeout: 265 seconds]
milanj has quit [Read error: Connection reset by peer]
milanj has joined #lisp
ayuce has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #lisp
ayuce has joined #lisp
pjb has joined #lisp
holycow has quit [Quit: Lost terminal]
Inline has joined #lisp
<jdz> jackdaniel: What terminal access tutorial?
<jdz> jackdaniel: If it's about moving cursor around and switching terminal to non-canonical mode count me in.
<jdz> Besides the one ECL issue I already reported I'm having another one with receiving SIGWINCH.
Kundry_Wag has joined #lisp
<Xach> sigwinch is my favorite signal
<Xach> i use "kill -WINCH $$" about once per month to resync bash
<Xach> looking forward to lisping with it
jello_pudding has quit [Ping timeout: 260 seconds]
rogersm has joined #lisp
* adlai tried reading all of `man 1 kill`, it is worse than eating a whole page of lsd
<adlai> in case you are unfamiliar with the latter metaphor, it does not fit within a metabolic segment, and is thus slang for "way too much"
ebrasca has joined #lisp
<phoe> I kind of disbelieve that I have an urge to ask "what is a metabolic segment" in context of discussing LSD on #lisp
<phoe> but, yeah, that is what discussing POSIX does to people
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #lisp
jello_pudding has joined #lisp
<jackdaniel> jdz: please report it of course. and yes, it is about moving cursor and switching terminal to non-canonical mode
ayuce has quit [Remote host closed the connection]
ayuce has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
pmden has joined #lisp
bitmapper has joined #lisp
zooey has quit [Remote host closed the connection]
cosimone_ has joined #lisp
cosimone has quit [Read error: Connection reset by peer]
Lord_of_Life has quit [Read error: Connection reset by peer]
Lord_of_Life has joined #lisp
pjb has quit [Ping timeout: 244 seconds]
Kundry_Wag has quit [Ping timeout: 256 seconds]
Kundry_Wag has joined #lisp
<LdBeth> Good morning everyone
<beach> Hello LdBeth.
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
rogersm has quit [Ping timeout: 240 seconds]
amerlyq has quit [Quit: amerlyq]
Inoperable has joined #lisp
heisig has quit [Quit: Leaving]
rogersm has joined #lisp
frodef``` has quit [Remote host closed the connection]
gko has joined #lisp
rogersm has quit [Ping timeout: 240 seconds]
frodef``` has joined #lisp
frodef``` has quit [Remote host closed the connection]
Aurora_v_kosmose has quit [Ping timeout: 240 seconds]
EvW has joined #lisp
Aurora_v_kosmose has joined #lisp
yankM has quit [Remote host closed the connection]
theseb has joined #lisp
pjb has joined #lisp
pmden has quit [Quit: Textual IRC Client: www.textualapp.com]
theseb has quit [Client Quit]
theseb has joined #lisp
cosimone_ has quit [Remote host closed the connection]
cosimone_ has joined #lisp
patlv has joined #lisp
Inline has quit [Remote host closed the connection]
Inline has joined #lisp
refpga has quit [Ping timeout: 264 seconds]
refpga has joined #lisp
<Xach> phoe: thanks
montxero has joined #lisp
jw4 has quit [Read error: Connection reset by peer]
<phoe> Xach: no problem; let me know if I can help with this in any way
jw4 has joined #lisp
ahungry has joined #lisp
gko has quit [Remote host closed the connection]
<theseb> Is it necessary to sometimes explicitly use eval in your code? I've been racking my brain on little projects and it seems sometimes you *must* use an eval in your code?
<Bike> it's pretty rare that using eval is a good idea.
<Bike> but it's necessary if you do in fact want to evaluate code at runtime.
<Bike> overestimating how often eval is a good idea is common, though.
<theseb> Bike: i'm writing a for loop ...i can do it as a macro or function...in both cases i can't see how to get everything w/o eval
<Bike> you can write a for macro without eval.
gko has joined #lisp
<Josh_2> in the one case where I could have used eval, instead I just compiled the source code and called the function
<Bike> assuming you mean something like C for, that executes some code in a loop until a condition is met.
<theseb> Bike: i create macro that allows....(for i (3 5 6) ....) that executes ..... for i = 3, 5, 6
<Bike> you don't need eval for that.
<theseb> Bike: problem is sometimes I need to do (for i foo ...) where foo evaluates to a list
<beach> theseb: You can't have it both ways.
<Bike> You don't need eval for that either, and you should decide whether your macro evaluates the list or not.
<Bike> Having both be valid syntax is probably not going to work.
<beach> theseb: The system can't guess whether you want it evaluated or not.
<Bike> e.g., if you have (for x (get-list y z) ...), is that supposed to be a list of three elements GET-LIST, X, Z, or is it supposed to call the GET-LIST function?
<dlowe> I mean, you could decide to only evaluate when it's a symbol
<theseb> Bike: one solution is to pass in everything unevaluated.... (for 'i '(3 5 6) '...)
<theseb> Bike: but if i do that using a regular function...I need eval to actually eval the .... !!! AHHHH!!
<phoe> theseb: what is (for i (gethash x y) ...) supposed to iterate over
<Bike> (defmacro for (var list &body body) `(loop for ,var in ',list do (progn ,@body)))
<phoe> will it iterate over the symbols GETHASH, X, and Y
<Bike> or the evaluated version, (defmacro for (var list &body body) `(loop for ,var in ,list do (progn ,@body)))
<phoe> or will it iterate over the value found in hash table Y for key X
cosimone_ is now known as cosimone
<phoe> once you solve that problem, please just quote your lists and use (for i '(3 5 6) ...)
<Bike> yeah that's probably the way to go.
<phoe> since that one allows lists to be provided at run-time, not at compile-time
<phoe> not just at compile-time*
<theseb> phoe: my 1st version iterates over list elements
<Bike> that is not what phoe asked about
<Bike> the question is whether (gethash x y) is evaluated, or treated as a list of three symbols
<theseb> ah
<Bike> this is part of the semantics of your macro, and unrelated to using eval or not to implement it
<Bike> but just to emphasize, either way, you definitely don't need to use the eval function.
montxero has quit [Remote host closed the connection]
<theseb> Bike: i'm thinking i'll need to eval (gethash x y)
<theseb> Bike: err..let me me more clear
<Bike> FOR is a macro. It can just expand into code that involves evaluating the form. You don't need to call eval yourself.
<phoe> theseb: (let ((y (make-hash-table)) (x :some-key)) (setf (gethash x y) '(1 2 3 4 5)) (for i (gethash x y) (print i)))
<phoe> what is it going to produce
quazimodo has quit [Ping timeout: 260 seconds]
<theseb> Bike: i'll need to define for as a regular function so that it evaluates the arguments...hence...i would do (for 'i (gethash x y) '...)
<Bike> Why on earth would you do that
<phoe> theseb: wait why
<theseb> if i wanted the (gethash x y) evaluated first
<Bike> no?
<Bike> I already wrote out a macro definition for you, I assure you this is possible.
<jmercouris> rest assured theseb
<jmercouris> I believe in Bike
<Bike> You need the form evaluated at run time, not at macroexpansion time, which is what you'd get with eval.
<Bike> So you just have the macro expand into whatever code.
<Bike> Like with my early definition, you'd get (loop for i in (gethash x y) do (progn ...))
<Bike> earlier*
<Bike> as in, (for i (gethash x y) ...) expands to that.
<Bike> If you don't want to use LOOP, you could define it in terms of tagbody, though it might be too long for me to write as one line in chat.
<theseb> Bike: (defmacro for (var list &body body) `(loop for ,var in ,list do (progn ,@body)))
<Bike> yeah.
<phoe> see, no eval in there
<phoe> also, you *never* need eval unless you really, really need it. most of the use cases can be achieved via closures or macroexpansions
<phoe> eval usually comes into play when you need to be able to get commands from the programmer, which means that you have a REPL of some sort.
<Bike> it's also important to understand that eval doesn't know about the lexical environment it's called in, so in this case you actually cannot use eval to achieve this, given that X and Y are lexical variables.
<Josh_2> even then you can just have a ruleset instead of actually using eval
<phoe> otherwise, for purely programmatic means of processing code, you do not really ever need it.
<theseb> Bike: right
<theseb> Bike: i'm trying to figure out how your code avoided my problem...seems magical
|Pirx| has joined #lisp
<phoe> theseb: by cleanly separating macroexpansion time from evaluation time
<beach> theseb: Call macroexpand-1 on some examples and see what it does.
<theseb> phoe: is there some general principle here that the magic is in using multiple levels of macros?
<theseb> perhaps that is a design pattern i should remember
<phoe> theseb: what do you mean, multiple levels of macros
<phoe> this is just one level
<theseb> Bike's for macro called the loop macro
<Bike> it expands into a use of the loop macro.
<theseb> just wondering if that was the trick...regardless...i'll test it and think more today
<Bike> and no, like i said, you can do this using tagbody, which is a special operator rather than a macro.
<phoe> theseb: give me a moment
<TMA> theseb: the magic is that the macro you write can produce any code you could have written instead. that code might or might not contain references to other macros (or even to the same macro)
<Bike> You just need to think about what the code expanded into does, and what it evaluates.
rogersm has joined #lisp
<Bike> yeah, try writing out how you'd do (for ...) if there is no for macro, and then have the for macro expand into that kind of code.
<theseb> ok
<theseb> Bike: does your brain ever hurt trying to keep in your head which args should be quoted or not?
<theseb> that seems to be a common hang up for me
<Bike> it's honestly not as complicated as you think when you're starting out.
<theseb> ok
<Bike> and practice makes perfect and such.
<theseb> yup...just like everything else
<phoe> (defmacro for (variable value &rest body) `(block nil (let (,variable (list ,value)) (tagbody :check (when (null list) (go :exit)) :iterate (setf ,variable (pop list)) ,@body (go :check) :exit))))
<phoe> look ma, no macros
<phoe> (for i '(1 2 3 4 5) (print i)) is going to work as expected
<theseb> nice
<phoe> I'm writing a book chapter about tagbody right now so I had this handy
<TMA> phoe: except for when, setf and pop
<phoe> TMA: (defmacro for (variable value &rest body) `(block nil (let (,variable (list ,value)) (tagbody :check (if (null list) (go :exit)) :iterate (setq ,variable (first list)) (setq list (cdr list)) ,@body (go :check) :exit))))
<phoe> is it better now
<TMA> now you are true to your word
<jmercouris> Isn't IF a macro though?
<TMA> jmercouris: IIRC, cond is the macro in common lisp and if is the special operator
refpga has quit [Read error: Connection reset by peer]
<jmercouris> oh
refpga has joined #lisp
fluxwave has quit [Ping timeout: 240 seconds]
<Bike> correct.
<phoe> jmercouris: not in ANSI CL
<phoe> it could be the other way around, but someone's gotta choose
<Bike> really an implementation could do it the other way but details
<Bike> the point isn't the macros, anyway, it's that you can see that the macroexpansion does not evaluate the VARIABLE form, but does evaluate the VALUE form, based on their positions in the LET
<phoe> or, in other words, the macroexpansion doesn't really evaluate anything, but it may choose what to quote and what not to quote
<phoe> so that in the resulting macroexpansion there's stuff like 'I which, after normal evaluation, produces the symbol I
<phoe> and there might also be stuff like (GETHASH X Y) which, after normal evaluation, produces the value associated with key X in hashtable Y
<phoe> (where X and Y are normally evaluated to produce values, too)
shka_ has joined #lisp
<TMA> all the cleverness is in a complex interaction of very few simple rules
EvW has quit [Ping timeout: 260 seconds]
<phoe> the worst thing about EVAL is that it works
<phoe> therefore people who write code that abuses EVAL have little feedback from the system to fix it so it does not use EVAL
<phoe> that feedback needs to come from other people
<phoe> and that, in turn, is non-trivial unless you actually reach out to other lispers or get a good code review which implies reaching out to other lispers
<dlowe> I sped up some code by 600x by removing EVAL use
<dlowe> brought the batch job from >24 hours down to a few seconds.
<dlowe> All I had to do was to COMPILE the code and FUNCALL it instead of EVALing it
rippa has joined #lisp
<phoe> I gotta make a lisp meme sometimes that follows the greentext >learns about quote >notices that quote is the operator that allows stuff to be passed to eval >uses eval everywhere >"damn lisp is so slow"
<phoe> s/sometimes/sometime/
<jdz> It also might help to write macros without backquote templates while learning.
adlai has left #lisp ["WeeChat 1.1.1"]
<theseb> Bike: just curious about your (defmacro for (var list &body body) `(loop for ,var in ,list do (progn ,@body)))....did it *have* to be a macro....could you get away with something like (defun for (var list body) (loop for var in list do (progn ???))) and later do (for 'i '(3 4 5) '(print i)) somehow?
<Bike> No, because functions don't know about the lexical environment they are called from.
renzhi has joined #lisp
<theseb> that was fast
<dlowe> also, when functions are called, they always evaluate their arguments
<Bike> I mean I guess you could do something stupid like (loop for x in list do (eval `(let ((,var ',x)) ,body)))
<Bike> But I don't understand why you'd even want this to be a function.
<theseb> dlowe: yes...hence the quote args in (for 'i '(3 4 5) '(print i))
Aurora_v_kosmose has quit [Remote host closed the connection]
<theseb> Bike: i wanted to see if an eval was necessary ;)...and you seemed to suggest it was ;)
<Bike> Yes, if you want code to be evaluated at runtime you need to use EVAL (or COMPILE or something), like i said before
<Bike> In this case you are defining that the FOR function must actually evaluate code, so that's natural
<theseb> i agree that would be lame..
<dlowe> you could do (for (lambda (i) (print i)) '(3 4 5)) but then you've invented mapc
<Bike> You have to consider specifically what the function is supposed to do
<theseb> just trying to wrap my brain around quote, eval, etc. and when needed
<theseb> Bike: i'm not sure how you know the answers so fast...it takes me a while to reason thru all this
<jmercouris> Lots and lots of practice
<Bike> you're not the first person to come in here asking these questions
<Bike> and when i started out i made the same mistakes
Aurora_v_kosmose has joined #lisp
tankman has joined #lisp
<phoe> theseb: there is a concept of "times" in Lisp that helped me grok these really well
<phoe> read time, macroexpansion time, compilation time, execution time
EvW has joined #lisp
<jmercouris> "phases" if you wall
<jmercouris> in the lifecycle of processing a bit of text
<jmercouris> s/wall/will
<phoe> yes, they're phases; AFAIK the specification uses "time" in this context
<phoe> one comes after the other, with the exception of macroexpansion time which is usually a part of compilation time
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
<phoe> execution time, or evaluation time, comes at the very last
<phoe> and there's plenty to do in earlier times, since each of them has its own separate macro system
<phoe> which are reader macros, macros, and compiler macros
toorevitimirp has quit [Remote host closed the connection]
doesthiswork has joined #lisp
bitmapper has quit [Read error: Connection reset by peer]
bitmappe_ has joined #lisp
bitmappe_ is now known as bitmapper
bars0 has joined #lisp
gko has quit [Ping timeout: 256 seconds]
paul0 has quit [Remote host closed the connection]
paul0 has joined #lisp
shangul has joined #lisp
bars0 has quit [Quit: leaving]
efm has joined #lisp
bars0 has joined #lisp
orivej has joined #lisp
<selwyn> are there any other times?
<Shinmera> load-time
<Shinmera> though that's part of the execution time as understood by eval-when
<Shinmera> err, nevermind that, I'm a dummy
Inoperable has quit [Quit: All your buffer are belong to us!]
Inoperable has joined #lisp
Cymew has quit [Quit: Konversation terminated!]
devon has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #lisp
shifty has joined #lisp
nikita` has joined #lisp
pjb has quit [Ping timeout: 272 seconds]
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #lisp
EvW has quit [Ping timeout: 244 seconds]
ayuce has quit [Remote host closed the connection]
bars0 has quit [Quit: leaving]
bars0 has joined #lisp
bars0 has quit [Client Quit]
bars0 has joined #lisp
ayuce has joined #lisp
quazimodo has joined #lisp
keepzen has joined #lisp
shifty has quit [Ping timeout: 246 seconds]
shifty has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
bitmapper has quit []
sdumi has quit [Ping timeout: 246 seconds]
sdumi has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
tankman has quit [Quit: Leaving]
pjb has joined #lisp
renzhi has quit [Ping timeout: 265 seconds]
quazimodo has quit [Ping timeout: 264 seconds]
quazimodo has joined #lisp
theseb has quit [Quit: Leaving]
theseb has joined #lisp
<jmercouris> is it incorrect to say filename = (format nil "~a.~a" (pathname-name path-x) (pathname-type path-x)) ?
<jmercouris> better way to do that?
SomeB has joined #lisp
<jmercouris> given some path, how to get file name? #P"/opt/local/lib/libz.dylib" trying to get "libz.dylib" as as tring, so I am doing the above
<jmercouris> s/as tring/a string
<jdz> jmercouris: FILE-NAMESTRING?
<shka_> hmm
<shka_> and file-namestring as jdz said
<jmercouris> ah, yes, FILE-NAMESTRING
<jmercouris> I was searching for "path"
<jmercouris> in the CLHS so I didn't see that
jprajzne has quit [Quit: jprajzne]
<jmercouris> thank you jdz
jprajzne has joined #lisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
<jdz> You're welcome!
<_death> the standard namestring functions are basically useless.. you want a native-namestring
orivej has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
dale_ has joined #lisp
notzmv has quit [Ping timeout: 246 seconds]
dale_ is now known as dale
stoneglass has joined #lisp
IAmRasputin has joined #lisp
shifty has quit [Ping timeout: 258 seconds]
shifty has joined #lisp
scymtym_ has joined #lisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
rgherdt has joined #lisp
orivej has joined #lisp
scymtym has quit [Ping timeout: 260 seconds]
scymtym_ has quit [Ping timeout: 244 seconds]
mibr has joined #lisp
Inline has quit [Ping timeout: 256 seconds]
IAmRasputin has quit [Quit: WeeChat 2.8]
orivej has quit [Quit: No Ping reply in 180 seconds.]
refpga has quit [Remote host closed the connection]
refpga has joined #lisp
orivej has joined #lisp
<phoe> from uiop, yes
EvW1 has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
yankM has joined #lisp
orivej has quit [Ping timeout: 256 seconds]
orivej_ has joined #lisp
jprajzne has quit [Client Quit]
shifty has quit [Ping timeout: 272 seconds]
jprajzne has joined #lisp
shifty has joined #lisp
<yottabyte> I'm using https://www.cliki.net/html-encode but none of the functions listed seem to encode the space character to %20. is this perhaps the wrong library to use?
SGASAU has quit [Remote host closed the connection]
orivej has joined #lisp
<ck_> yottabyte: take a look at do-urlencode, it's in quicklisp
SGASAU has joined #lisp
orivej_ has quit [Ping timeout: 260 seconds]
<yottabyte> works, thank you boo
<Bike> when a funcallable instance is updated for a different class, does the copy of the instance passed to update-instance-for-different-class still have the funcallable instance function?
orivej has quit [Ping timeout: 246 seconds]
<phoe> Bike: I think the MOP says *nothing* about updating funcallable instances
<phoe> at least that was the situation last time we checked
orivej has joined #lisp
<Bike> i don't think it does, no
<Bike> i mean, it says you can't change-class a generic function, but that doesn't cover everything
<phoe> I don't think that u-i-f-d-c messes with the funcallable-instance-function in any way
<phoe> but then again, an implementation might as well state that changing the fin's class, for whatever reason, invalidates the previous function
<Bike> well, no, but the user method is passed a copy of the instance, and hypothetically they could call it
<phoe> oh - a copy!
<Bike> a copy.
<phoe> yes. that's a question of how a copy is implemented...
<LdBeth> It’s probably a shallow copy
<Bike> it is a shallow copy.
<phoe> no no, that's obvious
<phoe> the question is whether the fin's funcallable instance function is copied as well
<phoe> and I don't think that is specified *anywhere*
<Bike> probably not, no.
<Bike> on sbcl the instance function is not copied.
<Bike> i suppose i can do the same, then
<Bike> most likely nobody particularly gives a damn
<phoe> I could bet a few bucks that that some implementors might not even be aware that this might be a question
<phoe> it's an edge case
<Bike> i guess you could just set the instance function to be the instance. that works, right? setting the instance function to be an instance?
<phoe> which instance? the original you mean, or the copy?
<Bike> (set-funcallable-instance-function copy original)
<phoe> hmmm.
<phoe> I assume that if the function then modifies the original's slots, that's somehow accounted for by the programmer
<Bike> bonus question: how does (set-funcallable-instance-function x x) shake out
<phoe> Bike: I don't think it does
<phoe> because this means that when you funcall the instance, you then funcall the instance, which means that you funcall the instance
gaqwas has joined #lisp
<phoe> and this doesn't really end well in my mind
abel has joined #lisp
<MichaelRaskin> Does it even end (if TCO is enabled)?
<phoe> depends on the implementation
<phoe> ...I guess
lucasb has joined #lisp
<phoe> if the fin is implemented in a way where there's some sort of trampoline that jumps to the actual cl:function object, then it may jump to itself and we have an infinite loop
<LdBeth> Can we have function class subclass generic-function?
<phoe> LdBeth: it's the other way around
<phoe> generic-function is a subclass of function
<phoe> (subtypep 'generic-function 'function) ;=> try it!
<Bike> you could have function be a subclass (identical to) funcallable-standard-object, tho
<Bike> subclass of*
<Bike> i think that's how it is in sicl
Inline has joined #lisp
<phoe> Bike: f-s-o is a subclass of function
<phoe> but function is a direct subclass of T
<phoe> that's on SBCL
<LdBeth> That’s what I think how to overload functions like compile-file
<Bike> phoe: i don't think there's any rule that f-s-o is a /strict/ subclass?
<phoe> mop funcallable-standard-object
<phoe> Direct superclasses: function, standard-object
<phoe> so, directness is in there
<Bike> oh, weak
shifty has quit [Ping timeout: 256 seconds]
shangul has quit [Ping timeout: 260 seconds]
orivej has quit [Read error: Connection reset by peer]
orivej has joined #lisp
karlosz has joined #lisp
karlosz has quit [Remote host closed the connection]
karlosz has joined #lisp
refpga has quit [Read error: Connection reset by peer]
refpga has joined #lisp
keepzen has quit [Quit: Connection closed for inactivity]
milanj has quit [Quit: This computer has gone to sleep]
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #lisp
notzmv has joined #lisp
Jesin has quit [Quit: Leaving]
Jesin has joined #lisp
rogersm has quit [Quit: Leaving...]
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
zooey has joined #lisp
ebrasca has quit [Remote host closed the connection]
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
rixard_ has quit [Remote host closed the connection]
rixard has joined #lisp
<yottabyte> how do I specify query parameters in drakma? I tried to specify the :parameters but I have a GET request and it's trying to put that in the request body (which doesn't exist for GET requests)
rogersm has joined #lisp
xantoz has quit [Quit: WeeChat 2.8]
<Josh_2> :parameters is supposed to be an alist I believe
<Josh_2> oh right
<Josh_2> well I don't know am afraid
anticrisis has joined #lisp
xantoz has joined #lisp
pjb has quit [Ping timeout: 265 seconds]
<yottabyte> I've been trying to add the query parameters explicitly on the end of the uri string, but encoding them is being problematic. for example (do-urlencode:urlencode "=") => %30
<yottabyte> this is not what javascript does though. = remain =
buffergn0me has joined #lisp
FreeBirdLjj has joined #lisp
orivej has quit [Read error: Connection reset by peer]
orivej has joined #lisp
rogersm has quit []
FreeBirdLjj has quit [Ping timeout: 260 seconds]
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #lisp
efm has quit [Ping timeout: 258 seconds]
fourier has joined #lisp
pjb has joined #lisp
Bourne has quit [Ping timeout: 258 seconds]
rpg has joined #lisp
<rpg> Fare: ping?
efm has joined #lisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #lisp
lemoinem has quit [Killed (orwell.freenode.net (Nickname regained by services))]
lemoinem has joined #lisp
madage has quit [Remote host closed the connection]
madage has joined #lisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #lisp
shka_ has quit [Ping timeout: 265 seconds]
Bourne has joined #lisp
SGASAU has quit [Remote host closed the connection]
SGASAU has joined #lisp
fourier has quit [Ping timeout: 260 seconds]
lavaflow has quit [Ping timeout: 272 seconds]
narimiran has quit [Ping timeout: 256 seconds]
lavaflow has joined #lisp
zmt01 has joined #lisp
<theseb> Can someone see https://pastebin.com/tNMse6f5 ??? Trying to understand why function f emits output but not function g
SGASAU has quit [Remote host closed the connection]
<theseb> Only difference is extra parameter c
<Shinmera> no?
holycow has joined #lisp
<theseb> Shinmera: its a free country
orivej has quit [Ping timeout: 260 seconds]
orivej_ has joined #lisp
<theseb> at least for now
<Shinmera> wtf are you talking about
<theseb> Shinmera: regarding lisp or freedom?
<phoe> theseb: function G does not have any code for emitting output.
scymtym has joined #lisp
zmt00 has quit [Ping timeout: 244 seconds]
<Bike> "No, it is not the case that the only difference is the extra parameter"
<phoe> you tell LOOP that it should "do c". So it does - evaluating the variable C returns the two-element list (PRINT Z), and that's all.
<phoe> Also, what Bike said up there.
<theseb> phoe: yes but because g is a regular function...(g 'z '(5 6 7 8) '(print z)) sets i=z l=(5 6 7 8) and c = (print z)
<phoe> theseb: yes.
<Bike> you seem very confused about how evaluation works.
<theseb> phoe: yes?
<phoe> theseb: yes.
<theseb> phoe: ok i'm not crazy
<Bike> you think that if you have a variable bound to the list (PRINT 'Z), every time you read that variable it will call print?
<phoe> it's a difference between (loop ... do (print i)) and (loop ... do '(print i))
<Bike> that is not how the language works.
<phoe> one of these is a function call, the other is literal data.
<jackdaniel> lisp is very slow, especially with loops. I've started one and it still runs
<jackdaniel> (loop)
<Bike> don't we have a noob channel?
<phoe> we do! #clschool
<theseb> Bike: but l got replace with (5 6 7 8)....why didn't c also get replaced with its value?
<theseb> replaced*
<Bike> it is replaced with its value, which is a list starting with the symbol PRINT
<phoe> theseb: it got replaced with its value
<Bike> it does not evaluate that value, because why would it?
<Bike> as p hoe said, this is like writing (loop for i in l do '(print z))
<phoe> L is now bound to a four-element list and C is now bound to a two-element list
<Bike> try putting that in your repl, with some list l. observe that nothing is printed
<theseb> Bike: wait..who put the ' in front of (print z)?
<phoe> me
<Bike> you did
<Bike> (g 'z '(5 6 7 8) '(print z))
<Bike> it's like, what, the twentieth character?
<phoe> oh! yes, right
<phoe> I just moved that quote from the function call over to the loop body
<theseb> Bike: yes but BEFORE g "sees" that stuff it gets evaluated
<phoe> yes, and it produces a two-element list
<Bike> yes, '(print z) is evaluated to a list of two elements.
<phoe> and this list becomes bound to the variable C
<theseb> Bike: so far we all agree
<phoe> and then you tell your loop to (... do c)
<Bike> We really don't.
<phoe> so C is evaluated
<phoe> and produces a list of two elements
<theseb> yes (print z)
<phoe> yes
<Bike> But that list is not executed.
<Bike> Because again, why would it be.
<phoe> and so the iteration continues
<phoe> each time C is evaluated to produce a list of two elements
<phoe> and then the iteration finishes, and the function G quits
<phoe> why would anything be printed here
<theseb> Bike: CL does a "search and replace" before executing the loop....so it invokes (for z in (5 6 7 8) do (print z))
<phoe> NO
<theseb> no?
<phoe> it does not.
<theseb> ok...that's my confusion
<phoe> there is NO search and replace in Common Lisp's evaluation model
<Bike> You are seriously misunderstanding the language semantics, like I said.
akoana has joined #lisp
<phoe> otherwise, (let ((x (print 42))) (list x x x x x)) would print 42 five times.
<Bike> You could conceive of it as doing a search and replace. In that case it would replace C with '(print z).
<phoe> and, no, it only prints it once.
<Bike> So you'd get (loop for i in '(5 6 7 8) do '(print z)).
<Bike> like i said earlier.
<theseb> phoe: "search and replace" may be a newb way to describe it....it is like in math.....f(x) = x + 1....to get f(4) in your head to do a "search and replace" to get 4 + 1..then you "execute" that
<theseb> 5
<theseb> everyone's happy
<Bike> it's not completely unreasonable. But in this case you are doing the substitution incorrectly.
<phoe> ^
<phoe> you perform an additional evaluation
<phoe> and so (loop for i in '(5 6 7 8) do '(print z)) becomes (loop for i in '(5 6 7 8) do (print z))
<phoe> that's not how it works
<Bike> Substitution semantics also don't work when side effects exist, so you should try to avoid that model.
<phoe> ^
<phoe> that is the very very important point
<Bike> Actually it would be (loop for i in (5 6 7 8) do (print z)), so you'd get an illegal function call
<phoe> oh, right! if you apply that to the second variable, why do you not apply it to the first one too
devon has quit [Ping timeout: 260 seconds]
<Bike> the trick is that, when the substitution is valid, it IS evaluation. It's not evaluate and then substitute, it's just substitute.
<theseb> Bike: "It's not evaluate and then substitute, it's just substitute." <--- but i thought regular functions has to evaluate their args before anything happens..at least i think that's what SICP taught me about scheme
<Bike> Yes. That is why the substitution model is invalid.
<theseb> Bike: are you saying i'm wrong to think the args get pre-evaluated?
<Bike> No, you're wrong to think they are post-evaluated.
<Bike> You seem to think that an argument is evaluated, and then the result of that evaluation is again evaluated.
<Bike> That is not how it works.
<Bike> In your model, first '(print z) evaluates to (print z), and then (print z) is evaluated to print. That's not correct.
<Bike> evaluated to print -> i mean, it calls the print function.
<theseb> Bike: yes..the loop invocation calls the print function no?
<Bike> Have you just ignored what we've been telling you for the last twenty minutes? No, it does not. Why would it? Why on earth would everything be evaluated twice?
orivej_ has quit [Ping timeout: 264 seconds]
<theseb> Bike: i thought the loop was like a machine that evaluates what you feed it
<theseb> and we feed it (print z)
<phoe> no
<Bike> Vague and nonsensical.
<phoe> it doesn't evaluate anything
orivej has joined #lisp
<Bike> Please use the school channel or something. You are misunderstanding very basic aspects of the language.
<theseb> ok....must think some more
<phoe> it only expands itself into some code that then, upon being evaluated, performs actual iteration
<phoe> to simplify your example, (let ((i 'z) (l '(5 6 7 8)) (c '(print z))) (loop for i in l do c))
<phoe> let us forget that this doesn't compile for a moment
<theseb> ok
<theseb> that example doesn't work by the way...which i'm sure you knew already
<theseb> i just tested it ;)
<phoe> that's your example from line 7
<phoe> I just replaced the function call with variable bindings
<theseb> right
<Bike> if you've read some of SICP, you should write a basic scheme interpreter yourself and see how things are evaluated and how macroexpansion and function calls work.
<phoe> anyway, (let ((i 'z) (l '(5 6 7 8)) (c '(print z))) (loop for i in l do (progn c)))
<phoe> that'll work
<Bike> it's like a page or two of code.
<phoe> what is the value of L?
<theseb> (5 6 7 8)
<phoe> what is the value of C?
<theseb> (print z)
<phoe> what is the type of both of these values?
<theseb> lists
Bike has left #lisp [#lisp]
<phoe> good
<phoe> inside your LOOP code, you evaluate C
<theseb> phoe: your last example doesn't work either
<theseb> the one with progn
<phoe> it works for me
<phoe> it produces no output and NIL, as it should
<theseb> oh yes
<rixard> theseb: are you running a CL or Scheme interpreter?
<theseb> i meant no output
<phoe> and a compile-time warning
<phoe> theseb: no, it works
<phoe> where do you think that output is supposed to be produced?
<theseb> phoe: https://www.tutorialspoint.com/execute_lisp_online.php should print it like all the other output?
<theseb> phoe: on left?
<theseb> if i do (print "hello") it shows up on left
<phoe> yes
bitmapper has joined #lisp
<theseb> but the print in your progn does not
<phoe> and if you do '(print "hello") then it doesn't.
<theseb> right
bitmapper has quit [Client Quit]
<phoe> there's no PRINT in my PROGN
<theseb> phoe: but c = (print z)
<phoe> yes
<phoe> all I do in my progn is evaluating a variable
<phoe> what is the value of C?
<theseb> (print z)
<phoe> perfect, it's a list
<phoe> so evaluation's done
<phoe> next please
bitmapper has joined #lisp
<theseb> but evaluation will have the side effect of printing right?
<phoe> no
<theseb> NO?
<phoe> why would evaluating a variable perform printing
<phoe> we evaluate the symbol C
<theseb> yes
<phoe> and that produces some value
<phoe> and that's all
<phoe> where is printing supposed to fit in here
<theseb> phoe: i thought the loop invocation would then eval things again
<Josh_2> oof
<phoe> why would it
<phoe> no, it doesn't
<phoe> please consider (let ((i 'z) (l '(5 6 7 8)) (c '(1 2 3 4))) (loop for i in l do (progn c)))
<phoe> in which the value of C is now (1 2 3 4)
<theseb> ok
<phoe> and it is perfectly allowed to be (1 2 3 4)
<theseb> yes
<theseb> well get (progn (1 2 3 4))
<phoe> yes
<phoe> and that's an error
<theseb> right
<phoe> so your mental model of replacing stuff is broken
<phoe> where did you lose your quote
<phoe> if C is '(1 2 3 4) then why did you replace C with (1 2 3 4) without the quote
<theseb> phoe: because you said C = (1 2 3 4)
<phoe> that's the value of C
<theseb> yes
<phoe> if we want to insert literal values into code, we must quote them
<phoe> that's why the variable binding is also (let ((c '(1 2 3 4))) ...)
<phoe> I said that the *VALUE* of C is the list (1 2 3 4) because it is a result of eVALUEating '(1 2 3 4)
<theseb> yes
<theseb> phoe: here's a simpler example (defun add (x y) (+ x y))
<theseb> (print (add 10 3))
<theseb> phoe: x and y get replace with 10 and 3...
<Inline> welp, let has already an implicit progn.....
<phoe> you are using self-evaluating objects.
<phoe> 10 evaluates to 10, 3 evaluates to 3.
<theseb> yea...bad example
<phoe> the resulting values 10 and 3 get added, giving 13, and that is then printed.
<Inline> (let ((c '(1 2 3 4))) c) => (1 2 3 4)
<Inline> so it got evaled
<phoe> Inline: yes, but we were considering an example with LOOP earlier which does not have an implicit progn
<Inline> ah ok
<theseb> phoe: so your point is function arguments get evaluated and then that DATA is used without being evaluated a second time?
<Inline> so an extra progn in a let does not mean evaluating twice too.....
<phoe> theseb: YES
<Inline> just noting.....
<phoe> nowhere in the Lisp model data gets evaluated twice
<Inline> the implicit just shadows the explicit
<phoe> after their initial evaluation, values are just passed as-is.
rixard has quit [Remote host closed the connection]
<phoe> you can force Lisp values to get evaluated again by using EVAL, but that's explicitly asking the compiler to perform evaluation again.
<Inline> right
rixard has joined #lisp
<theseb> phoe: i thought when you had NESTED functions...a calls b calls c ....
<theseb> phoe: that every new level that gets the DATA but evaluate it again
<phoe> that would massively suck
<theseb> phoe: but we both agree that EVERY regular function call must eval its arguments first
<theseb> phoe: that is what was confusing me
<phoe> theseb: correct
<phoe> let's consider (+ 1 (+ 2 (+ 3 4)))
karayan has quit [Remote host closed the connection]
<theseb> phoe: so if a calls b calls c .... then every time you pass the data to a new function it has to get evaluated again
<phoe> no
<phoe> why would it
<phoe> in order to call the outermost + function, its arguments must be evaluated
<phoe> 1 evals to 1
<theseb> phoe: because the rules of function invocation say..."eval the data first and then do something with that"
<theseb> ^^^^
<phoe> yes
<theseb> and we have 3 invocations of the same data
<theseb> functions a b and c
<theseb> so EACH invocation needs do follow that rule ^^^
<theseb> (defun a (my-data) (b my-data))
<phoe> (defun a (x) (+ x 1)) (defun b (x) (+ x 2)) (defun c (x) (+ x 3))
<phoe> (a (b (c 4)))
<phoe> in order to evaluate (a (b (c 4))) we must evaluate its argument, which is (b (c 4))
<theseb> yes
<phoe> in order to evaluate (b (c 4)) we must evaluate its argument, which is (c 4)
<phoe> in order to evaluate (c 4) we must evaluate its argument, which is 4
<theseb> yes
<theseb> yes
<phoe> 4 evaluates to 4
<phoe> so we add 4 to 3 and get 7
<phoe> that 7 gets then added to 2 and we get 9
<phoe> that 9 gets then added to 1 and we get 10
<phoe> that's all
<White_Flame> (a (b (c 4)) => (a (b 7)) => (a 9) => 10
<phoe> note that 7 *DOES NOT* get evaluated anywhere
<White_Flame> this is no diffferent than any other major language
<phoe> neither is 9
karayan has joined #lisp
<phoe> and neither is 10
<theseb> i see it
<phoe> evaluation === producing a value
<phoe> once you have a value, you have it, you can operate on it
<phoe> you don't need to evaluate again because you already have a value
<theseb> yes
<phoe> so, yes, EACH function invocation needs to follow the rule of function invocation that says "eval the data first and then do something with it"
<phoe> so I just followed it on a simple addition example
<phoe> literally did what you quoted
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #lisp
<theseb> yes
<phoe> so what's the problem
<Inline> there's no multiple evaluation there
arpunk has quit [Remote host closed the connection]
<White_Flame> theseb: looking back at your original question, you're really wanting either a macro (which does composite together sexprs as literal source code at compile-time) or an inline EVAL (when the code isn't available at compile-time). Neither of these are likely what you really intend for the problem though, they are mappings of your solution to get them to work
<theseb> phoe: should this work?...i wrote a for macro that works like this (for i (3 4 5) ....)
<phoe> theseb: we've already discussed this, like, one or two days ago.
<theseb> phoe: can i wrap with a regular function...call it for-wrapper...and then do (for-wrapper 'i '(3 4 5) ...)?
mathrick has quit [Remote host closed the connection]
mathrick has joined #lisp
gravicappa has quit [Ping timeout: 256 seconds]
<theseb> phoe: i got everything you said...but a similar wrapper like ^^^ doesn't work in my lisp implementation and my brain is fried so not sure if it is a bug or my misunderstanding
ahungry has quit [Read error: Connection reset by peer]
<White_Flame> if you want to pass in functionality, the easiest way is to give it a function object, likely a LAMBDA form
<White_Flame> if you want to pass in data like a list, then it's a simple quote
buffergn0me has quit [Ping timeout: 260 seconds]
<aeth> White_Flame: while (a (b (c 4))) is no different than any other major language, a hypothetical (a (b 4) (c 4)) can often differ between languages because some are left to right, some are right to left, some are unspecified, and a few are probably some weird order.
<aeth> iirc, CL is specified to be left-to-right
<White_Flame> right, and most popular languages are left-to-right, eager evaluation
<Inline> yes but you have a reader first
<aeth> White_Flame: quite a few popular languages are unspecified order, iirc including C. Almost every language is eager. But this is getting off-topic.
<phoe> theseb: look at the body of your FOR-WRAPPER and do the evaluation steps yourself.
<Inline> it chews the full chunk
<phoe> figure out what gets evaluated to what inside your function.
<White_Flame> right,the topic is theseb's understanding as it intersects with Lisp. I don't think that esoteric evaluation semantics are involved
<phoe> White_Flame: let's assume left-to-right, that's what CL does anyway.
<White_Flame> (except for any that crop of from misunderstanding CL)
<White_Flame> *crop up
<aeth> White_Flame: right, the only important thing is that CL is eager and LTR
cracauer has quit [Ping timeout: 264 seconds]
Lord_of_Life_ has joined #lisp
mathrick has quit [Remote host closed the connection]
<aeth> (well, there might be a few other necessary points to mention, like CL does *not* copy the function arguments when you call a function.)
mathrick has joined #lisp
hdasch has quit [Ping timeout: 258 seconds]
hdasch has joined #lisp
<theseb> phoe: because for-wrapper is a regular function...the input is first evaluated....giving i = i, l = (3 4 5)
<phoe> yep
<phoe> you get lists
<phoe> you get data, not code/actions
<theseb> ok wait let me specify for-wrapper
<phoe> and that's not very impressive when you want to perform some side effects, such as printing stuffs
<theseb> (defun for-wrapper (i l c) (for i l c))
Lord_of_Life has quit [Ping timeout: 258 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<theseb> (for i (3 4 5) ...) works
<phoe> if FOR is a macro, then its macro function receives its arguments unevaluated
<theseb> (for-wrapper 'i '(3 4 5) ...)....step 1...do eval...so i = i and l = (3 4 5) and c = ...
<theseb> do the substitution..so you get (for i (3 4 5) ...) which should work
<phoe> what does (for i l c) expand into?
<theseb> because i said (for i (3 4 5) ...) works
<theseb> phoe: it expands into
<theseb> phoe: (for i (3 4 5) ...)
<phoe> wait, how can FOR expand into FOR
<theseb> (for-wrapper 'i 'l '....)
<phoe> no
<phoe> I asked
<phoe> what does (for i l c) expand into?
<phoe> I didn't ask anything about for-wrapper
<theseb> according to my lisp implementation the for macros literally gets i l and c
<theseb> macro*
<phoe> correct, that's what a macro should get
<theseb> NOT (for i (3 4 5) ...)
<phoe> I mean, as its arguments
<phoe> yes!
<phoe> macro functions get their arguments unevaluated.
<phoe> that's one of the main differences between function calls and macro calls.
<theseb> phoe: yes
<theseb> phoe: but for-wrapper i thought did the "search and replace" on the i l and c in (for i l c)
<phoe> nope, for-wrapper itself is a function. all it has is three variables that are its function arguments.
<phoe> and you get data passed to it, which are symbols and lists.
<phoe> once the macro is expanded, then it's expanded; the function is left with whatever expansion the macro produced, but it *still* gets its arguments as data.
<theseb> phoe: so if my for was a regular function the i l and c would get replaced
<theseb> ?
<Inline> how do you read defmethod forms when they are referencing globals in their respective file ?
<theseb> yes of course
<theseb> sigh
mathrick has quit [Remote host closed the connection]
<phoe> theseb: replaced, how?
<phoe> Inline: globals, do you mean variables, defvar and such?
<White_Flame> "replaced" isn't a standard term. When slicing into such specific details, it's best to use "bound", "evaluated", "referenced", etc
<Inline> yes *blah* and co +blah+
<theseb> (defun for-wrapper (i l c) (some-func i l c))
<theseb> (for-wrapper 'i '(3 4 5) '(print z))
<phoe> theseb: then SOME-FUNC will be called with the same set of values that FOR-WRAPPER was called with
<Inline> since i'm trying to read them into different files, at some point the repl barfs
<phoe> Inline: uh, normally? I don't get any errors that way
<theseb> the subsitution gives (some-func i (3 4 5) (print z))
<phoe> theseb: again, where did you lose your quotes
<White_Flame> theseb: and it would be called _at compile time_, and the results of the SOME-FUNC call would be returned as the new source code to compile & execute at runtime!
<Inline> phoe
<Inline> err wait
<phoe> Inline: can your post your code online? Also, what's the concrete error that you get?
<White_Flame> theseb: it is extremely likely that you want the intended LOOP exeucted at runtime, with runtime arguments, not at compile-time
<theseb> phoe: i think if you can just explain why it becomes (some-func 'i '(3 4 5) '(print z)) i'll be good
<theseb> phoe: if you don't mind....you've helped a lot already
<phoe> theseb: (for-wrapper 'i '(3 4 5) '(print z))
<White_Flame> it doesn't. "become" means the return value from the defmacro body
<phoe> the variable I is bound to the symbol I
<White_Flame> the macro is a source->source transformatino
<phoe> the variable L is bound to the list (3 4 5)
<phoe> the variable C is bound to the list (PRINT Z)
<phoe> and SOME-FUNC is called with these three values
<phoe> that's all
rpg has quit [Quit: Textual IRC Client: www.textualapp.com]
<phoe> there is no second evaluation step here
<theseb> Wow
<White_Flame> theseb: the "it" in "it becomes" is being missed here
<phoe> you still have a mental substitution model that implies that after each substitution you need to evaluate again
nightfly has quit [Read error: Connection reset by peer]
<theseb> that took a lot to reach that
<phoe> no, you don't, please throw that model in the nearest garbage collector.
<phoe> evaluation happens once, and that's enough.
<theseb> phoe: how can i repay you....this was really valuable
<phoe> also your model seemed to enjoy sticking literal values into code without quoting them first.
<theseb> and took a lot of time
<phoe> theseb: sooner or later, a person will come at #lisp or #clschool asking novice Lisp questions
<theseb> phoe: so to fix my mental model i need to add quotes
<phoe> you will repay me well enough by answering them to the best of your ability and fixing up your knowledge in places where you are unable to answer their questions
<theseb> ok
<phoe> ;; also, my patreon is over there, but you likely didn't mean that sort of payment
<phoe> theseb: yes, quotes should work well in that case when you're substituting function arguments.
<theseb> no really../pm your patreon
<phoe> also note that it'll break whenever you have side effects, such as printing.
pve has quit [Quit: leaving]
<phoe> as I said earlier, (let ((x (print 42))) (list x x x x x)) prints once
<phoe> but (list (print 42) (print 42) (print 42) (print 42) (print 42)) prints five times
<White_Flame> and if you're running the loop at compile-time, (defun foo () (for ..)) will run the loop once, no matter how many times you call FOO
<theseb> phoe: that one is interesting because i don't know what the "value" of (print 42) is
<theseb> so not sure what x is = to
<phoe> PRINT returns the value it printed
<theseb> ah
<phoe> so (print 42) both prints 42 and returns 42
<theseb> so x = 42
<phoe> yep
<phoe> the two returned lists will be #'equal to each other
<phoe> but your repl will have more printed output in the other case
<phoe> ;; it's shamefully convenient for print-style debugging; when you have some function call whose value you want to inspect, just wrap (foo) and get a (print (foo))
<phoe> and run your code again
<phoe> that will work as long as you don't play with multiple values, but that can also be worked around
<aeth> (defun multiple-value-print (&rest values) (format t "~{~A~^ ~}" values) (values-list values))
<aeth> (multiple-value-call #'multiple-value-print (values 1 2 3 4))
<phoe> annnnnd that's one possible workaround
buffergn0me has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
<holycow> you guys are the best
<aeth> Technically speaking, you'd probably want to make multiple-value-print a macro that can deal with values and call the function %multiple-value-print or something.
<aeth> But that's just turning my second line into a macro.
<phoe> that's trading a special operator (multiple-value-call) for a macro
<aeth> It's more consistent in the naming, since then you pretend that multiple-value-print is like m-v-c or m-v-b etc.
<aeth> Another alternative is to use a different name for the function
<phoe> I'm waiting for multiple-value-break
<phoe> so I can, like, enter the debugger with multiple values instead of just one
<aeth> phoe: Well, a multiple-value-break could wrap every argument in (progn ... (break))
<phoe> aeth: multiple-value-update-instance-for-redefined-class
<phoe> that'll be a hit
<White_Flame> this is what I use, which prints out "EXPR = values": https://pastebin.com/aA19tPLs (cleaned up a bit)
<phoe> okay, time to sleep
<phoe> good night
<White_Flame> having a bunch of plain values printed makes output that's easy to get lost in
<White_Flame> so the expr that evaluated to it helps a lot
arpunk has joined #lisp
frgo_ has quit [Remote host closed the connection]
frgo has joined #lisp
sauvin has quit [Ping timeout: 260 seconds]
Inline has quit [Ping timeout: 246 seconds]
sauvin has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
gaqwas has quit [Ping timeout: 272 seconds]
ayuce has quit [Remote host closed the connection]
random-nick has quit [Ping timeout: 265 seconds]
|Pirx| has quit [Remote host closed the connection]
libertyprime has joined #lisp
cosimone has quit [Ping timeout: 260 seconds]
slyrus__ has joined #lisp
mono has quit [Quit: Leaving]
slyrus_ has quit [Ping timeout: 265 seconds]
rgherdt has quit [Ping timeout: 265 seconds]
pierpa has joined #lisp
mathrick has joined #lisp
Oladon has joined #lisp
SAL9000 has quit [Quit: rebooting...]
shifty has joined #lisp
stoneglass has quit [Quit: stoneglass]
jprajzne has quit [Quit: jprajzne]
SAL9000 has joined #lisp
Lycurgus has joined #lisp
ADL has joined #lisp
<White_Flame> spam
<White_Flame> likely to get a bunch of clicks for youtube metrics
<jasom> is there a reason #lisp isn't +r?
<White_Flame> +r is really annoying, and only enabled when there's a real spam problem
<White_Flame> leaves a lot of people out in the dust who want to pop in and ask something
shifty has quit [Ping timeout: 258 seconds]
<pierpa> it's been enabled because there was a real spam problem