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
libertyprime has quit [Ping timeout: 246 seconds]
wigust- has joined #lisp
wigust has quit [Ping timeout: 246 seconds]
EvW has joined #lisp
arduo has quit [Ping timeout: 245 seconds]
Kundry_Wag has joined #lisp
q-u-a-n22 has joined #lisp
q-u-a-n2 has quit [Ping timeout: 264 seconds]
Oladon has joined #lisp
libertyprime has joined #lisp
eschulte has joined #lisp
eschulte has quit [Ping timeout: 248 seconds]
jgodbout has joined #lisp
red-dot has joined #lisp
elderK has joined #lisp
EvW has quit [Ping timeout: 264 seconds]
semz has quit [Ping timeout: 264 seconds]
zulu-inuoe has joined #lisp
<aeth> Damn, I'd strongly consider adding joke ads to trivial-left-pad to keep the parody fresh, but now that it's actually in Quicklisp, that could actually cause an actual controversy.
semz has joined #lisp
semz has quit [Changing host]
semz has joined #lisp
<jgodbout> The maximum allowed length is10,000,000."
<jgodbout> heresy
aoeu256 has quit [Ping timeout: 245 seconds]
akoana has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
akoana has left #lisp [#lisp]
sonologico has quit [Remote host closed the connection]
sonologico has joined #lisp
thawes has quit [Remote host closed the connection]
aoeu256 has joined #lisp
nullman has quit [Ping timeout: 258 seconds]
nullman has joined #lisp
khisanth_ has quit [Ping timeout: 245 seconds]
<no-defun-allowed> Using the MOP, how could I add some "hidden" slots to every instance of a class which is of a metaclass I created?
torbo has joined #lisp
<Bike> no-defun-allowed: why not just using the regular superclassing?
<no-defun-allowed> Bike: I'm trying to make my own "object" system work with CLOS, similar to json-mop.
<no-defun-allowed> Objects have some attributes like signatures that I want to include with them.
<no-defun-allowed> My guess is I should write a method for closer-mop:compute-slots that appends slots for those to the results of the next method?
khisanth_ has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
libertyprime has quit [Ping timeout: 258 seconds]
Kundry_Wag has joined #lisp
permagreen has joined #lisp
Kundry_Wag has quit [Ping timeout: 244 seconds]
superkumasan has quit [Ping timeout: 244 seconds]
mbrumlow has quit [Ping timeout: 244 seconds]
libertyprime has joined #lisp
nowhere_man has quit [Ping timeout: 276 seconds]
mbrumlow has joined #lisp
abhixec has joined #lisp
maxxcan has joined #lisp
maxxcan has quit [Client Quit]
mbrumlow has quit [Ping timeout: 272 seconds]
scymtym has quit [Ping timeout: 244 seconds]
<beach> Good morning everyone!
mbrumlow has joined #lisp
aoeu256 has quit [Ping timeout: 268 seconds]
Kundry_Wag has joined #lisp
jgodbout has quit [Ping timeout: 272 seconds]
Kundry_Wag has quit [Ping timeout: 272 seconds]
<LdBeth> Hello beach
aoeu256 has joined #lisp
torbo has quit [Remote host closed the connection]
aoeu256 has quit [Ping timeout: 258 seconds]
Ricchi has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Read error: Connection reset by peer]
Kundry_Wag has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
gioyik has joined #lisp
shrdlu68 has quit [Ping timeout: 268 seconds]
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Read error: Connection reset by peer]
Kundry_Wag has joined #lisp
gravicappa has joined #lisp
matzy_ has joined #lisp
alexanderbarbosa has quit [Read error: Connection reset by peer]
eschulte has joined #lisp
<no-defun-allowed> Hmm, then if I'm adding in slot-effective-definitions like that, I should probably add the class too.
alexanderbarbosa has joined #lisp
trocado has quit [Ping timeout: 245 seconds]
eschulte has quit [Ping timeout: 245 seconds]
<matzy_> i have a question: where does this command install libraries to (on linux)? (asdf:system-relative-pathname "tecgraf-libs" "libs/")
<beach> I don't think that form installs anything.
<no-defun-allowed> It doesn't install anything.
<no-defun-allowed> That will just return the pathname of the directory libs/ in the system's directory, which *might* be something like #p"/home/no-defun-allowed/quicklisp/software/tecgraf-libs/libs/"
<matzy_> so then would this command add the library then? (pushnew (asdf:system-relative-pathname :tecgraf-libs #p"libs/") cffi:*foreign-library-directories*)
<no-defun-allowed> I think it'd tell CFFI where to look for C libraries, but it wouldn't install anything.
<matzy_> assuming cffi has already been leaded
shrdlu68 has joined #lisp
<matzy_> i'm confused, because i'm following the instructions on here, except his package is no longer on quicklisp so i had to install it locally. other than that i've done exactly what he says, but when i try to do (ql:quickload "iup") it says the package doesn't exist, and I have no idea where to go from here
<matzy_> i was trying to make this my first CL project beyond simple CLI stuff, wanted to use the IUP graphics library
Bike has quit [Quit: Lost terminal]
<no-defun-allowed> It might be easier to try something like McCLIM, Ltk or Qtools which respectively have no FFI trickery, minimal trickery, or has it all hidden under the rug, and are all still maintained.
<matzy_> yeah i was thinking that, but i'm also working on IUP, adding additional backends. so i thought this would be a good chance to actually use the library i've been contributing to for the past year
ted_wroclaw has joined #lisp
<LdBeth> So if you want to use a local system try not use ql:quickload but use asdf:load-system
<LdBeth> Assume other dependencies have been fetch and loaded by Quicklisp
FreeBirdLjj has joined #lisp
manualcrank has joined #lisp
FreeBirdLjj has quit [Ping timeout: 245 seconds]
Kundry_Wag has quit [Remote host closed the connection]
<matzy_> LdBeth so do i need to run that from the directory it's installed in?
Kundry_Wag has joined #lisp
<matzy_> the asdf command i mean
<LdBeth> Well you’d read the document of asdf to figure out how it works
<matzy_> i did try, but there were tons of sections and i dont quite know what i'm looking for to navigate through it
<matzy_> like where does quicklisp setup your asdf system?
<matzy_> is it just quicklist/local-projects ?
<matzy_> *quicklisp
Kundry_Wag has quit [Ping timeout: 245 seconds]
<matzy_> and asdf should be automatically able to pull from there?
dddddd has quit [Remote host closed the connection]
<aeth> Xach: Does quicklisp have a policy on build system advertisements which are apparently now a thing?
Oladon1 has joined #lisp
<no-defun-allowed> Also, is there a limit on the longest system name admissible to Quicklisp?
Oladon has quit [Ping timeout: 245 seconds]
<no-defun-allowed> I think aeth should call their Markdown implementation #.(concatenate 'string "cl-mark" (lyrics-to (find-song "I'm Not Down" "The Clash"))) still.
manualcrank has quit [Quit: WeeChat 1.9.1]
Oladon1 has quit [Quit: Leaving.]
libertyprime has quit [Quit: leaving]
SaganMan has joined #lisp
q-u-a-n2 has joined #lisp
q-u-a-n22 has quit [Ping timeout: 245 seconds]
Necktwi has quit [Ping timeout: 272 seconds]
ggole has joined #lisp
vlatkoB has joined #lisp
elderK has quit [Quit: WeeChat 1.9]
<matzy_> can someone help me understand what command i need to run to fit this requirement? "*NOTE:* For SBCL, you need to set a larger heap size to compile the bindings, e.g. --dynamic-space-size 2048"
elderK has joined #lisp
shrdlu68 has quit [Ping timeout: 272 seconds]
nanoz has joined #lisp
shrdlu68 has joined #lisp
ted_wroclaw has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<no-defun-allowed> Start sbcl using the command `sbcl --dynamic-space-size <N>` where <N> is the number of megabytes you're willing to give it.
<no-defun-allowed> You may want to put it in ~/.emacs so SLIME starts SBCL like that: (setq inferior-lisp-program "sbcl --dynamic-space-size <N>")
dale has quit [Quit: My computer has gone to sleep]
<no-defun-allowed> ...or try it once: C-u M-x slime RET sbcl --dynamic-space-size <N> RET
<matzy_> thanks!
<pjb> matzy_: what do you mean by "installed locally"?
<pjb> matzy_: did you install it in ~/quicklisp/local-projects/ ?
<pjb> matzy_: this is where you must install it if you want to be able to ql:quickload it.
<matzy_> pjb yes that is where i installed it, just like they instructed in the repo
<matzy_> and i can do (ql:quickload "tecgraf-libs") and it works just fine once i cloned the library locally into that folder
<pjb> Good.
<matzy_> then on this repo (the companion) i did what it says under "To tell CFFI to find these libraries, use:"
<matzy_> the command he provides to run results in: (#P"/home/matzy/quicklisp/local-projects/tecgraf-libs/libs/")
<matzy_> so that seems right too
<matzy_> but after all that, i can't do (ql:quickload "iup") or (asdf:load-system 'iup)
gioyik has quit [Quit: WeeChat 2.5]
<matzy_> both say system not found
ravenous_ has joined #lisp
ravenous_ has quit [Client Quit]
<pjb> There are some circumstances where quicklisp doesn't take into account new systems immediately. You can use: (ql:register-local-projects) then try again
<pjb> Did you install uip too? (probe-file #P"/home/matzy/quicklisp/local-projects/lispnik/uip/uip.asd")
<matzy_> no i didnt do that
<matzy_> maybe that's my issue
<pjb> cd ~/quicklisp/local-projects/ ; mkdir lispnik ; cd lispnik ; git clone git@github.com:lispnik/iup.git
<pjb> probably.
manualcrank has joined #lisp
<matzy_> whats with the lispnik folder?
<pjb> keep local-projects tidy.
<matzy_> it already made a folder in local-projects called "tecgraf-libs", should i not use that one?
<pjb> matzy_: you could request adding lispnik/iup to the ultralisp distribution. https://ultralisp.org
<pjb> matzy_: if you want. Organize things your way.
<pjb> tecgraf-libs is another project by lispnik…
<matzy_> ah ok i see. one more question - before i install iup like you suggested, what about his from the guide? "NOTE:* For SBCL, you need to set a larger heap size to compile the bindings, e.g. --dynamic-space-size 2048" do i need to run that first?
<pjb> Yes, if you use sbcl.
<matzy_> i do
<matzy_> so im fine cloning iup to a separate folder than the tecgraf-libs library
<no-defun-allowed> Bike: thanks for the idea of using a class to hold all the slots, realised json-mop just conses a class on the class precedence list to do something like what I want
manualcrank has quit [Quit: WeeChat 1.9.1]
_jrjsmrtn has joined #lisp
__jrjsmrtn__ has quit [Ping timeout: 258 seconds]
sigjuice has quit [Ping timeout: 244 seconds]
t3hyoshi has quit [Ping timeout: 244 seconds]
stux|RC-- has joined #lisp
t3hyoshi has joined #lisp
payphone has quit [Ping timeout: 248 seconds]
mbrumlow has quit [Ping timeout: 276 seconds]
kini has quit [Read error: Connection reset by peer]
voldial has quit [Ping timeout: 244 seconds]
payphone has joined #lisp
stux|RC-only has quit [Ping timeout: 244 seconds]
sigjuice has joined #lisp
voldial has joined #lisp
kini has joined #lisp
<matzy_> OMG FINALLY. THANK YOU pjb!!!!!!
ravenous_ has joined #lisp
mbrumlow has joined #lisp
nullniverse has quit [Ping timeout: 276 seconds]
knicklux has joined #lisp
milanj has joined #lisp
orivej has joined #lisp
nullniverse has joined #lisp
nullniverse has quit [Changing host]
nullniverse has joined #lisp
asdf_asdf_asdf has joined #lisp
libertyprime has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
random-nick has joined #lisp
Lord_of_Life_ has joined #lisp
nullniverse has quit [Ping timeout: 252 seconds]
Lord_of_Life has quit [Ping timeout: 268 seconds]
zaquest has quit [Ping timeout: 244 seconds]
Lord_of_Life_ is now known as Lord_of_Life
funnel has quit [Ping timeout: 246 seconds]
funnel has joined #lisp
rubik has left #lisp ["WeeChat 1.4"]
matzy_ has quit [Remote host closed the connection]
makomo_ has joined #lisp
milanj has joined #lisp
risto has joined #lisp
varjag has joined #lisp
maxxcan has joined #lisp
maxxcan has quit [Remote host closed the connection]
xuxuru has joined #lisp
xuxuru has quit [Client Quit]
ted_wroclaw has joined #lisp
risto has quit [Quit: rcirc on GNU Emacs 26.2]
t58 has joined #lisp
kajo has joined #lisp
risto has joined #lisp
cosimone has joined #lisp
<risto> hey everyone
<risto> so this is maybe a silly question: how to I build my web app from the command line?
<risto> so far i've tried roswell, recipes from the lisp cookbook, random blog posts online, I can't get anything to work
<risto> I can launch sbcl and run `(asdf:load-system :my-app)`, but I don't know how to run it as a script
<risto> use case is to use it with something like docker or nspawn
<no-defun-allowed> Well, enjoy not having a debugger, but it is possible and each implementation does it slightly differently.
<jackdaniel> risto: sbcl --eval '(asdf:load-system :my-app)' --eval '(my-app:start-app)'
<jackdaniel> no-defun-allowed: advanced software even when started from cli may allow connecting with slime (i.e by having swank server listening for local connections)
shka_ has joined #lisp
<jackdaniel> so one does not make the other impossible
<no-defun-allowed> For example on SBCL, `(sb-ext:save-lisp-and-die "executable-name" :compression 9 :executable t :toplevel #'my-app:start-app)`
<no-defun-allowed> jackdaniel: I guess so.
<jackdaniel> (and by "advanced software" I mean software which has put more than 0 effort to make executables for other people)
<jackdaniel> so not that advanced
<jackdaniel> risto: if you want a well written abstraction to create command line executables take a look at net.didierverna.clon library
<jackdaniel> (it is available on quicklisp)
<risto> thanks jackdaniel!
<jackdaniel> sure
<risto> so the way to do it is to setup a swank server?
ted_wroclaw has quit [Quit: Textual IRC Client: www.textualapp.com]
<no-defun-allowed> If you value your sanity, that's something you probably want to do in my-app:start-app.
<jackdaniel> risto: it is a way to connect to your living application
<jackdaniel> but there are some security concerns
<jackdaniel> because if you set it up to listen for local connections basically anyone can connect to it if they have local account (I'm not even mentioning listening for connections from outside)
<jackdaniel> in principle slime supports magic-cookie mechanism, so you could secure local connections with that
<risto> ah gotcha
<jackdaniel> that said, creating swank server is as simple as: (asdf:load-system 'swank) (swank:create-server)
<jackdaniel> then it will listen for slime connections on port 4005
<risto> what's the common lisp way of writing a web app? I was going down the route of running the web app like you normally would inside docker, or maybe lxc or nspawn, and manage failed nodes, add new nodes on the fly, etc
<jackdaniel> why do you need multiple nodes?
<jackdaniel> is it some microservices histery? ,-)
<risto> yeah pretty much
<risto> probably wouldn't need them any time soon
bendersteed has joined #lisp
<jackdaniel> I'd love to chat about that, but I need to go now
<risto> ok
<risto> thanks for the help :)
<jackdaniel> if you want to get something working just grab hunchentoot and write some handlers
<risto> yeah I got everything working, that was the last part of it
<risto> using ningle + clack right now
<no-defun-allowed> "For a microservice application to be really microservice-y, each service should just do one thing like add two numbers or get a key from a hash-table. Now, who wants to bet on how few of these microservices you'd need to do arbitrary computation?"
orivej has quit [Ping timeout: 246 seconds]
<risto> I dont care so much about the microservice dogma, I just want to worry a lot less about scaling the app
<no-defun-allowed> Shame they don't just scale the machine, something like Multics could do.
wxie has joined #lisp
<risto> wouldn't you need horizontal scalability at some point? sharding, multiple machines running the app, etc?
<no-defun-allowed> Your program probably runs in a VM, so it should be not so difficult.
<risto> i'm not sure all of google could run on one supercomputer
<no-defun-allowed> Hopefully you're not running all of Google then. This would only really work for moderately sized systems.
<risto> yeah i get what you're saying
<asdf_asdf_asdf> Hi. What means this error "(sb-alien:define-alien-callback "B" void (:stdcall int) ((ptr1 (* t))))"?
<risto> it's all hype
<asdf_asdf_asdf> "The symbol "DEFINE-ALIEN-CALLBACK" is not external in the SB-ALIEN package."
<ck_> asdf_asdf_asdf: package:symbol references external symbols, those that have been :EXPORTed in the invocation of the defpackage macro
aautcsh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ck_> asdf_asdf_asdf: you can either use sb-alien::define-alien-callback (note the double double dot), or fix the package exports
<no-defun-allowed> Yeah, what the hell? It's only an internal symbol in sb-alien. Maybe they don't want you to use it.
jonatack has quit [Quit: jonatack]
<asdf_asdf_asdf> @ck_; thanks. I wrote "SB-ALIEN::DEFINE-ALIEN-CALLBACK". It works.
sonologico has quit [Remote host closed the connection]
sonologico has joined #lisp
igemnace has quit [Quit: WeeChat 2.5]
<asdf_asdf_asdf> How check address of function in Common-Lisp [SBCL]?
<pjb> asdf_asdf_asdf: functions don't have addresses in lisp.
<no-defun-allowed> Probably can't (and really shouldn't), since SBCL uses a copying collector and so they're prone to move a lot.
<asdf_asdf_asdf> How tell compiler that get address of function without calling this function?
<pjb> asdf_asdf_asdf: you don't.
cl-arthur has joined #lisp
Inline__ has joined #lisp
<asdf_asdf_asdf> What? I want "&A" - example from C.
Inline__ has quit [Read error: Connection reset by peer]
<pjb> asdf_asdf_asdf: There's no such notion in lisp.
<no-defun-allowed> You're not getting &a.
<pjb> asdf_asdf_asdf: you can always write your program in C.
<no-defun-allowed> There are no pointers in Lisp.
<asdf_asdf_asdf> "void (*ptr)() = &A;" - I want write it in SBCL.
<pjb> You cannot, if A is a lisp function.
<no-defun-allowed> asdf_asdf_asdf: You're not getting any pointers.
<pjb> C doesn't know how to call lisp functions.
<pjb> First, lisp functions are not functions, they're closures.
<pjb> and C doesn't do closures.
<no-defun-allowed> Your best bet is to use a callback of some kind that calls that Lisp function, and give C that callback.
<asdf_asdf_asdf> @pjb; In my code A is sb-alien::define-alien-routine "A"...
aoeu256 has joined #lisp
Inline has quit [Ping timeout: 264 seconds]
<pjb> Good.
<pjb> But you need a callback.
<asdf_asdf_asdf> https://cpy.pt/tZe9B1pq
<asdf_asdf_asdf> Up is from package SB-ALIEN.
<pjb> Otherwise, it depends on the FFI in question: it may be possible, or it maybe impossible to get the address of an foreign function.
<pjb> asdf_asdf_asdf: if you insist on sb-alien instead of CFFI, you might want to ask in #sbcl.
wxie has quit [Ping timeout: 250 seconds]
hiroaki has joined #lisp
risto has quit [Quit: rcirc on GNU Emacs 26.2]
xuxuru has joined #lisp
zotan has quit [Ping timeout: 276 seconds]
<beach> Xach: I think I read that ZPB-TTF can handle OpenType fonts. Do you have any documentation relating to that feature?
<beach>
<beach>
zotan has joined #lisp
sonologico_ has joined #lisp
sonologico_ has quit [Remote host closed the connection]
sonologico has quit [Ping timeout: 250 seconds]
<jackdaniel> isn't it just that opentype fonts share the basic structure of ttf? I don't think zpb-ttf covers anything above truetype
<beach> I read Xach's blog from 2008, and it says "For example, I'm adding support for processing OpenType fonts to ZPB-TTF..."
<jackdaniel> I didn't know that, nevermind me then
<beach> Well, he might not have gotten around to it.
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
orivej has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
gravicappa has quit [Ping timeout: 245 seconds]
Necktwi has joined #lisp
xuxuru has quit [Quit: xuxuru]
aautcsh has joined #lisp
<beach> He has come a long way since 2008.
momozor has joined #lisp
<momozor> Hi. I made this simple library for my own use https://github.com/momozor/cl-http-test
<beach> momozor: Are you looking for remarks on it?
<asdf_asdf_asdf> @beach; sorry for question, but I don't know how it solve. How assign to variable function in SBCL?
<momozor> I'm actually looking forward to add more feature, on POST.
<momozor> So I'm going to ask a very specific question
<beach> asdf_asdf_asdf: I don't know what "assign to variable function" means.
<momozor> how do you (ql:quickload :project) and call (project:func) in the library?
<beach> momozor: Ah, OK. I had some style remarks for you, but since you are not looking for feedback, I'll keep them to myself.
<momozor> beach: I apologize. Sure, go ahead. Feedbacks are all welcome.
<asdf_asdf_asdf> void A() { // ... } void (*ptr)() = &A;
<beach> momozor: Not only are most of your (when ... t) useless, they also are bad style. WHEN should be used only in a context where its value is not needed. If the value is needed, use IF when both a `then' and and `else' branch.
<no-defun-allowed> Beat me to it.
<beach> asdf_asdf_asdf: Oh, FFI. I don't do that.
<no-defun-allowed> I agree, all the (when <test> t) forms can be reduced to <test>
<beach> momozor: Most of your conditions in the WHEN are Booleans anyway.
wxie has joined #lisp
<asdf_asdf_asdf> Something tutorial about pure SBCL "hacks" without FFI?
<momozor> beach: thank you very much. I'm gonna improve the codebase based on your feedback. :)
<beach> momozor: Instead of nested LETs, you can use LET*
<no-defun-allowed> asdf_asdf_asdf: Again, make a callback (cffi:defcallback) then pass around (cffi:callback callback-name) as you please.
<momozor> beach: also thanks for that.
<beach> momozor: Your indentation for MULTIPLE-VALUE-BIND is wrong.
<beach> But you don't need MULTIPLE-VALUE-BIND since you are just using the second value.
* no-defun-allowed tries to write a little defcallback test
<asdf_asdf_asdf> @no-defun-allowed; I learn SBCL not FFI, sorry.
<beach> momozor: You can use nth-value instead.
<beach> momozor: It saves a declaration too.
<no-defun-allowed> asdf_asdf_asdf: Don't. Portability is pretty important.
Bike has joined #lisp
<momozor> beach: nth-value? Awesome! I've been stuck with that piece for hours and in the end, resorting for the hacky way.
<momozor> thanks for mentioning that
<beach> momozor: So you can reduce get-ok to (nth-value 1 (get-content root-host rounte))
<beach> Er, sorry.
<beach> momozor: So you can reduce get-ok to (eql (nth-value 1 (get-content root-host rounte)) 200)
<_death> but now you need to remember what the second value is.. with multiple-value-bind at least it has a meaningful name.. personally I think this returning of multiple values (likely due to drakma's use) is bad and it's better to return a response object
<beach> Right, so you may want to keep the name.
<no-defun-allowed> asdf_asdf_asdf: Here is an example of cffi:defcallback: https://plaster.tymoon.eu/view/1482#1482
bendersteed has quit [Ping timeout: 244 seconds]
<no-defun-allowed> (Technically, the example C function should be called funcall instead of call_identity :)
<momozor> Hmm, when returning multiple values can be actually appropriate?
<momozor> if at all?
<no-defun-allowed> Fairly often.
<asdf_asdf_asdf> OK, thanks.
<no-defun-allowed> clhs gethash
<beach> Reading Xach's blog from 2008 and reading what asdf_asdf_asdf (who seems to have limited experience with Common Lisp) is up to, I gather it is common to start using Common Lisp for some project involving FFI. I personally think that is a very bad idea.
EvW1 has joined #lisp
<asdf_asdf_asdf> Sorry, I "get out".
<no-defun-allowed> In gethash, a second value is used to indicate if the value assosciated with the key is NIL, or if there is no value at all.
<_death> when it's overkill to return an aggregate.. when it's clear that there's a primary value and secondary values
<no-defun-allowed> ^^ pretty much. Drakma (and lookalikes) have like 8 return values.
<momozor> o.o
<_death> there are some good example in CL, like gethash mentioned or floor.. but there are also some bad examples in CL (in my opinion), like get-setf-expansion or decode-universal-time
asdf_asdf_asdf has quit [Remote host closed the connection]
<momozor> oh I see. thanks
<_death> if you don't want a full-fledged object with accessors etc., it may still be better to just use a plist
<momozor> sounds like I need to visit https://google.github.io/styleguide/lispguide.xml for one more time
<_death> for decode-universal-time I can imagine a pro-multiple-values argument about performance.. but I'm not sure that was the original reason for the design
<no-defun-allowed> If it were year, month, day, hour, minute, second, daylight-p, zone, day, then it would match string timestamp formats pretty well.
alexanderbarbosa has quit [Remote host closed the connection]
alexanderbarbosa has joined #lisp
momozor has quit [Remote host closed the connection]
momozor has joined #lisp
jonatack has joined #lisp
momozor has quit [Quit: Leaving]
red-dot has joined #lisp
<pjb> _death: probably, the reason was that multiple values were normalized around the same time.
hiroaki has quit [Ping timeout: 252 seconds]
<_death> pjb: some cl-su-ai message mentions optimizations to d-u-t (or rather, a related d-u-t-without-dst operator), so maybe it was a consideration
<pjb> Notice also that the compiler can easily optimize the operation if it open-codes decode-universal-time, with multiple values.
<pjb> (you don't always use all the returned values).
<_death> yeah.. still, we're using Lisp not C.. we accept all kinds of inefficiencies in the small to get efficiency in the big
<ggole> That's true of structures as well, really
gravicappa has joined #lisp
<_death> I guess standard operators can more easily get away with using multiple values like that, because they're very unlikely to change (and still possible to "extend", though not very pleasant)
momozor has joined #lisp
<_death> still every time I need to use these operators I need to look them up
<momozor> if (declare ...) is not recommended, then what else? check-type? is it still a recommended way to do so?
<momozor> s/(declare ...)/(declare (type ...))
<momozor> err
miklos1 has joined #lisp
wxie has quit [Ping timeout: 244 seconds]
<_death> momozor: yes, I think this section promotes check-type over declare - but for the "contract of API functions", i.e. functions at the edge, to be used by "client code"
orivej has quit [Ping timeout: 245 seconds]
<momozor> ohhhhhh
<_death> momozor: but I thoroughly disagree with the premise, "If you know the type of something, you should make it explicit"
bmansurov has joined #lisp
<beach> momozor: It is common for people coming from statically typed languages to be somewhat obsessive about types.
<beach> momozor: Mostly, types in my programs are in the form of specializers to methods of generic functions.
SaganMan has quit [Quit: WeeChat 1.6]
<bmansurov> o/ I have an asd file similar to this one: https://github.com/fukamachi/safety-params/blob/master/safety-params.asd, and when I try to load my package, I get the following error: The name "ROVE" does not designate any package. But when I do "(ql:quickload "rove")" the package loads fine. What am I doing wrong above?
<beach> bmansurov: What do you mean by "load my package"? Normally packages are defined, not loaded.
<bmansurov> beach: I mean with (ql:quickload "package")
<bmansurov> beach: besides that asd file I also have a .package file
<beach> That would be a "system", not a "package".
<bmansurov> my bad
<beach> So is "rove" your system?
<bmansurov> beach: No, it's a testing library that my system depends on.
<_death> bmansurov: well, do you depend on safety-params/tests?
<_death> bmansurov: if your system depends on rove, you should put it in your own :depends-on
<bmansurov> _death: sorry, my system doesn't but my-system/tests does
lucasb has joined #lisp
<bmansurov> and yes I depend on rove there
<_death> if you have a problem, don't show similar code that doesn't have it.. show the problematic code
<bmansurov> _death: ok, let me upload it somewhere
miklos1 has quit [Remote host closed the connection]
<bmansurov> _death: this is the asd file: https://pastebin.com/29DVUiEQ
<bmansurov> I'll upload the package file too
<bmansurov> Here's the package file: https://pastebin.com/bHx08yDs
orivej has joined #lisp
<bmansurov> So when I do (ql:quickload :abcd), quicklisp tries to load (ql:quickload :abcd/tests) and then complains about missing "rove".
<bmansurov> > The name "ROVE" does not designate any package.
<bmansurov> but when I run (ql:quickload :rove), quicklisp doesn't complain, and loads rove fine.
<_death> wasn't there a similar issue recently.. I think the issue was about case
<beach> bmansurov: In your package file, you :use the ROVE package.
<beach> bmansurov: But the ABCD system does not depend on ROVE, so the ROVE is not built by ASDF when you call ASDF like that.
<_death> bmansurov: wait.. I think the problem is that you put both defpackage forms in the same file.. but they belong to separate systems
alexanderbarbosa has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 245 seconds]
<bmansurov> beach: so :in-order-to ((test-op (test-op "uzbek-lemmatizer/tests"))) is causing the issue? I don't want to depend on ROVE in the definition of ABCD.
<bmansurov> beach: I'm also :using it in abcd/tests.
<bmansurov> _death: I should create two package files?!
<beach> bmansurov: Yes, but using a package does not compile the system.
<beach> bmansurov: You seem to be confused about the difference between systems and packages.
<bmansurov> beach: yes I am, probably should read asdf documentation first?
<beach> When you quickload ABCD, the systems it depends on will be compiled as well, so you get alexandria anaphora and cl-ppcre, but not rove.
<momozor> bmansurov: random question. Are you using https://github.com/fukamachi/cl-project?
<beach> bmansurov: Then you try to compile the package file.
<beach> bmansurov: And that package file contains a reference to the ROVE package (not the ROVE system).
<beach> bmansurov: But since you have not compiled the ROVE system, the ROVE package does not exist.
<bmansurov> beach: I see. Compiling gives the same error.
<bmansurov> momozor: No I'm not using it, but thanks for sharing. I think I used quicklisp's start project or something.
<beach> So you can either do what _death suggest, namely have a separate package definition for the test system, or you can depend on the ROVE system in your ABCD system.
<bmansurov> beach: got it. thanks!
<beach> Sure.
<beach> I am counting on _death to correct me if my analysis is wrong.
<bmansurov> thanks everyone
<_death> beach: you're right.. but since rove is a library for unit testing, I don't think abcd should depend on it
<beach> Part of the confusion is that it is common practice to have the main package have the same name as the system.
<momozor> bmansurov: ah I see
<beach> _death: Ah, yes, of course. I didn't know what ROVE is about.
<momozor> bmansurov: that uses the prove unit testing library?
<momozor> bmansurov: I think you'll do better with cl-project (it uses rove by default)
<bmansurov> momozor: not sure, but I think prove is deprecated, so I wanted to use rove.
<bmansurov> momozor: ok, i'll take a look at it.
igemnace has joined #lisp
dddddd has joined #lisp
Kundry_Wag has joined #lisp
xkapastel has joined #lisp
zaquest has joined #lisp
bendersteed has joined #lisp
libertyprime has quit [Ping timeout: 244 seconds]
EvW1 has quit [Ping timeout: 250 seconds]
Necktwi has quit [Quit: leaving]
<beach> Sure. But the line that starts with (title-content is incorrectly indented.
<beach> And there might be room enough on a line to avoid a newline after title-content and all-content.
<momozor> beach: do we have anything to make code formatting in Lisp, more automatic? For example, Python have yapf and black. Perl has perltidy, etc.
<beach> Emacs.
<momozor> I currently uses Emacs' indent-region.. is that enough?
<beach> C-x h then M-\ (my fingers know it but I may have forgotten).
<beach> Provided you use the SLIME contribution slime-indentation, you will do pretty well.
<_death> although I don't use it, there is a package called aggressive-indent that is supposed to make sure all is properly indented
<momozor> oh wow. thanks for the recommendations.
<momozor> aggressive-indent really ticks for me
makomo has joined #lisp
makomo_ has quit [Ping timeout: 244 seconds]
momozor has quit [Quit: Leaving]
Inline has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
q3d has joined #lisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
Kundry_Wag has quit [Quit: Leaving...]
bendersteed has quit [Remote host closed the connection]
mkrauss has joined #lisp
void_pointer has joined #lisp
asdf_asdf_asdf has joined #lisp
<asdf_asdf_asdf> Hi. (sb-alien::define-alien-variable "ptr1" (* t)) (setf ptr1 (sb-alien::alien-callback (sb-alien::alien-callback A))). https://koji-kojiro.github.io/sb-docs/build/html/sb-alien/macro/ALIEN-CALLBACK.html?highlight=alien%20callback Not working.
<asdf_asdf_asdf> void (*ptr)() = &A;
<ck_> asdf_asdf_asdf: people were telling you earlier that, if you want to stick with sbcl internals instead of cffi, you should ask in #sbcl
<asdf_asdf_asdf> OK, sorry.
void_pointer has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<ck_> I'm just reminding you because it could be the reason responses are not quite forthcoming here
<cl-arthur> asdf_asdf_asdf: *Why* do you want to stick with sbcl inernals instead of cffi?
<asdf_asdf_asdf> I learn internals, not packages to Lisp.
<loke> No one uses the SBCL package. Really. Everybody uses CFFI
<ck_> that sounds like you interpret sbcl to be the only lisp implementation out there
<_death> for start, sb-alien::alien-callback takes two arguments..
<cl-arthur> Implementations are essentially arbitrary. It's like you really want to learn about the MCP C compiler rather than C programming.
mkrauss has quit [Ping timeout: 276 seconds]
trocado has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
aautcsh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bendersteed has joined #lisp
josemanuel has joined #lisp
trocado has quit [Ping timeout: 246 seconds]
aautcsh has joined #lisp
Ricchi has quit [Remote host closed the connection]
aoeu256 has quit [Ping timeout: 248 seconds]
gareppa has joined #lisp
rippa has joined #lisp
gareppa has quit [Quit: Leaving]
nanozz has joined #lisp
orivej has joined #lisp
mankaev has joined #lisp
nanoz has quit [Ping timeout: 272 seconds]
Retropikzel has joined #lisp
mkrauss has joined #lisp
milanj has joined #lisp
<mkrauss> Does anybody have any good advice on how to move a symbol from one package to another? Every time I've done this, I have to remember/look up how to unexport and unintern the symbol before adding it back in the other package. What I would expect to work is to be able to remove it from one defpackage form and re-eval that, then add it to the other and re-eval that. Is there some way I'm thinking about this wrong, or s
<mkrauss> ome easier technique I'm missing?
<ck_> mkrauss: if Erik Naggum were still among us, he'd give you some strongly worded rant on the difference between imagined and actual state
<mkrauss> That sounds interesting...
<ck_> a defpackage form does not control what symbols a package contains, so evaluating an edited form doesn't do what you want, of course.
cosimone has quit [Remote host closed the connection]
<ck_> mkrauss: If you want to move something between packages, reference it from the target package and then unintern / fmakunbound .. it from the source
cosimone has joined #lisp
<pjb> mkrauss: (defun move-symbol-to-package (s new-home-package) (unintern s (symbol-package s)) (intern s new-home-package) s)
<mkrauss> I don't have to (unexport 'thesymbol)? Somehow I have it in my head that it doesn't work otherwise...
<pjb> s/intern/import
<pjb> You said "move" which I interpret as changing the home package of the symbol. This has nothing to do with exporting.
<pjb> mkrauss: but otherwise, yes, you're thinking about it wrong.
<mkrauss> Ah good point. But assuming the symbol *was* exported from the original home package, is it then necessar to unexport it? I think in the past I've had problems when I didn't.
<pjb> mkrauss: the behavior of defpackage when re-evaluated is implementation dependent. So you better use your own defpackage macro. Eg. https://github.com/informatimago/lisp/blob/master/common-lisp/lisp-reader/package-mac.lisp#L159
<pjb> mkrauss: removing the symbol from the original package will remove it from the export list.
mankaev has quit [Remote host closed the connection]
<mkrauss> I guess I don't feel it's a problem to be implementation dependent as long as I know how it works in the implementation I'm using, since this is about the iterative development process, not the final source code...
asdf_asdf_asdf54 has joined #lisp
<mkrauss> One of the great advantages of Lisp to me is the dynamic iterative development process... Need to tweak a defun? No problem, make the change, hit C-c C-c and everything just works. I guess what I'm looking for is for refactoring packages to work that smoothly, or to understand why they don't.
asdf_asdf_asdf has quit [Ping timeout: 244 seconds]
zotan has quit [Ping timeout: 264 seconds]
zotan has joined #lisp
<_death> I think redshank had a thing for export/unexport
bendersteed has quit [Read error: Connection reset by peer]
benderst` has joined #lisp
zaquest has quit [Remote host closed the connection]
zaquest has joined #lisp
<pjb> mkrauss: nobody ever had a need to move symbols from one package to another.
<pjb> mkrauss: this is something one may consider when editing an image, in image-based development.
<pjb> But since Interlisp, nobody does that anymore.
<pjb> Well, that's not entirely true. Some CL applications were developped like that, saving executable images for new versions, etc. But the case I have in mind was on MacOS during the 90s… Current CL development is not done that way.
torbo has joined #lisp
<mkrauss> pjb: I definitely feel like I'm missing something big now, when you say "nobody does that". Really? I've been tinkering with CL for years now, on and off. I've seen some systems that are composed of a number of small packages, which feels like a good way to do things to me. It seems inevitable that in writing such a system, you must sometimes decide you put something in the wrong package, and want to change it. Cert
<mkrauss> ainly I have a few times just recently. What am I doing wrong that I have this problem nobody else has?
<pjb> mkrauss: yes, you just edit your source and reload. You don't move symbols around.
<mkrauss> Reload the entire system then, like I would with most other languages?
<pjb> mkrauss: the result is that you could have two symbols with the same name, one bound to old stuff, and another to new stuff, but this is not a problem in general, and if it is a problem, it is only until you reboot your CL implementation. Which in development can occur often enough. The thing is that current computers are so fast, that you wouldn't even notice it! Of course on Macintosh in the 90s or on Interlisp systems in the 8
<pjb> this wouldn't be the case, so it was more interesting to do image-based development.
<pjb> mkrauss: again, a Common Lisp system is not an InterLisp system. You would have to develop a lot of tools to be able to do image-based development confortably with a CL system.
<pjb> From reading about InterLisp, one is led to believe that this wouldn't be a bad thing, but until you win the lotto or sell your startup for a few hundred millions, it won't happen.
<mkrauss> Hah! Well I don't know much about Interlisp. It's true that reloading isn't that much of a burden, but most of the tooling I'm familiar with doesn't seem to encourage it. In the Node-JS world almost nobody is developing without a toolchain that automatically reloads everything whenever you save a change. In CL, I have to "M-x slime-restart-inferior-lisp" and then ql:quickload again. It's not much, but it seems cludg
<mkrauss> y. But for so many things, C-c C-c will recompile something and be just fine without any reloading.
kajo has quit [Ping timeout: 264 seconds]
<_death> you can reload without restarting, too..
<_death> also, to restart lisp I type , re RET
<_death> (or rather , rest RET.. deceitful muscle memory)
kajo has joined #lisp
asdf_asdf_asdf54 is now known as asdf_asdf_asdf
sjl has joined #lisp
jgodbout has joined #lisp
afidegnum has quit [Ping timeout: 245 seconds]
afidegnum has joined #lisp
nowhere_man has joined #lisp
mkrauss has quit [Ping timeout: 276 seconds]
q3d has quit [Remote host closed the connection]
stepnem_ has joined #lisp
Oladon has joined #lisp
stepnem has quit [Read error: Connection reset by peer]
xkapastel has quit [Quit: Connection closed for inactivity]
knicklux has quit [Read error: Connection reset by peer]
stepnem has joined #lisp
stepnem_ has quit [Ping timeout: 245 seconds]
nowhere_man has quit [Ping timeout: 252 seconds]
asdf_asdf_asdf has quit [Remote host closed the connection]
<aeth> Restarting CL is done rarely, maybe a few times a day, unless you're intentionally restarting before every git push to make sure that your image isn't out of sync with the source.
Xizor_ has quit [Remote host closed the connection]
Xizor has joined #lisp
aoeu256 has joined #lisp
<aoeu256> How do you define an empty setf place? like (setf (id a) 5) is the same as (setf a 5). Im trying to implement an term rewriting verison of eval.
asdf_asdf_asdf has joined #lisp
bjorkintosh has joined #lisp
gravicappa has quit [Ping timeout: 246 seconds]
igemnace has quit [Read error: Connection reset by peer]
dale has joined #lisp
<Bike> aoeu256: define-setf-expander that just calls and returns the results of get-setf-expansion for the subform?
igemnace has joined #lisp
<_death> even easier is (defmacro id (var) var)
<Bike> i always forget about that
ravenous_ has quit [Quit: Textual IRC Client: www.textualapp.com]
permagreen has quit [Remote host closed the connection]
<aoeu256> With the macro its not actually changing x, hmm....
ravenous_ has joined #lisp
<Bike> what do you mean?
<Bike> (defmacro id (form) form) (let ((x 5)) (setf (id x) 3) x) => 3 for me
<aeth> In general, DEFMACRO will get you the setf for free. I would have never thought to use it like that, though.
<_death> I use it when in functions sometimes (with a macrolet)
<aeth> well, I mean, I'd know that you can use it to turn (foo bar) into (baz bar) for use in setf but I would have never thought to use it to turn (foo bar) into bar.
EvW has joined #lisp
<_death> heh, well me neither until this question ;)
nanozz has quit [Ping timeout: 245 seconds]
drmeister_ has quit []
alexanderbarbosa has joined #lisp
cranes has quit [Ping timeout: 246 seconds]
drmeister_ has joined #lisp
drmeister_ is now known as drmeister
ggole has quit [Quit: Leaving]
<drmeister> Does anyone use orgmode in emacs with #+BEGIN_SRC lisp/#+END_SRC ?
<drmeister> I'm trying to get :+RESULTS: to work - but I'm getting nothing.
<_death> org-babel?
<drmeister> C-c C-c evaluates the lisp code - but results don't get written back into the orgmode file.
<drmeister> _death: Yeah - I'm enabling that (correctly I hope).
<asdf_asdf_asdf> C-c C-e
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<asdf_asdf_asdf> inferior-lisp-mode
<drmeister> C-c C-e is to export the orgmode file.
<aeth> wait, you can evaluate BEGIN_SRC?
okflo has joined #lisp
<_death> drmeister: well, I can just open a new org file, <s TAB (to insert begin-src/end-src) lisp, then put in say (+ 3 5) and C-c C-c will give the results in file
<_death>
<drmeister> This shows what I'm doing with no results in the orgfile.
<_death> aeth: yes... I found it useful with SQL queries, but you can use many languages and write your own org-babel drivers
Lord_of_Life_ has joined #lisp
<drmeister> _death: So you get the results injected into the orgfile?
<_death> aeth: http://howardism.org/Technical/Emacs/literate-devops.html is how I learned about it at the time
<_death> drmeister: yes.. do you have an org-babel-do-load-languages form in your .emacs with (lisp . t) in the alist?
Lord_of_Life has quit [Ping timeout: 245 seconds]
<drmeister> I have this...
<drmeister> Like that?
shrdlu68 has quit [Ping timeout: 272 seconds]
Lord_of_Life_ is now known as Lord_of_Life
akoana has joined #lisp
akoana_ has joined #lisp
akoana__ has joined #lisp
<drmeister> I mean - crap - I can copy the output back into the orgmode file - but (sigh) it almost sorta works?
akoana___ has joined #lisp
<_death> drmeister: well, I don't know what ober-* functions are
akoana___ has quit [Client Quit]
<drmeister> ober? Hmmm . I didn't notice that.
<drmeister> Checking...
<_death> drmeister: why do you modify the org-mode-map?
akoana__ has quit [Client Quit]
jgodbout has quit [Ping timeout: 245 seconds]
akoana_ has quit [Client Quit]
<drmeister> Some random person on the internet told me to?
<_death> reasonable
<drmeister> I wouldn't be anywhere if it wasn't for random people on the internet.
<_death> well, did removing it work?
<drmeister> Yes!
<drmeister> Thank you, random person on the internet!
<_death> 1+ for random people on the internet
vlatkoB has quit [Remote host closed the connection]
okflo has quit [Remote host closed the connection]
<pjb> drmeister: "Some random person on the internet told me to?" is a dangerous meme. Next, you instaure a Chinese social credit system!
<pjb> (or worse, twitter verified accounts).
<_death> pjb: I remember you vividly demonstrated the danger some years ago ;)
cosimone has quit [Ping timeout: 250 seconds]
<drmeister> Alright - I'm up and running with that - thank you very much!
hendrixmar has joined #lisp
<_death> ;)
<hendrixmar> Is lisp still used in the software industry?
<p_l> hendrixmar: there are still pockets, though clojure is more visible these days
random-nick has quit [Read error: Connection reset by peer]
<p_l> Naughty Dog still uses Lisp, though specifically variants of Scheme (I think they mainly use Racket at the moment + custom ones) in their games and tools. Franz Inc. has apparently good money selling AllegroGraph to high-profile clients. Lissys' Piano shows that one-man lisp company can get far. Google Flights still is written in Common Lisp.
<p_l> Ravenpack does lucrative business with CL; SISCOG does some high profile railway clients with system written in CL (starting back on lisp machines!)
benderst` has quit [Remote host closed the connection]
random-nick has joined #lisp
<drmeister> hendrixmar: I've developed a Common Lisp implementation to develop software for drug discovery.
manualcrank has joined #lisp
<drmeister> We are writing a lot of code in Common Lisp to build a drug-discovery toolchain.
<p_l> and yeah, our resident drmeister is using common lisp to program chemistry ;) (bloody awesome stuff)
josemanuel has quit [Quit: leaving]
<moldybits> oh. why did you need a new implementation?
<drmeister> I needed interoperation with C++
<moldybits> oo
<moldybits> is ecl c specific?
<drmeister> Yes.
<moldybits> ah
<p_l> moldybits: interop with C++ is HELL
<drmeister> Clasp has a binding library - like pybind11 - and it works with C++ exception handling (among dozens of other things).
hendrixmar has quit [Ping timeout: 260 seconds]
<aeth> One problem with C++ is that it does stuff like name mangling. so e.g. https://en.wikipedia.org/wiki/Name_mangling#How_different_compilers_mangle_the_same_functions
<aeth> The correct way to interface with C++ from other languages is to make the C++ export a C API with extern "C" (which is the section after the one that I linked to), which can be a lot of work, and you lose features, obviously
<p_l> aeth: name mangling is *simplest* part of handling C++
<aeth> p_l: yes, which makes it the simplest example here, too
<p_l> it's honestly a non-issue, especially given that most C++ runtimes include runtime functions to decode/encode the names
<p_l> GCC "IA-64" ABI vtables are annoying
<aeth> p_l: The problem with giving examples on IRC is that a simple example taken alone might seem pointless, but all of the issues in a complete, practical list add up.
<aeth> Yes, you can work around one thing. Now work around all things.
<p_l> same ABIs exception handling had me actually get a waking nightmare
<aeth> Exceptions would be my next example.
<p_l> aeth: I got as far as the final enemy, exception handling
<p_l> (as templates require forced instantiation on C++ compiler side)
Inline has quit [Quit: Leaving]
<_death> well, there are all kinds of ways to integrate with C++.. here's what I'm doing right now ( mpv https://adeht.org/dump/vid-2019-08-26T0035.mkv )
<aeth> Technically, I've integrated with a C++ program before via a text interface via uiop:launch-program.
<p_l> welll, on windows one gets to use COM (there used to be linux implementation too), and on AIX with XL compiler one can recompile the whole thing with SOM ABI
asdf_asdf_asdf has quit [Remote host closed the connection]
akoana has left #lisp ["Leaving"]
ltriant has joined #lisp
reggie__ has quit [Ping timeout: 272 seconds]
reggie_ has joined #lisp
anewuser has joined #lisp
monokrom has quit [Remote host closed the connection]
gabbiel has joined #lisp
<gabbiel> Guys, I've never written a reader macro before, I need help writing a reader macro like this
<gabbiel> #t(random 10) => (thunk (random 10))
<gabbiel> #t((print 'foo) (random 10)) => (thunk (print 'foo) (random 10))
<gabbiel> where thunk is this macro I've defined
<gabbiel> (defmacro thunk (&body body)
<gabbiel> "Return `(lambda (&rest ,(gensym)) ,@BODY)."
<gabbiel> (let ((rest (gensym)))
<gabbiel> `(lambda (&rest ,rest)
<gabbiel> (declare (ignore ,rest)) ,@body)))
<no-defun-allowed> (set-dispatch-macro-character ## #\t (lambda (s c m) (list 'thunk (read s))))
shka_ has quit [Ping timeout: 245 seconds]
shka_ has joined #lisp
<pjb> gabbiel: (defun sharp-t-reader-macro (stream subchar arg) (declare (ignore subchar arg)) (let ((body (read stream t nil t)) (vrest (gensym))) `(lambda (&rest ,vrest) (declare (ignore ,vrest) ,@body))))
<pjb> (set-dispatch-macro-character #\# #\t 'sharp-t-reader-macro)
saravia has joined #lisp
<pjb> Oh right, thunk.
<pjb> gabbiel: (defun sharp-t-reader-macro (stream subchar arg) (declare (ignore subchar arg)) `(thunk ,@(read stream t nil t)))
<pjb> (quote #t((print 'foo) (random 10))) #| --> (thunk (print 'foo) (random 10)) |#
<gabbiel> nice, does it work with #t(random 10) case
random-nick has quit [Ping timeout: 258 seconds]
<pjb> gabbiel: of course. (let ((random nil)) #t(random 10)) #| --> #<ccl:compiled-lexical-closure #x30200BFD6CEF> |#
<pjb> (funcall (let ((random nil)) #t(random 10))) #| --> 10 |#
<pjb> gabbiel: reading consists in taking what's in the outside world, watching it carefully, and building an internal representation of what's outside. Not the opposite!!!
shka_ has quit [Ping timeout: 245 seconds]
<gabbiel> pjb: but #(random 10) should be (thunk (random 10)) which returns a random number between 0 and 9
<gabbiel> I see that it requires reading, so do I read first to check if the first item is a list or not, and act accordingly?
EvW has quit [Ping timeout: 264 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
<aoeu256> wow parinfer is awesome for python devs, i wonder if you can mix it with paredit
aoeu256 has quit [Quit: Leaving]
aoeu256 has joined #lisp
<no-defun-allowed> gabbiel: what about the valid but weird #t((lambda (x) x) 2)
<no-defun-allowed> My opinion is that laziness and side effects usually aren't friends, and having multiple forms in a thunk usually mean all bust last induce side effects, so supporting multiple forms (without progn) shouldn't be so important.
<gabbiel> no-defun-allowed: that should be (thunk (lambda (x) x) 2) which just returns 2, but creates identity function and forgets about it
<no-defun-allowed> ((lambda (x) x) 2) ↦ 2
<gabbiel> i see your point, I guess having #t(funcall (lambda (x) x) 2) would be the solution
EvW1 has joined #lisp
<Bike> you probably shouldn't allow #t(random 10) like you seem to want. just have the extra parens so things are consistent and you don't need to worry about symbol macros or whatnot
<gabbiel> yeah i think youre right
longshi has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
gabbiel has quit [Read error: Connection reset by peer]
gabbiel has joined #lisp
trocado has joined #lisp
parab has joined #lisp
cl-arthur has quit [Remote host closed the connection]
lucasb has quit [Quit: Connection closed for inactivity]
gabbiel has quit [Ping timeout: 268 seconds]
gabbiel has joined #lisp
longshi has quit [Ping timeout: 258 seconds]
longshi has joined #lisp
trocado has quit [Ping timeout: 245 seconds]
libertyprime has joined #lisp
<moldybits> "My opinion is that laziness and side effects usually aren't friends" <- nice
<no-defun-allowed> "As far as anyone knows, mutability and delayed evaluation do not mix well in programming languages" - SICP
eschulte has joined #lisp