jackdaniel 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.5.4, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
CrazyEddy has quit [Remote host closed the connection]
varjag has joined #lisp
bon498883 has joined #lisp
bon498883 has left #lisp [#lisp]
varjag has quit [Ping timeout: 258 seconds]
lavaflow has joined #lisp
FreeBirdLjj has joined #lisp
EvW has joined #lisp
<Xach> seok: shadow and shadowing-import are the tools
FreeBirdLjj has quit [Ping timeout: 245 seconds]
srandon111 has joined #lisp
<srandon111> guys what's the difference between symbols and strings? i mean when do i use one or the other ?
<Bike> a symbol is basically an object you can use as a name, whereas a string is like a string in most languages, a vector of characters
lavaflow has quit [Ping timeout: 245 seconds]
<pjb> In lisp, any object can be used as a name!
<pjb> In Common Lisp, packages and symbols are named by strings.
<pjb> In Common Lisp, variables and functions are named by symbols.
CrazyEddy has joined #lisp
vms14 has quit [Quit: WeeChat 2.3]
makomo has joined #lisp
shrdlu68 has quit [Ping timeout: 248 seconds]
mrcom has quit [Read error: Connection reset by peer]
libertyprime has joined #lisp
makomo has quit [Ping timeout: 248 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
amerlyq has quit [Quit: amerlyq]
FreeBirdLjj has joined #lisp
mrcom has joined #lisp
FreeBirdLjj has quit [Ping timeout: 245 seconds]
slightlycyborg has joined #lisp
troydm has joined #lisp
srandon111 has quit [Remote host closed the connection]
dmiles has quit [Read error: Connection reset by peer]
mange has joined #lisp
t58 has quit [Quit: Night]
<alexande`> boy, its not as easy as thought, most languages seems mirroing lisp syntax it is: list() instead of (list ).... damnnnn
alexande` has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
alexanderbarbosa has joined #lisp
dmiles has joined #lisp
<alexanderbarbosa> tho, python at least has a lot of known function names :D
orivej has quit [Ping timeout: 248 seconds]
semz has quit [Ping timeout: 250 seconds]
Twinsen has joined #lisp
wxie has joined #lisp
<Twinsen> Hey, guys. I'm trying to make a macro where I input like `(mymacro "a" (...))` and it expands to `(let ((a "a")) (...))`.
<Twinsen> I made the following code:
<Twinsen> (defmacro mymacro (val &body body) `(let ((,(intern val) ,val)) ,@body))
<Twinsen> The problem is that (intern) escapes the symbol, so instead of a I have to use |a|
<Twinsen> Is there something I can do about it?
nanoz has joined #lisp
<mange> By default all your symbols are upcased (hence 'a is printed as A). In this case, (intern "a") is not upcasing (hence (intern "a") is printed as |a|). To resolve it in your macro you just have to upcase the string: (intern (string-upcase "a")) becomes A.
<Twinsen> I see
<Twinsen> I will try it, thanks
semz has joined #lisp
semz has joined #lisp
semz has quit [Changing host]
nanoz has quit [Read error: Connection reset by peer]
nanoz has joined #lisp
paul0 has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
ebrasca has joined #lisp
Alchemical has joined #lisp
torbo has joined #lisp
Twinsen has quit [Remote host closed the connection]
atgreen_ has joined #lisp
EvW has quit [Ping timeout: 264 seconds]
milanj has quit [Quit: This computer has gone to sleep]
libertyprime has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 245 seconds]
libertyprime has joined #lisp
elderK has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #lisp
mange has quit [Ping timeout: 244 seconds]
FreeBirdLjj has joined #lisp
atgreen_ has quit [Ping timeout: 245 seconds]
FreeBirdLjj has quit [Ping timeout: 245 seconds]
<beach> Good morning everyone!
<aeth> good morning beach
Inline__ has quit [Quit: Leaving]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
Bike has quit [Ping timeout: 252 seconds]
krwq has quit [Remote host closed the connection]
wxie has quit [Ping timeout: 264 seconds]
Bike has joined #lisp
dddddd has quit [Remote host closed the connection]
_whitelogger has joined #lisp
Bike has quit [Quit: Lost terminal]
<ebrasca> Good morning beach!
igemnace has quit [Ping timeout: 248 seconds]
dale has quit [Quit: My computer has gone to sleep]
SaganMan has joined #lisp
gabbiel has joined #lisp
shrdlu68 has joined #lisp
igemnace has joined #lisp
FreeBirdLjj has joined #lisp
_whitelogger has joined #lisp
FreeBirdLjj has quit [Ping timeout: 245 seconds]
torbo has quit [Remote host closed the connection]
gabbiel has quit [Remote host closed the connection]
vlatkoB has joined #lisp
mcMeowCat has joined #lisp
parjanya has quit [Ping timeout: 276 seconds]
dale has joined #lisp
shrdlu68 has quit [Quit: WeeChat 2.3]
libertyprime has quit [Quit: leaving]
ggole has joined #lisp
mcMeowCat has quit [Ping timeout: 246 seconds]
mcMeowCat has joined #lisp
Nikotiini has quit [Ping timeout: 245 seconds]
Nikotiini has joined #lisp
* vsync finally groks why CL () = NIL
frgo_ has quit [Read error: Connection reset by peer]
frgo has joined #lisp
shka_ has joined #lisp
Arcaelyx has quit [Ping timeout: 245 seconds]
_whitelogger has joined #lisp
_whitelogger has joined #lisp
seok has quit [Remote host closed the connection]
xkapastel has joined #lisp
milanj has joined #lisp
frgo has quit [Ping timeout: 248 seconds]
frgo has joined #lisp
FennecCode has quit [Quit: ERC (IRC client for Emacs 26.2)]
igemnace has quit [Quit: WeeChat 2.5]
mindthelion has quit [Ping timeout: 245 seconds]
techquila has joined #lisp
mindthelion has joined #lisp
techquila has quit [Ping timeout: 250 seconds]
dmiles has quit [Ping timeout: 245 seconds]
_whitelogger has joined #lisp
dmiles has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
pfdietz has quit [Ping timeout: 260 seconds]
<beach> vsync: As opposed to what?
<LdBeth> As opposed to system T’s binary type bool
<LdBeth> ;)
cosimone has joined #lisp
<LdBeth> It’s actually two questions, 1. Why an empty list denotes false 2. Why anything other than that denotes true
mcMeowCat has quit [Ping timeout: 246 seconds]
orivej has joined #lisp
mcMeowCat has joined #lisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life has joined #lisp
<LdBeth> For example one could define something like ø so any function applied to wrong domain returns it for example (car nil)/(cdr nil)/(/ 13 0) are all ø, and any function applied to ø returns ø.
<LdBeth> although in practice people won’t do that since exception like mechanisms are sufficient
milanj has quit [Quit: This computer has gone to sleep]
Inline has joined #lisp
count3rmeasure has joined #lisp
wxie has joined #lisp
mcMeowCat has quit [Ping timeout: 244 seconds]
mcMeowCat has joined #lisp
Posterdati has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
Frobozz has joined #lisp
nowhere_man has quit [Ping timeout: 252 seconds]
cosimone has joined #lisp
cosimone has quit [Client Quit]
dale has quit [Quit: My computer has gone to sleep]
cosimone has joined #lisp
cosimone has quit [Client Quit]
makomo has joined #lisp
Ni-chan has left #lisp ["ERC (IRC client for Emacs 25.1.1)"]
milanj has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
toorevitimirp has joined #lisp
toorevitimirp has left #lisp [#lisp]
orivej has quit [Ping timeout: 244 seconds]
hiroaki has joined #lisp
zotan has quit [Ping timeout: 245 seconds]
man213 has joined #lisp
zotan has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
varjag has joined #lisp
zotan has quit [Ping timeout: 252 seconds]
zotan has joined #lisp
zotan has quit [Ping timeout: 245 seconds]
random-nick has joined #lisp
zotan has joined #lisp
dddddd has joined #lisp
srji has joined #lisp
Ricchi has quit [Remote host closed the connection]
orivej has joined #lisp
mcMeowCat has quit [Ping timeout: 245 seconds]
mcMeowCat has joined #lisp
DataLinkDroid has quit [Quit: DataLinkDroid]
wxie has quit [Ping timeout: 276 seconds]
_whitelogger has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
_whitelogger has joined #lisp
mcMeowCat has joined #lisp
cosimone has joined #lisp
mcMeowCat has quit [Ping timeout: 245 seconds]
mcMeowCat has joined #lisp
Inline has quit [Ping timeout: 264 seconds]
cosimone has quit [Quit: WeeChat 2.4]
igemnace has joined #lisp
Bike has joined #lisp
atgreen_ has joined #lisp
man213 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
man213 has joined #lisp
man213_ has joined #lisp
Inline has joined #lisp
toorevitimirp has joined #lisp
toorevitimirp has left #lisp [#lisp]
man213 has quit [Ping timeout: 245 seconds]
man213_ is now known as man213
hiroaki has quit [Ping timeout: 248 seconds]
lnostdal has joined #lisp
orivej has joined #lisp
Frobozz has quit [Read error: Connection reset by peer]
Frobozz has joined #lisp
jansc has joined #lisp
hiroaki has joined #lisp
Kevslinger has quit [Quit: Connection closed for inactivity]
orivej has quit [Ping timeout: 258 seconds]
wxie has joined #lisp
man213 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
dgfhdfg has joined #lisp
t58 has joined #lisp
jansc has quit [Ping timeout: 245 seconds]
fitzsim has quit [Ping timeout: 244 seconds]
jansc has joined #lisp
orivej has joined #lisp
atgreen_ has quit [Ping timeout: 246 seconds]
jansc has quit [Remote host closed the connection]
jansc has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
wxie has quit [Ping timeout: 276 seconds]
orivej has joined #lisp
<pjb> LdBeth: bottom usually noted ⊥ ; but in lisp we write it as NIL.
jansc has quit [Ping timeout: 246 seconds]
<pjb> LdBeth: but it is more useful to signal errors, and to be able to handle them in place. Otherwise, you get: https://www.youtube.com/results?search_query=Computer+Says+no
amerlyq has joined #lisp
hiroaki has quit [Ping timeout: 268 seconds]
SaganMan has quit [Quit: WeeChat 1.6]
<amerlyq> Hi, can we connect to already running wild instance of CL ? Like "gdb -p $(pidof myexe)" but in Lisp world?
ebrasca has quit [Remote host closed the connection]
<amerlyq> So I could run some lisp daemon and connect to it by SLIME when I felt like it or when daemon dropped into debugger?
hiroaki has joined #lisp
<LdBeth> amerlyq: the prerequisite is you load swank into that and listen to a port when you start the lisp process
<amerlyq> LdBeth, and what if I already run it in SBCL without swank? Is there a way? Let assume I develop some weather applet flying over desktop -- and it was started by systemd on startup directly with sbcl, without swank. But now I wish to connect to it and fix something on the fly. Is it possible?
<p_l> amerlyq: unless you can still trigger something to load code into it, no
<amerlyq> hmm, I can understand that "swank not running -- no ports to connect to", but is there any other way to stop SBCL and force it to drop into REPL ?
spal has joined #lisp
<p_l> amerlyq: to drop into repl you'd need to have stdin/stdout attached which in such case you probably won't have in useful form
<p_l> but by default there's nothing built in dor that either
<amerlyq> if I attach /dev/stdin to some /tmp/myfifo -- what can I send there to drop SBCL into REPL?
<amerlyq> dropping into REPL would be actually enough -- so I could load swank manually by sending comand into the same stdin
Josh_2 has joined #lisp
<LdBeth> Probably ^C
<amerlyq> hmm, let's try it...
<amerlyq> By the way, how such situation is usually resolved -- maybe it's more appropriate to register global xorg <C-S-F12> shortcut to load swank internally in my app?
<amerlyq> Meh, it doesn't even scale :(
<LdBeth> Actually C-c won’t work unless in a shell
<LdBeth> amerlyq: try $ kill -SIGINT pid
cosimone has joined #lisp
<amerlyq> yep, SIGINT seems to works, but sbcl still tries to drop into TTY :(
<amerlyq> { sleep 5; echo ABORT; echo '(print "swank")' } | sbcl --eval '(sleep 30)' | cat
<amerlyq> kill -SIGINT $(pidof sbcl)
<amerlyq> I expected SBCL will read ABORT from stdin and execute second form, but it started reading directly tty
antepod has joined #lisp
Alchemical has left #lisp [#lisp]
<amerlyq> Another idea: is it safe to load swank from inside signal handler? I.e. if I add '(load swank)' into -SIGUSR1 signal handler to be able to issue it anytime -- will it be OK? In C/C++ doing this would be catastrophical due to special treatment of signal handler code and imposed limitations, but what about Lisp?
EvW has joined #lisp
<Xach> amerlyq: I think it would be a similar set-flag-and-act model in Lisp
<Xach> That would require some integration with your application, I think.
<Xach> Maybe it could be done in a dedicated independent thread
<amerlyq> Xarch, I have too little experience to understand how this whole thing is supposed to work. My app will continue running in one thread, then I issue SIGUSR1 and set some flag, after which second thread which waited in endless sleeping loop for that flag/condition-var will load swank. Therefore I will have still running my app and REPL to swank on another thread?
<LdBeth> amerlyq: I think it’s ok
<Xach> amerlyq: something like that.
<amerlyq> I can't wrap my head around how am I supposed to debug/iterate it afterwards from slime. It seems Lisp threading model is somewhat chaotic in my head. Is there how-to for dummies? I.e. supposed interaction session with such running app.
<pjb> amerlyq: there's no lisp threading model. So you just read the doc of pthread, and go on from there.
<Xach> Maybe give up for now and not worry about on-demand slime and just use it as most people do: with swank always loaded and running and interacting.
<Xach> After using it like that do pioneering things
<pjb> amerlyq: or just launch the swank server in a separate thread from the start.
oni-on-ion has quit [Ping timeout: 264 seconds]
<amerlyq> pjb, it's not that simple -- I mentioned I need "how-to on supposed interaction session" to understand how to abort the other thread or restart it from different entry -- after I compiled more code through swank into the running process
<pjb> amerlyq: there are two things: 1- there's the notion of compilation-unit in CL. Functions compiled in the same compilation-unit can be inlined automatically at the compiler will. To be able to replace them and the replacement to be taken into account, you need to declare them notinline. Note that you can have both an inline and a notinline declaration. notinline doesn't mean not inline.
<pjb> amerlyq: 2- of course, you cannot replace a function that is being executed, ie. which has live frames on the stack. You will have to return from it, and call it again, to call the new version. So your code needs to have a main loop that keeps calling the functions that could be replaced. (you cannot replace your main, unless you write something about it, like inform it you want to replace it, and it will call the new one explic
<pjb> )
<pjb> amerlyq: Otherwise, there's bordeaux-threads:destroy-thread, but you should avoid it, and instead set up a communication scheme between your threads, and send a message to ask politely the other thread to finish cleanly.
<amerlyq> But then what goes on when I issue C-c -- isn't current main thread is aborted "not politely" ?
<amerlyq> I suppose there is still present some flag in Lisp to drop you into debugger, where you can abort your current eval and drop into REPL
<pjb> C-c sends a SIGINT signal to the unix process. By default, unix signals are processed by the current thread (random). It is possible to set up things so that unix signals are processed on a specific thread.
<pjb> In any case, unix signals handler cannot do much things safely. Basically, just set a variable.
<pjb> So you should have a thread watching this variable, and sending commands to the other threads as required.
<pjb> If you don't do that, you will get into the debugger.
<pjb> The debugger should be able to "manage" threads.
man213 has joined #lisp
<pjb> M-x slime-list-threads
<pjb> M-x slime-thread-attach
<pjb> M-x slime-thread-debug
<pjb> etc.
man213_ has joined #lisp
<amerlyq> Ok, and what are consequences of issuing "abort" in the debugger? It won't terminate thread but must drop it into REPL. Then I will have two threads -- app and swank -- each with its own REPL. My head hurts...
<pjb> This calls a restart.
<pjb> The actual consequences depend on the code written for this restart.
<pjb> Your application has a REPL thread?
<Xach> one option is not to worry about it
man213_ has quit [Client Quit]
<pjb> Exactly.
<pjb> It all just works.
metawilm has joined #lisp
count3rmeasure has quit [Remote host closed the connection]
man213 has quit [Ping timeout: 258 seconds]
<amerlyq> OK, let simulate edition session: 1) main app entry is (main) which calls (fff) in loop; 2) second thread is running swank backend; 3) I connect to swank from slime and issue new (ggg); 4) I open slime REPL and test (ggg) interactively until I satisfied; 5) I replace (fff) with (ggg) and rename it to (fff) -- and eval in slime; 6) now (main) continues executing old (fff), but on next iteration it will call new
<amerlyq> (fff). Is it correct?
<Xach> What does your app do?
<pjb> correct.
<amerlyq> My app, simplified: (fff) each 10 minutes goes to server and fetches weather report, formats it and prints to stdout -- to be consumed by another app in pipe
<amerlyq> So I expect to connect to it, issue some changes, observe them in that another app, and cleanly disconnect
<pjb> It should work. Just be careful on what you modify, like global variables and other functions used by fff. You want to keep consistency.
<pjb> Ie. you may want to develop and debug new versions on a separate system, and use swank/slime to load the new versions at once when it's ready.
hiroaki has quit [Ping timeout: 245 seconds]
hiroaki has joined #lisp
<amerlyq> pjb, "on a separate system" is like in "defsystem" to separate packaging namespaces/etc. for global vars, or like in using completely another process?
<amerlyq> And it seems I don't understand how exactly consistency will be broken if I change global vars. Does dynamic binding actually copies value? So when I replace running function -- some will be using old dynamic var value, and some -- new?
<pjb> amerlyq: I meant, on a different computer.
<pjb> amerlyq: it is possible to do it using different packages, since this isolates a little. There are still other global resources you need to take care, but clean programs should be mostly isolated when using different packages.
<pjb> amerlyq: suppose you use an a-list to store a map in a global variable. And in version 2 you want to use a hash-table. If you (defparameter *my-map* (make-hash-table)) while developping the version 2, this will break the running version 1!
<amerlyq> oh
<pjb> amerlyq: notice that this can also occur if you load the code, since it's not necessarily done atomically.
<amerlyq> oh...
<pjb> So you may want to provide commands to "suspend" the old version, while loading the new one.
<pjb> On the other hand, if your code works only 1 minute every 10 minutes, that leaves 9 minutes to load the new version without interference, right?
<pjb> Loading files is done by evaluating one top-level form at a time (even for compiled files). So inconsistencies can occur, even if loading is fast.
notzmv has quit [Read error: Connection reset by peer]
lnostdal has quit [Ping timeout: 258 seconds]
<amerlyq> So, it's better to be safe than sorry -- so by SIGUSR1 I must set some "flag-running=false" or completely change "mode=app/swank", then wake up my main loop and drop from it into repl (multithread app) or into swank (single-thread app).
<pjb> Well, if you want security, the best would be to send a message to some thread to do the loading of the new versions at the right time. You wouldn't load the new version yourself at the slime REPL, but ask the running program to load itself its new version.
<pjb> Then the program would be able to send messages to the threads that must be suspended, or finished, and would know how to load when the running functions are completed and it can be done without interferencs.
<pjb> amerlyq: on the other hand, there are mechanisms that exist to take into account upgrades for CLOS objects. You can have a system where different versions of CLOS objects live. The CLOS objects are updated lazily, and you can write methods to help migrate old versions to new versions. cf. update-instance-for-redefined-class and update-instance-for-different-class.
<pjb> and shared-initialize vs. initialize-instance.
antepod has quit [Quit: WeeChat 2.3]
<amerlyq> Hm, but the main gist -- by introducing changes to living image I carry a risk with elusive consequences. Generally I may safely replace pure functions of any thread, but better not "play" with their entry points.
<pjb> On the other hand, if you make a mistake, (unless you use FFI) you will just end in the debugger, and you will be able to correct it.
cosimone has quit [Quit: WeeChat 2.4]
<pjb> But for long-lived processes, you will indeed have a way to structure and write code that should take into account those possibilities.
cosimone has joined #lisp
<pjb> When you write the code of a space ship, if there's a bug in the code to light a corridor, it should not break the air recycling code.
<amerlyq> :))
cosimone has quit [Client Quit]
<pjb> And even if there's a bug in the air recycling code, instead of exploding your spaceship like a vulgar Ariane 5 rocket, you should write code to handle errors and keep providing clean air.
zigpaw1 is now known as zigpaw
<pjb> If your code tells you there's 110% CO2 in the air, don't explode the rocket. Go on ensuring there's some O2!!!
mcMeowCat has quit [Read error: Connection reset by peer]
cosimone has joined #lisp
<pjb> One way to do that, is to implement each function 5 times, and make a vote on the results. If one function gives a different result than the 4 others (or breaks in the debugger), then stop using it.
<pjb> You have that in emacs for example. In emacs, there are a lot of hook that are run all the time (each key presses, or periodically). If there are bugs in those functions, it would break emacs, you couldn't even type a single character. Instead, the functions that break are just removed from the hook, and emacs can continue with a more bare functionality but you can still edit and use emacs to debug and correct your meat functio
mcMeowCat has joined #lisp
gareppa has joined #lisp
<amerlyq> pjb, great idea, and many thanks for helpful explanations! LdBeth, p_l and Xach, thanks to all of you too for maintaining discussion
lucasb has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
Arcaelyx has joined #lisp
metawilm has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ebzzry_ has joined #lisp
EvW has quit [Ping timeout: 250 seconds]
ebzzry has quit [Ping timeout: 244 seconds]
srandon111 has joined #lisp
Boubert has joined #lisp
Boubert has quit [Client Quit]
cosimone has joined #lisp
cosimone has quit [Client Quit]
cosimone has joined #lisp
metawilm has joined #lisp
Twinsen has joined #lisp
<Twinsen> Hey, guy. I'm having a problem with a macro. Have a look at these snippets. https://pastebin.com/kjKgQrLK
<Twinsen> For some reason, when I put the variable within a let, a error happens instead of the expected behaivor.
random-nick has quit [Read error: Connection reset by peer]
<Xach> Twinsen: hi
random-nick has joined #lisp
<Twinsen> Xach Hello, whats upp
<Xach> Twinsen: changing ,(jsown:val ...) to (jsown:val ,obj ,val) might do what you wish
<Twinsen> Well, it works! Do you mind explaining why?
<Xach> Twinsen: because obj and val are bits of source code at the time you are trying to use them. they are not the values the source code (eventually) evaluates to
lnostdal has joined #lisp
<Xach> so you are expanding into source code that runs at runtime
<Xach> with the other bits put into the right places
<pjb> Twinsen: use (macroexpand-1 '(only *js* "a")) and: (macroexpand-1 '(only-2 *js* "a" (format t "~A" val)))
<Twinsen> pjb: the error also happens when trying to macroexpand-1
<samebchase> /n
<pjb> Twinsen: nope, there's no error: https://pastebin.com/5US7irL8
<pjb> There's something wrong…
frgo_ has joined #lisp
frgo_ has quit [Client Quit]
<pjb> yes, I forgot the quotes.
<pjb> But then, I defined my jsown:val to return NIL. The point is that with macroexpand-1 you will see what the macro expands to, so you can check if that's what you want.
<Twinsen> For some reason, here, macroexpand and macroexpand-1 gives error instead of simply showing the expansion
<pjb> Don't forget to quote the expression to expand!
<Twinsen> Yes, i do it
<Twinsen> What I exactly want to do is this:
<Twinsen> ```
<Twinsen> `(defmacro with-jsown-vals (obj vals &body body) "Provides the passed jsown values as local variables within the scope to be used." `(let ,(mapcar #'(lambda (key) (list (intern (string-upcase key)) (jsown:val obj key))) vals) ,@body))`
<Twinsen> Oops
<Twinsen> If i run the `mapcar`out the macro, it expands like I want
<pjb> as long as jsown:val takes a symbol as obj, and a string as key, and returns some proper lisp form, it should be ok.
<pjb> Now, jsown:val must generate code, from code!
<pjb> I would call it generate-val
niceplaces has joined #lisp
<Twinsen> In the first case, the result is what I want
<Twinsen> When i insert within the macro it gives error
<pjb> Try it: (jsown:val '*js* "a")
<Twinsen> The same as before
puchacz has joined #lisp
<pjb> What result do you get?
cosimone has quit [Quit: WeeChat 2.4]
<puchacz> hey, shinmera, are you around? I am trying to figure out why lispworks compiler does not like plump / define-tag-dispatcher form
<Twinsen> Nice
<Twinsen> pjb When I use `(jsown:val '*js* "a")` I get the same error as the entire macro
<pjb> Which proves what?
<Twinsen> That *js* is not being evaluated
<Twinsen> I think
<pjb> Well, this is what happens in the macro, sure. But it proves that jsown:val doesn't take chunks of code and doesn't produce chunks of code.
<pjb> So you cannot use it in a macro to generate chunks of code from chunks of code.
<Twinsen> So it's not possible to do what I want?
<Twinsen> I basically want to abstract a common pattern I use.
<pjb> You can either write a jsown:generate-val function, or use tricks in the macro.
<pjb> In the later case, it's problematic, because you would need to have *js* bound to a value at compilation-time.
<pjb> It's better to write jsown:generate-val.
<Twinsen> Instead of `(let ((foo (jsown:val *js* "foo")) (bar (jsown:val *js* "bar")) (...)`, I want to do `(with-jsown-vals *js* ("foo" "bar") (...)`
<Twinsen> I will get a look at jsown:generate-val
<pjb> what does (jsown:val *js* "foo") return?
<pjb> Basically: (defun generate-val (obj key) `(jsown:val ,obj ,key"))
dgfhdfg has quit [Remote host closed the connection]
<Twinsen> `(jsown:val *js* "foo")` extracts the value of "foo" key.
<pjb> From what?
<Twinsen> Example: `(jsown:parse "{\"foo\": \"bar\"}")`
<Twinsen> this code will parse the json
<Twinsen> To a jsown object
<Twinsen> `(:obj ("foo" . "bar"))`
<Twinsen> So (jsown:val obj "foo") will return "bar"
puchacz has quit [Ping timeout: 245 seconds]
<pjb> The question is whether you will be able to parse this JSON at compilation time?
puchacz has joined #lisp
puchacz has quit [Ping timeout: 245 seconds]
Twinsen has quit [Ping timeout: 260 seconds]
puchacz has joined #lisp
dgfhdfg has joined #lisp
puchacz has quit [Ping timeout: 260 seconds]
zaquest has quit [Remote host closed the connection]
ebrasca has joined #lisp
niceplaces has quit [Quit: ZNC 1.7.3 - https://znc.in]
niceplaces has joined #lisp
lnostdal has quit [Ping timeout: 244 seconds]
zaquest has joined #lisp
Oladon has joined #lisp
ggole- has joined #lisp
ggole has quit [Ping timeout: 264 seconds]
masterdonx has quit [Disconnected by services]
masterdonx has joined #lisp
masterdonx has quit [Disconnected by services]
masterdonx has joined #lisp
<srandon111> guys where can i understand some examples of code flexibility that is present in lisp languages but not in other languages?
EvW1 has joined #lisp
ggole_ has joined #lisp
ggole- has quit [Ping timeout: 264 seconds]
semz has quit [Ping timeout: 264 seconds]
<beach> srandon111: Can you be more specific about what you want to know?
semz has joined #lisp
masterdonx has quit [Quit: ZNC - http://znc.in]
<beach> srandon111: Homoiconicity makes it easier to manipulate code, which makes macros safe and reasonably easy to write. Is that the kind of stuff you want to know?
<srandon111> beach, yes but more practical examples
<srandon111> i read about macros and so on, but still didn't get any practical example of code flexibility
<Josh_2> oof
<beach> srandon111: I am afraid you won't understand it in depth until you worked with it for a while.
krwq has joined #lisp
<beach> srandon111: It is like trying to explain the concept of a class to someone who knows only non-OO languages.
<beach> srandon111: What do you want this knowledge for? Your answer might influence the kind of examples that you might want.
<srandon111> beach, i just was curious about lisp languages and lots of people online are talking good things about its flexibility but still couldn't get the message
<beach> srandon111: Also, the term "lisp langauges" is not well defined, which is why this channel is dedicated to Common Lisp.
<beach> srandon111: I recommend you try to program in Common Lisp for a few years, and then you will see.
<beach> srandon111: Provided, of course, that the reason you want to know is that you want to take advantage of this additional flexibility to write better code.
<krwq> srandon111: what's the original question?
<beach> krwq: Check the logs.
<beach> krwq: <srandon111> guys where can i understand some examples of code flexibility that is present in lisp languages but not in other languages?
<Josh_2> I have a very simple macro https://plaster.tymoon.eu/view/1470#1470 that I use so I don't have to type out the with-html-output-to-string everytime and can pass whatever I want as the body arg
<Josh_2> srandon111: ^
<krwq> thanks beach, I didn't know you officially log this channel
niceplaces has quit [Quit: ZNC 1.7.3 - https://znc.in]
<beach> krwq: I don't. Shinmera does.
<krwq> beach: I meant plural, personless 'you' not sure how to say that in english
<beach> Oh, sorry.
<krwq> srandon111: do you mean like reader macros which you can define during runtime
<beach> "That this channel is logged" would be appropriate.
<Josh_2> so now because irc is logged, when I link anything on my github then people can find my irc name
<Josh_2> obviously I need more obfuscation and more random names
<beach> krwq: I don't think srandon111 means anything at this point, since srandon111 seems to know very little about Lisp.
niceplace has joined #lisp
niceplace has quit [Remote host closed the connection]
<krwq> srandon111: basically there are no limits in this language in what can be done and most of the stuff you can think of already has either support directly in the language or is added through external library
<semz> is there a straight-forward way to "alias" two symbols with different names? obviously you can do something like (setf (symbol-function new-sym) (symbol-function old-sym)) in the case of functions but that doesn't work with other things
<semz> and tbh i'm not so sure i know what i'm looking for since SYMBOL-NAME trivially can't act the same on symbols with different names
<krwq> srandon111: it's the only language which I really feel open source community and that contributions are welcome and you can talk to authors directly
niceplace has joined #lisp
<krwq> (assuming they are still alive lol)
<beach> semz: You can use a symbol macro in some situations.
<beach> clhs define-symbol-macro
<beach> clhs symbol-macrolet
<semz> that could be what i was looking for, thanks
<beach> Anytime.
metawilm has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
metawilm has joined #lisp
manualcrank has joined #lisp
ptiyoyip has joined #lisp
ptiyoyip has quit [Max SendQ exceeded]
ptiyoyip has joined #lisp
dgfhdfg has quit [Ping timeout: 248 seconds]
metawilm has quit [Remote host closed the connection]
Kevslinger has joined #lisp
gareppa has quit [Quit: Leaving]
rippa has joined #lisp
torbo has joined #lisp
nitwit has joined #lisp
xkapastel has joined #lisp
gxt has joined #lisp
jansc has joined #lisp
jansc has quit [Ping timeout: 248 seconds]
orivej has quit [Ping timeout: 245 seconds]
puchacz has joined #lisp
<beach> srandon111: Most people in your situation would not understand the essence of the examples. They would either dismiss them as solving a non-problem, or they would show how to use a non-Lisp language to get the same effect. This phenomenon has been called the "Blub paradox" by Paul Graham.
<beach> Anyway, I am off to spend time with my (admittedly small) family.
EvW1 has quit [Ping timeout: 264 seconds]
<amerlyq> when I compile lisp to exe -- how to get exe name? I.e. analogue to <arg0> of other languages
<srandon111> ok thanks beach !
<pjb> amerlyq: it's implementation specific. There may be a portability library for that.
<pjb> I do it in the generation code: https://github.com/informatimago/hw
<Xach> amerlyq: one possible option is (uiop:argv0).
<Xach> amerlyq: command-line options are not standardized but there are portability libraries
mathrick has quit [Ping timeout: 276 seconds]
wigust- has quit [Quit: ZNC 1.7.4 - https://znc.in]
Jesin has quit [Quit: Leaving]
orivej has joined #lisp
Jesin has joined #lisp
<puchacz> amerlyq: how do you compile lisp to exe?
mathrick has joined #lisp
Jesin has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
<Josh_2> you dump the image
<puchacz> yes, but I was curious in which lisp it works reliably
<puchacz> exe implies windows
<puchacz> I know you can do it in lispworks, but not sure about any open source lisps
<Josh_2> I don't know about windows but I assume it works
Jesin has joined #lisp
Oladon has quit [Quit: Leaving.]
oni-on-ion has quit [Read error: Connection reset by peer]
kajo has quit [Ping timeout: 264 seconds]
<puchacz> for example, sbcl is described as "experimental" for windows
<p_l> CCL, SBCL and ECL will all generate windows executables
<p_l> SBCL is much more at home on 64bit windows, afaik
<p_l> (CCL too, though afaik less pronounced)
<p_l> ECL will happily just work including EQL
<p_l> Corman CL works as well, as windows is its native and target platform
<puchacz> p_l: have you tried deliverying windows executables for "customers"?
mcMeowCat has quit [Ping timeout: 245 seconds]
mcMeowCat has joined #lisp
ebrasca has quit [Remote host closed the connection]
<puchacz> I found #-sbcl macro with-timeout in bordeaux-thread that creates a new guarding thread for each caller, and the guarding thread will quit only after timeout passes, no matter if the caller is over or not.
<puchacz> it causes thread number to go up and up....
<puchacz> I will think how to fix it
orivej has quit [Ping timeout: 246 seconds]
nanoz has quit [Ping timeout: 245 seconds]
<alexanderbarbosa> p_l: good to know
man213_ has joined #lisp
man213_ is now known as man213
gravicappa has joined #lisp
lnostdal has joined #lisp
pfdietz has joined #lisp
gravicappa has quit [Ping timeout: 245 seconds]
ebzzry_ has quit [Ping timeout: 258 seconds]
ebzzry_ has joined #lisp
notzmv has joined #lisp
orivej has joined #lisp
mcMeowCat has quit [Read error: Connection reset by peer]
mcMeowCat has joined #lisp
sahara3 has joined #lisp
heisig has quit [Quit: Leaving]
Lord_of_Life_ has joined #lisp
vlatkoB has quit [Remote host closed the connection]
dpl has joined #lisp
Lord_of_Life has quit [Ping timeout: 244 seconds]
Lord_of_Life_ is now known as Lord_of_Life
sindan has quit [Ping timeout: 248 seconds]
dpl has quit [Read error: Connection reset by peer]
cosimone has joined #lisp
dpl has joined #lisp
ebrasca has joined #lisp
shka_ has quit [Ping timeout: 244 seconds]
mcMeowCat has quit [Read error: Connection reset by peer]
sindan has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
Frobozz has quit [Remote host closed the connection]
Frobozz has joined #lisp
Oladon has joined #lisp
cosimone has joined #lisp
mcMeowCat has joined #lisp
cosimone has quit [Client Quit]
cosimone has joined #lisp
zigpaw has quit [Remote host closed the connection]
zigpaw has joined #lisp
techquila has joined #lisp
ptiyoyip has quit [Remote host closed the connection]
mindthelion has quit [Read error: Connection reset by peer]
ptiyoyip has joined #lisp
ptiyoyip has quit [Max SendQ exceeded]
ptiyoyip has joined #lisp
ptiyoyip has quit [Client Quit]
cosimone has quit [Quit: WeeChat 2.4]
sahara3 has left #lisp [#lisp]
ggole_ has quit [Quit: Leaving]
cosimone has joined #lisp
corvidzz has joined #lisp
corvidzz has quit [Client Quit]
corvidzz has joined #lisp
Ricchi has joined #lisp
corvidzz has quit [Client Quit]
puchacz has quit [Quit: Konversation terminated!]
<aeth> re "SBCL is much more at home on 64bit windows"... I wouldn't use 32-bit x86 on any CL implementation that also has x86-64, on any OS. Even if it got equal attention (and it probably doesn't) it has a lot more limitations that you don't really notice in something like C that doesn't have boxing.
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
milanj has joined #lisp
ebrasca has quit [Remote host closed the connection]
mcMeowCat has quit [Ping timeout: 245 seconds]
mcMeowCat has joined #lisp
kajo has joined #lisp
man213 has quit [Ping timeout: 258 seconds]
Boubert has joined #lisp
Boubert has quit [Quit: Mutter: www.mutterirc.com]
ptiyoyip has joined #lisp
kajo has quit [Ping timeout: 264 seconds]
kajo has joined #lisp
alexanderbarbosa has quit [Read error: Connection reset by peer]
mindthelion has joined #lisp
techquila has quit [Ping timeout: 248 seconds]
ltriant has joined #lisp
Ricchi has quit [Read error: Connection reset by peer]
Ricchi has joined #lisp
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.2)]
mcMeowCat has quit [Ping timeout: 268 seconds]
mcMeowCat has joined #lisp
mcMeowCat has quit [Ping timeout: 258 seconds]
oni-on-ion has joined #lisp
srandon111 has quit [Remote host closed the connection]
dpl has quit [Ping timeout: 246 seconds]
kajo has quit [Ping timeout: 252 seconds]
kajo has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
cosimone has joined #lisp
cosimone has quit [Client Quit]
ryufghj has joined #lisp
ryufghj has quit [Max SendQ exceeded]
ryufghj has joined #lisp
ryufghj has quit [Client Quit]
ptiyoyip has quit [Ping timeout: 245 seconds]
slightlycyborg has quit [Ping timeout: 258 seconds]
<aeth> Are there any issues with using threads in macros?
<aeth> Instead of at runtime...
Ricchi has quit [Read error: Connection reset by peer]
Ricchi has joined #lisp
nowhere_man has joined #lisp
<aeth> I was thinking that a lot of elaborate macros are just very parallel things that could probably speed up compilation greatly without actually having true parallel compilation or parallel ASDF just by parallelizing those macros.
random-nick has quit [Ping timeout: 246 seconds]
amerlyq has quit [Quit: amerlyq]
<pjb> aeth: of course, you can do whatever you want.
mindCrime has joined #lisp
mindCrime_ has joined #lisp
dmiles has quit [Read error: Connection reset by peer]
<aeth> pjb: Technically, since threads aren't in the standard, they might be an edge case that's not supported for whatever reason
<pjb> That's your problem. You're asking a silly question, you get a silly answer: https://pastebin.com/LWfjZ9vP
mindCrime has quit [Ping timeout: 276 seconds]
<pjb> ql:quickload is not in the standard either. Who said compilation had to be conforming?
X-Scale has joined #lisp
<pjb> aeth: Now, try to guess the overhead of make-thread and join-thread…
<aeth> I was just wondering if I'd get issues with in-use implementations using BT (directly or indirectly) in macros.
<aeth> since with threads you can't just test it and find out
<pjb> The only problem I can see, is that since the compiler of the implementation may be using threads, you might overflow the maximum number of threads…
<pjb> ulimit -a|grep user --> max user processes (-u) 2837
<aeth> pjb: There are three different threads that might be at use... the compiler, the build system (e.g. poiu, except threaded instead of process-based), and the libraries doing fancy things with parallel functions in read/load/macro/etc. time.
<pjb> But let's say it's true for any program using threads…
<pjb> aeth: And imagine reader macros using threads to parse strange things, and using AI to infer smart things!
t58 has quit [Quit: Night]
<pjb> Just do it!
<aeth> If parallel compilers/builds/macros were more common, it might be useful to have some de facto standard so they can tell how many threads something is using
<aeth> e.g. "this macro uses threads, don't parallelize it"
<aeth> some fancy scheduling could optimize a parallel build
<aeth> It looks like it should be a priority to me because we're entering a world of 8-64 core desktops.
<aeth> And when AMD's pricing a 12-core around the price of an Intel 8-core, I'll choose 50% faster compilations over 5% faster games.
<pjb> aeth: stop being silly, and answer my question!
<pjb> What is the overhead of make-thread and join-thread?
<aeth> pjb: isn't that implementation-specific?
<pjb> Most implementations just call pthread.
<pjb> The one with green threads is not used anymore (cmucl).
<aeth> pjb: I'm guessing, though, that if you were really going to have a lot of parallel macros, you'd do something like lparallel does (or just use lparallel) and have a pool of worker threads created early and reused.
<pjb> aeth: find ONE complex macro!!!
<pjb> (or reader macro, even).
<aeth> with-c++-syntax would be even more complicated!
<aeth> I'm sure there's something out there that would benefit greatly from parallelism, probably one that's embedding a language
mindCrime_ has quit [Ping timeout: 258 seconds]
<pjb> ok, so now, find ONE program using C++ templates that you can expand in parallel in ONE lisp program!
<pjb> aeth: no, there's nothing.
<aeth> pjb: well, as far as templates go, all I know about is https://github.com/markcox80/template-function/
<aeth> I wonder if that's slow enough and parallel enough to benefit from BT...
<pjb> Because if you had code that would justify parallelizing a macro, then you would have to rewrite it so that you wouldn't have to parallelize the macro anymore, because that code would now be generated instead.
<aeth> I've never used it because it looks hard
<pjb> In the time you fork threads and join them, you could easily process tens of thousands of accessors in my macro!
<pjb> Ie. more than the default available number of threads!!!
<pjb> Said otherwise, you're looking at too fine-grained parallelization here.
<pjb> The code is not a parallel structure, so it's silly to try to parallelize its processing by-hand, and doing automatically will require low-level and global tools.
<aeth> pjb: What about a macro that creates and instantiates a large, elaborate array at macro-expansion-time (which is then simply loaded later), splitting the instantiation into n threads for n regions of the array based on the available cores?
<pjb> Find me ONE of them in ~/quicklisp!
<pjb> That doesn't exist in practice. It's purely theorical.
<pjb> So see my paste for the theoric fun.
<pjb> ie. Just do It! if you want the fun.
<aeth> pjb: It's not purely theoretical, large numeric arrays could be useful for e.g. Project Euler.
<pjb> You let me have the fun instead of you. You lost!
<pjb> Project Euler is purely theorical. That kind of code never occurs in real application, the ones all the users install on all their computers and renders a language popular.
Boubert has joined #lisp
<aeth> pjb: Well, I would say computer graphics, but you can't really do fancy stuff like putting your assets into a FASL because then I don't think you can get it into OpenGL without copying, which kind of defeats the point.
<aeth> And that's where most gigantic arrays will be
<pjb> I'm waiting you to code the lisp macro that will watch thru the camera the programmers specifing the program he wants, and generating the corresponding code…
<pjb> (defun main () (do-what-the-programmer-says))
lucasb has quit [Quit: Connection closed for inactivity]
Boubert has left #lisp [#lisp]
<aeth> pjb: plenty of programs do what the programmer says... what you want is a macro that does what the programmer *means*
nowhere_man has quit [Ping timeout: 252 seconds]
nowhereman has joined #lisp
<pjb> aeth: I can wait for version 2. Start with the body language and NLP analysis…