jackdaniel changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.5, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
LdBeth has quit [Remote host closed the connection]
xylef has quit [Remote host closed the connection]
Gnuxie[m] has quit [Write error: Connection reset by peer]
Jachy has quit [Remote host closed the connection]
no-defun-allowed has quit [Remote host closed the connection]
neosloth has quit [Remote host closed the connection]
sielicki has quit [Remote host closed the connection]
Manny8888 has quit [Remote host closed the connection]
mfiano[m] has quit [Remote host closed the connection]
irdr has quit [Max SendQ exceeded]
fikka has quit [Ping timeout: 244 seconds]
irdr has joined #lisp
kyby64 has quit [Quit: Leaving]
igemnace has quit [Quit: WeeChat 2.3]
Manny8888 has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
xylef has joined #lisp
Gnuxie[m] has joined #lisp
no-defun-allowed has joined #lisp
neosloth has joined #lisp
sielicki has joined #lisp
hvxgr has joined #lisp
hvxgr has quit [Client Quit]
hvxgr has joined #lisp
hvxgr has quit [Client Quit]
Mr-Potter has quit [Ping timeout: 245 seconds]
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hvxgr has joined #lisp
khisanth_ has quit [Ping timeout: 268 seconds]
nirved has quit [Ping timeout: 252 seconds]
LdBeth has joined #lisp
_whitelogger has joined #lisp
jcowan has joined #lisp
rpg has joined #lisp
gxt has quit [Quit: WeeChat 2.3]
permagreen has quit [Remote host closed the connection]
holycow has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
lmy9900 has joined #lisp
emar has joined #lisp
<pfdietz> My typical use case for hash tables is to maintain a (temporary) map from objects to values. For example, if the objects are nodes in a graph, the map might represent mark bits used during a depth first search of the graph.
<pfdietz> (well, one typical use case)
<pfdietz> But I'd like to be able to write that algorithm more generally. For example, if the nodes have a mark field I'd like to be able to use that.
lmy9900__ has joined #lisp
<pfdietz> However, the mark field might be preempted, if something else is already using it.
<pfdietz> It should be possible to have a construct that uses such fields (or plists, or something else) to handle these maps, and fall back to hash tables as a general case.
<aeth> 99 times out of 100, when I use a plist/alist (and it's usually a plist) I'm making something that's supposed to be iterated over.
<aeth> So alexandria:doplist (ugh, there's that missing hyphen problem so many people have in their naming conventions!), not random access.
lmy9900 has quit [Ping timeout: 264 seconds]
<aeth> And I usually don't modify the plist/alist when I iterate over it.
* |3b| likes to just mix all 3, accumulate into a hash (to combine duplicate keys), then convert to alist to sort, then convert to plist for easier printing :p
<aeth> I kind of see plist as an interface
<pfdietz> (loop for (k v) on plist by #'cddr ...)
<aeth> If I'm taking in input, I prefer plists, but I'll probably turn that into something more suitable for internal use.
<aeth> pfdietz: That fails to fail if it's not a valid plist
lmy9900 has joined #lisp
<aeth> pfdietz: You can get it to fail with destructuring-bind instead of directly using loop's destructuring.
lmy9900_ has joined #lisp
<aeth> pfdietz: (destructuring-bind (key value &rest rest) sublist (declare (ignore rest)) ...)
<pfdietz> ♪ We never failed to fail / it was the easiest thing to do. ♪
lmy9900__ has quit [Ping timeout: 252 seconds]
lmy9900_ has quit [Client Quit]
<pfdietz> (loop for e on '(a b c d e) by #'cddr for (k v) = e while (cdr e) ...)
<aeth> pfdietz: I'll loop by #'cddr if I need to use a feature of loop, such as append or collect. I'll use alexandria:doplist instead of a simple loop by #'cddr that uses a :do (in part because it's shorter, especially with the fail-on-invalid-plist requirement)
lmy9900 has quit [Ping timeout: 260 seconds]
<pfdietz> What would be nice there would be something like cddr that fails if applied to non-conses.
<aeth> aka. cddr in Scheme :-p
<pfdietz> Yes. Down with NIL punning!
<aeth> I use loop for the complicated loops, usually conditional collect/append.
<aeth> I try to use a do-foo for the rest (or a higher order function like mapfoo)
<pfdietz> I have recently been working with people who use iter(ate).
<aeth> I hate it.
<pfdietz> I don't hate it, but I'm annoyed it doesn't work with COVER.
<aeth> What I want is something that is literally just loop but with s-expressions (or at least can be thought of in that way... obviously you'd want it to be a superset)
<aeth> pfdietz: i.e. I want this as my iteration: (do-loop (:for i :of-type fixnum :from 0 :below 10) (:for j :of-type double-float := 1d0 :then (* 2d0 j)) (:for s :in foo) (:do ...) (:collect ...) ... (:finally ...))
<aeth> *Possibly* there could be another layer of parentheses (so the for/with/etc. could be grouped in one (...))
<pfdietz> Do you want collect and such to be arbitrarily deeply nested?
dacoda has joined #lisp
<pfdietz> In LOOP, they're at the top level of the loop body.
<aeth> pfdietz: Well a direct translation of LOOP would permit things like (:when ... (:collect ...))
<aeth> (And, in fact, one use of this would be for implementing a LOOP* that is just LOOP with extensions and guaranteed portable behavior, so no more surprises with CLISP behaving differently than SBCL and CCL and ECL.)
<pfdietz> Defined extensibility would be good.
esrse has joined #lisp
<aeth> Oh, and it wouldn't *quite* be a perfect translation. The best way to handle using s-expressions would be to make :of-type explicit in DO-LOOP all of the time instead of having certain types having :of-type be optional (portably fixnum, float, t, and nil, but everyone except CLISP seems to accept subtypes of float, which are far more useful than "float")
<pfdietz> I mention COVER because I'm working on that right now. I want to get it to work with ITERATE, but COVER plays a bit dangerously with replacing some symbols in forms, and it breaks ITERATE when doing so.
<aeth> iterate's internals look very easy to break
<pfdietz> There's an interesting general issue here. If I have two packages, and I need to add an extension that only makes sense when both are loaded (and is then necessary), where do I put that extension?
<aeth> 33 matches for 'defvar', which is exactly what I don't want in my iteration internals, personally. https://gitlab.common-lisp.net/iterate/iterate/blob/a1c47b2b74f6c96149d717be90c07a1b273ced69/iterate.lisp
<pfdietz> I always use DEFPARAMETER, but perhaps you're objecting to special variables of any kind.
<aeth> They don't play nice with threading ime
<aeth> Every time I consider introducing one I get burned by it. Every time.
<pfdietz> If you always bind them they're thread local, yes?
<pfdietz> The value in defvar isn't a binding, of course.
<aeth> With LOOP, I just need LOOP. If you defined LOOP* that was a slightly modified LOOP you'd just need to export LOOP*
<aeth> And imo proper LOOP usage uses keywords.
<no-defun-allowed> "work around sbcl's obnoxious standard compliance" hah
<aeth> My style is to manually import symbols, rather than use prefixes or use a package. Iterate's symbol export style is... well, it's not pleasant when mixed with my package import style.
<pfdietz> Yes. It is the use of specific symbols that causes the COVER problem as well.
<pfdietz> And it can cause symbol collision problems, if someone else is using those particular symbol names.
<aeth> Exactly.
<aeth> But no one would use "sum" or "in", would they?
<pfdietz> I try not to make optimistic assumptions about human nature.
<pfdietz> bbiab
<aeth> I myself have a macro called sum.
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rpg has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
igemnace has joined #lisp
mason has joined #lisp
SaganMan has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
igemnace_ has joined #lisp
igemnace has quit [Read error: Connection reset by peer]
zooey has quit [Remote host closed the connection]
zooey has joined #lisp
dale has quit [Quit: dale]
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 244 seconds]
Inline has quit [Read error: Connection reset by peer]
Inline has joined #lisp
arescorpio has joined #lisp
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orivej has joined #lisp
holycow has quit [Quit: Lost terminal]
dddddd has quit [Remote host closed the connection]
rumbler31 has joined #lisp
impulse has joined #lisp
dale has joined #lisp
rk[genie] has joined #lisp
slyrus1 has joined #lisp
slyrus has quit [Ping timeout: 268 seconds]
slyrus1 is now known as slyrus
zmt00 has joined #lisp
zmt00 is now known as zmt01
zmt01 is now known as zmt00
CrazyEddy has quit [Remote host closed the connection]
<beach> Good morning everyone!
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
shifty has quit [Ping timeout: 268 seconds]
Bike has quit [Quit: sleep]
Lycurgus has quit [Quit: Exeunt]
MichaelRaskin has quit [Quit: MichaelRaskin]
Necktwi has joined #lisp
rk[genie] is now known as rk[ghost]
shrdlu68 has quit [Ping timeout: 245 seconds]
<fiddlerwoaroof> LOOP with keywords is an eyesore
<no-defun-allowed> that's true
<fiddlerwoaroof> Also, especially when I'm reading pseudocode for an algorithm, I use loop forms as executable pseudocode
<fiddlerwoaroof> ... I guess that's just code
<fiddlerwoaroof> e.g. http://paste.lisp.org/display/353413#1 (although, honestly, I like the look of sjl's iterate version better)
arescorpio has quit [Remote host closed the connection]
igemnace_ has quit [Read error: Connection reset by peer]
igemnace has joined #lisp
* fiddlerwoaroof misses paste.lisp.org yet again
dacoda has quit [Remote host closed the connection]
<SaganMan> Morning beach
<zigpaw> morning all :)
emaczen has joined #lisp
SaganMan has quit [Quit: WeeChat 1.6]
Inline has quit [Quit: Leaving]
jello_pudding has quit [Remote host closed the connection]
jello_pudding has joined #lisp
rumbler31 has quit [Remote host closed the connection]
<rk[ghost]> err, i may just have a silly want (always so many ways to do things..)
<rk[ghost]> however, ima ask away..
<aeth> fiddlerwoaroof: I disagree. Emacs highlights keywords. Emacs doesn't and shouldn't highlight symbols. So LOOP with keywords is highlighted a lot like a language with actual keywords would be highlighted. I rely on syntax highlighting.
<rk[ghost]> so let's assume i have a file that is a list, something like '("this" "that" "and" "more")
<aeth> fiddlerwoaroof: (loop :for x :in y ...) well if I typed "for x in y" in most languages that would highlight "for" and "in"
<rk[ghost]> now, i want to load this file, but really, i just want to get the return value from the file of the list itself..
<rk[ghost]> ;i am using CCL if that may matter
<rk[ghost]> is there something equivalent to (load) that just returns the value back from executing the file?
vlatkoB has joined #lisp
<pillton> clhs read
gxt has joined #lisp
<pillton> Do you really need to evaluate the list? If not then use read.
<pillton> You won't need the quote if you use READ.
<rk[ghost]> i don't need to evaluate it, ima store it so i can map something across it to build another object..
shka_ has joined #lisp
<beach> rk[ghost]: Glad you like the paper.
<fiddlerwoaroof> aeth: yeah, I don't really care about the syntax highlighting, but I find that the colons really annoy me when I'm trying to read the loop
<rk[ghost]> beach: i must be honest though, i mostly skimmed it
<rk[ghost]> i enjoyed learning about the metacircular interpreter in college.
<beach> rk[ghost]: Sure. I don't expect many people to understand it. All I can hope is that the referees think it is worthwhile.
<rk[ghost]> bootstrapping is always my #1 probably in life
<rk[ghost]> s/probably/problem
<rk[ghost]> and that goes for every realm of said 'life'
<rk[ghost]> need computers to fix computers, need food to power foraging for food, new shelter to have space to build shelters
<rk[ghost]> i'd like to go thru it again, when i have more time to concentrate
Necktwi has quit [Quit: leaving]
<rk[ghost]> AMOP was a really great book, i very much enjoyed reading that in college..
Necktwi has joined #lisp
<rk[ghost]> oi, that is a strange thing to say
<rk[ghost]> someone i enjoyed reading about.. programming.. in college.
lmy9900 has joined #lisp
arbv has quit [Ping timeout: 276 seconds]
arbv has joined #lisp
<rk[ghost]> i suppose i am confused on how to use (read) in this case.. as how to cast a file to a stream? (read #P"/my/file.lisp") isn't correct XD
lmy9900__ has joined #lisp
lmy9900 has quit [Ping timeout: 240 seconds]
nikal has joined #lisp
<no-defun-allowed> (open pathname)
makomo has quit [Ping timeout: 250 seconds]
<shka_> rk[ghost]: this is not file, just path
lmy9900 has joined #lisp
KingRiver has joined #lisp
lmy9900__ has quit [Ping timeout: 246 seconds]
KingRiver has quit [Remote host closed the connection]
<beach> clhs with-open-file
lmy9900_ has joined #lisp
lmy9900__ has joined #lisp
lmy9900 has quit [Ping timeout: 250 seconds]
shka_ has quit [Ping timeout: 260 seconds]
lmy9900_ has quit [Ping timeout: 268 seconds]
<no-defun-allowed> yes, with-open-file as beach pointed out is much more convenient than just open since it handles closing the file after the body is run
lmy9900__ has quit [Ping timeout: 252 seconds]
<rk[ghost]> oh wahoo! i finally got my terminal back
<rk[ghost]> -.-
<rk[ghost]> i had the strange occurence of the terminal being absurdly unresponsive.. gee that was frustrating..
<rk[ghost]> and yet i was connect to the same machine on another user and no issues there..
xrash has joined #lisp
fikka has joined #lisp
acolarh has quit [Ping timeout: 245 seconds]
fikka has quit [Ping timeout: 250 seconds]
<rk[ghost]> beach: ah, ha thanks.
<rk[ghost]> so what i was looking for was (with-open-file (my-file "/my/file.lisp") (read my-file))
emaczen has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
lmy9900 has joined #lisp
shrdlu68 has joined #lisp
<rk[ghost]> clhs filter
<specbot> Couldn't find anything for filter.
lmy9900_ has joined #lisp
makomo has joined #lisp
<no-defun-allowed> clhs remove-if
<no-defun-allowed> use that or its opposite, remove-if-not
<rk[ghost]> aye aye, thanks.
lmy9900 has quit [Ping timeout: 250 seconds]
lmy9900 has joined #lisp
<no-defun-allowed> bonus points if you write a PARTITION that takes one function and spits out both in one pass
<rk[ghost]> if i am dealing with strings, any good list for boolean functions for searching strings? like contains a substring, ect?
acolarh has joined #lisp
<rk[ghost]> hmm.
lmy990___ has joined #lisp
<no-defun-allowed> search for subsequences and find work on strings
lmy9900_ has quit [Ping timeout: 268 seconds]
lmy9900_ has joined #lisp
nirved has joined #lisp
lmy9900 has quit [Ping timeout: 244 seconds]
<rk[ghost]> by the bonus point challenge you mean something that for instance (my-partition #'parity '(1 2 3 4 5 6)) -> ((1 3 5) 2 4 6) ?
lmy990___ has quit [Ping timeout: 264 seconds]
siraben has joined #lisp
lmy9900 has joined #lisp
<jackdaniel> (collecting (o e) (mapc #'(lambda (elt) (if (oddp elt) (o elt) (e elt))) *list*) (cons (o) (e)))
<no-defun-allowed> pretty much but i was thinking returning both using VALUES
lmy9900_ has quit [Ping timeout: 268 seconds]
<jackdaniel> then (values (o) (e))
lmy990___ has joined #lisp
<no-defun-allowed> but yes that's it
<rk[ghost]> well, i presume no-defun-allowed meant it to be generic such that for any boolean function it would return (values (o) (e))
<no-defun-allowed> i did one before as a compromise for "what would filter do?" but it wasn't using iterate...iterators? just push and nreverse
<jackdaniel> rk[ghost]: then replace (oddp elt) with (funcall foo elt)
lmy9900_ has joined #lisp
<rk[ghost]> jackdaniel: aye, thanks actually :)
<no-defun-allowed> sml calls it List.partition and partition's a pretty good name for it IMO
<jackdaniel> also collecting (or collect) is not part of common lisp standard
<jackdaniel> uiop has a (buggy! I don't remember the actual example) while-collecting macro, but I'd recommend using one taken from cmuutil (http://ix.io/1udU)
lmy9900 has quit [Ping timeout: 250 seconds]
<jackdaniel> I wonder if alexandria would accept this macro (given it is like a thousand years old)
Necktwi has quit [Quit: leaving]
lmy990___ has quit [Ping timeout: 240 seconds]
lmy9900 has joined #lisp
lmy9900_ has quit [Ping timeout: 252 seconds]
<no-defun-allowed> i did make a right-way-around-cl-arrows but it's not as flexible as the real one yet
lmy9900_ has joined #lisp
lmy9900 has quit [Ping timeout: 240 seconds]
scymtym has quit [Ping timeout: 244 seconds]
lmy9900 has joined #lisp
arbv has quit [Ping timeout: 250 seconds]
hiroaki has joined #lisp
lmy9900_ has quit [Ping timeout: 250 seconds]
arbv has joined #lisp
shifty has joined #lisp
lmy9900_ has joined #lisp
lmy9900 has quit [Ping timeout: 246 seconds]
lmy9900 has joined #lisp
lmy9900_ has quit [Ping timeout: 250 seconds]
lmy9900__ has joined #lisp
lmy9900 has quit [Ping timeout: 268 seconds]
lmy9900__ has quit [Ping timeout: 272 seconds]
angavrilov has joined #lisp
lmy9900 has joined #lisp
lmy9900_ has joined #lisp
xkapastel has joined #lisp
lmy9900 has quit [Ping timeout: 250 seconds]
lmy9900 has joined #lisp
fikka has joined #lisp
lmy9900__ has joined #lisp
lmy9900_ has quit [Ping timeout: 272 seconds]
lmy990___ has joined #lisp
lmy9900 has quit [Ping timeout: 268 seconds]
lmy9900__ has quit [Ping timeout: 244 seconds]
Guest47970 has joined #lisp
jello_pudding has quit [Remote host closed the connection]
jello_pudding has joined #lisp
lmy9900_ has joined #lisp
lmy990___ has quit [Ping timeout: 250 seconds]
lmy9900__ has joined #lisp
lmy9900_ has quit [Ping timeout: 250 seconds]
lmy9900 has joined #lisp
<dim> hi
<no-defun-allowed> hey dim
lmy9900__ has quit [Ping timeout: 260 seconds]
lmy9900_ has joined #lisp
<dim> jackdaniel: as a bit of feedback, I find it hard to get at McCLIM documents for users, like how to implement a presentation thingy, do I need to implement one, how to pick a font-face / list available font-face names / render unicode, how to implement a pointer-button-press-event, etc
lmy9900__ has joined #lisp
elderK has joined #lisp
lmy9900 has quit [Ping timeout: 264 seconds]
<jackdaniel> dim: thank you
<jackdaniel> dim: for text, I'd recommend using http://bauhh.dyndns.org:8000/clim-spec/11-1.html#_569 for now (make-text-style), which maps portably to available fonts
<jackdaniel> font abstraction is not documented (and not part of CLIM original spec, because fonts are port-specific things)
lmy9900_ has quit [Ping timeout: 240 seconds]
<jackdaniel> unicode is supported (we use DejaVu fonts by default)
<jackdaniel> regarding presentations: McCLIM manual has an example of how to do that. basically: define-presentation-type is akin defclass. you may look at Examples/hierarchy-tool.lisp or mcclim manual draft to see how they are used
lmy9900 has joined #lisp
jochens has joined #lisp
<splittist> morning
<jackdaniel> pointer-button-press-event, pointer click is a gesture called select (events are lower abstraction), you may study gadgets.lisp (push-button-pane) to see how events are handled, otoh select gesture is by default for selecting command arguments (there is also presentation-to-command-translator http://bauhh.dyndns.org:8000/clim-spec/edit/apropos?q=presentation-to-command-translator)
<jackdaniel> and yes, I agree that we need better (and more of it) learning material
lmy9900__ has quit [Ping timeout: 268 seconds]
scymtym has joined #lisp
<elderK> Hey all :)
<minion> elderK, memo from pjb: notice that p-lists are faster than hash-table when they have fewer than 5-35 elements, depending on the implementation. Also, hash-tables have a size overhead that is way bigger than p-list. So if you need to put just one or two entries on thousands or millions of symbols, better use the symbol-plist. On the other ahnd, if you need to put thousands of entries on a few symbols, then better hash-tables.
<minion> elderK, memo from pjb: In both cases, if you attach attributes to symbols at compilation time, you must ensure that data is passed over to run-time if you need it at run-time. basically: (defmacro x (s) (setf (getf (symbol-plist s) 'your-attribute) 'your-value) `(progn (setf (getf (symbol-plist ',s) 'your-attribute) 'your-value) … ))
Cymew has joined #lisp
JohnMS_WORK has joined #lisp
<elderK> I spent a lot of time on the road today, in transit between cities. I spent it wisely, imo, reading CLtL2 and CLHS, lots of things but particularly studying about the compilation environment, and effect of various things like defun, defmacro, structures etc, wrt compilation.
<elderK> I would be interested in how I can adequately test that everything is as it should be, eval-whens when needed, that things that should be visible, are visible, at macro expansion time, etc.
<elderK> My system can load fine on SBCL and CCL using ASDF. Freshly loaded instances of those systems. But, that to me doesn't make sense - as far as I understand, my system should fail to load.
<elderK> So, I'd really like to separate out the phases if I can, to really... check things
<elderK> pjb: Thank you for your response regarding plists. I appreciate it.
<jackdaniel> then you should create your load.lisp file which loads your system in terms of compile-file and load
<jackdaniel> and test from that
<jackdaniel> ASDF is complicated (often for a good reason) with its plans to load things
<elderK> jackdaniel: Thank you. It sounds like a good thing to investigate, too, to get a better appreciation for ASDF, too.
<elderK> Although I do use Alexandria. It's not a hard dependency - there's nothing in it I cannot build myself but, you know, I figured use Alexandria.
<jackdaniel> also note, that clhs gives you requierments, but implementation may do "better". for instance defconstant in sbcl is visible if toplevel to forms following it in next files, in ccl not so much (you need to either warp it in eval-when or have it in the previous file)
<elderK> Other than having (asdf:load-system "alexandria") in the "load.lisp", I'm not sure how I'd go about arranging for it to be present.
lmy9900 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jackdaniel> that should be fairly easy, hang on a minute
<dim> jackdaniel: hey thanks for the answers! I'll read this new material and try and figure things out!
<dim> about the presentation thing, I want to have my own clickable (select-able) objects, a grid of say 10x20 of them, and at the moment they're just rectangles being drawn, not gadgets, and I just don't know if I should make them gadgets or just handle the select event in the frame, get the coordinates and figure it out myself
gxt has quit [Ping timeout: 252 seconds]
lmy9900 has joined #lisp
nikal has quit [Quit: Konversation terminated!]
<jackdaniel> check out Examples/puzzle.lisp demo
<dim> (clim:make-text-style :sans-serif :bold :large) still can't display ♣
<dim> I will, thanks
<dim> well now I should get to work rather than play with McCLIM, but well, maybe late tonight I'll be able to play around again
<beach> Please do! :)
lmy9900_ has joined #lisp
<jackdaniel> elderK: you may load it with asdf first and then experiment with load/compile-file on your own
<jackdaniel> but you may load alexandria without asdf like this: http://ix.io/1utu (change paths etc)
<dim> goal 1: minesweeper in McCLIM, goal 2: racket tutorial with images in McCLIM, hopefully with a pane having a lisp editor and a pane with a REPL like thingy that can also display images, handling positions for you I guess
<dim> goal 2 is so far fetched...
<scymtym> jackdaniel: when dim asked about fonts yesterday, i said https://irclog.tymoon.eu/freenode/%23lisp?around=1543190146#1543190146 . is there a better way?
lmy9900 has quit [Ping timeout: 252 seconds]
<dim> scymtym: oh I wasnt' around anymore when you said that, thanks for pointing it now again!
<elderK> jackdaniel: Thank you!
lmy9900 has joined #lisp
<elderK> jackdaniel: I assume a good test would be to compile everything, but not actually load it until everything had been compiled.
<elderK> I'm not sure if that's sensible or anything yet, I will have to read more :)
lmy9900__ has joined #lisp
<elderK> But it seems like it would be a good test to make sure my stuff isn't relying on any side-effects that are you know, not guaranteed to happen during compilation.
<scymtym> dim: sure. i just suggested that as stopgap solution until someone more familiar with the subject could point out a better solution
<elderK> That'd help me better learn how/when to use eval-when, too.
<jackdaniel> there is, and it is part of clime: (port-all-font-families port) and on results you may call (font-family-all-faces …) and (font-face-all-sizes …)
<jackdaniel> but sadly not documented (afaik); Examples/font-selector.lisp shows (in a messy way) how to use that
<jackdaniel> making a text style with arbitrary names will most likely fail on other backends (pdf/postscript etc)
lmy9900_ has quit [Ping timeout: 264 seconds]
<jackdaniel> elderK: sounds like a good plan for experiments
lmy9900 has quit [Ping timeout: 244 seconds]
<elderK> jackdaniel: An unrelated question: What's the deal with any errors encountered during write-sequence?
<elderK> I see that read-sequence returns the position of the unwritten-element. Like, the one after what was read. So, you can test how many was succesfully read.
<elderK> But the write-sequence thing mentions FA about errors other than type errors.
<elderK> I know file-error exists, so, I'm curious as to whether that is generated by write-sequence if, for whatever reason, it cannot write to the stream.
lmy9900_ has joined #lisp
<elderK> write-char and write-byte unfortunately shed little light on the subject.
lmy9900__ has quit [Ping timeout: 250 seconds]
lmy9900__ has joined #lisp
<jackdaniel> I'm afraid I can't help you, I'm not sure where that would be described in clhs. but I would indeed expect that file-error (or something similar) happens at some cases
<jackdaniel> otoh we do not expect cl:list to list heap exhaustion as one of the exceptional situations
lmy990___ has joined #lisp
<elderK> Googling didn't yield much helpful info, either.
<elderK> :(
<shrdlu68> Don't think I've seen file-error ever, it's more common to see end-of-file.
<jackdaniel> The type file-error consists of error conditions that occur during an attempt to open or close a file, or during some low-level transactions with a file system. The ``offending pathname'' is initialized by the :pathnameinitialization argument to make-condition, and is accessed by the function file-error-pathname. (from file-error)
<shrdlu68> Or stream-error.
<jackdaniel> so write-sequence, if it implies a low level transaction which may error, could signal file-error
<dim> ok when using (setf mcclim-truetype::*truetype-font-path* "#P/Users/dim/Library/Fonts/") (mcclim-truetype::autoconfigure-fonts) in the REPL then I could have ♣ display properly with (clim:make-text-style :serif :bold 24)
<dim> thanks scymtym
lmy9900_ has quit [Ping timeout: 268 seconds]
lmy9900__ has quit [Ping timeout: 244 seconds]
heisig has joined #lisp
<elderK> jackdaniel: I guess I could play with it, like, experimentally :P Give read only access to a file, and try and write to it. Or, have a file that is writable but on an tmpfs with very little space.
<elderK> And see if file-error is generated, etc.
lmy990___ has quit [Ping timeout: 272 seconds]
buhman has quit [Ping timeout: 272 seconds]
buhman has joined #lisp
orivej has quit [Ping timeout: 250 seconds]
Achylles has joined #lisp
Necktwi has joined #lisp
lmy9900 has joined #lisp
varjag has joined #lisp
l1x_ has joined #lisp
pent_ has joined #lisp
sz0_ has joined #lisp
varjag has quit [Ping timeout: 252 seconds]
lmy9900_ has joined #lisp
JohnMS has joined #lisp
lmy9900__ has joined #lisp
lmy9900 has quit [Ping timeout: 252 seconds]
JohnMS_WORK has quit [Ping timeout: 245 seconds]
sz0 has quit [*.net *.split]
mgsk has quit [*.net *.split]
kjeldahl has quit [*.net *.split]
pent has quit [*.net *.split]
xristos has quit [*.net *.split]
l1x has quit [*.net *.split]
antoszka has quit [*.net *.split]
l1x_ is now known as l1x
lmy9900_ has quit [Ping timeout: 268 seconds]
sz0_ is now known as sz0
pent_ is now known as pent
lmy9900 has joined #lisp
irdr has quit [Remote host closed the connection]
lmy9900__ has quit [Ping timeout: 246 seconds]
irdr has joined #lisp
lmy9900_ has joined #lisp
robotoad has quit [Quit: robotoad]
antoszka has joined #lisp
kjeldahl has joined #lisp
lmy9900 has quit [Ping timeout: 250 seconds]
elfmacs has joined #lisp
dddddd has joined #lisp
anewuser has quit [Ping timeout: 252 seconds]
lmy9900_ has quit [Ping timeout: 272 seconds]
varjag has joined #lisp
lmy9900_ has joined #lisp
lmy9900__ has joined #lisp
lmy990___ has joined #lisp
lmy9900 has joined #lisp
lmy9900_ has quit [Ping timeout: 272 seconds]
lmy9900__ has quit [Ping timeout: 272 seconds]
lmy990___ has quit [Ping timeout: 272 seconds]
lmy9900_ has joined #lisp
lmy9900 has quit [Ping timeout: 240 seconds]
elfmacs has quit [Ping timeout: 268 seconds]
lmy9900_ has quit [Ping timeout: 268 seconds]
lmy9900 has joined #lisp
lmy9900_ has joined #lisp
lmy9900 has quit [Ping timeout: 268 seconds]
lmy9900 has joined #lisp
Achylles has quit [Remote host closed the connection]
lmy9900_ has quit [Ping timeout: 246 seconds]
lmy9900_ has joined #lisp
lmy9900__ has joined #lisp
lmy9900 has quit [Ping timeout: 272 seconds]
lmy9900_ has quit [Ping timeout: 245 seconds]
lmy9900 has joined #lisp
lmy9900__ has quit [Ping timeout: 240 seconds]
mingus has quit [Remote host closed the connection]
lmy9900__ has joined #lisp
lmy9900 has quit [Ping timeout: 268 seconds]
lmy990___ has joined #lisp
lmy9900 has joined #lisp
makomo has quit [Ping timeout: 268 seconds]
lmy9900__ has quit [Ping timeout: 244 seconds]
lmy990___ has quit [Ping timeout: 245 seconds]
Mr-Potter has joined #lisp
lmy9900_ has joined #lisp
lmy9900 has quit [Ping timeout: 244 seconds]
lmy9900 has joined #lisp
lmy9900_ has quit [Ping timeout: 246 seconds]
lmy9900_ has joined #lisp
lmy9900 has quit [Ping timeout: 268 seconds]
lmy9900 has joined #lisp
mingus has joined #lisp
lmy9900_ has quit [Ping timeout: 272 seconds]
pjb has quit [Remote host closed the connection]
lmy9900 has quit [Ping timeout: 245 seconds]
pjb has joined #lisp
robdog has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
lmy9900 has joined #lisp
lmy9900 has quit [Client Quit]
xrash has quit [Ping timeout: 250 seconds]
SaganMan has joined #lisp
fikka has quit [Ping timeout: 260 seconds]
ski has quit [Ping timeout: 268 seconds]
fikka has joined #lisp
igemnace has quit [Quit: WeeChat 2.3]
fikka has quit [Ping timeout: 246 seconds]
fikka has joined #lisp
ski has joined #lisp
orivej has joined #lisp
Mr-Potter has quit [Ping timeout: 246 seconds]
v0|d has quit [Remote host closed the connection]
hiroaki has quit [Ping timeout: 245 seconds]
Zaab1t has joined #lisp
Kaisyu has quit [Quit: Connection closed for inactivity]
fikka has quit [Ping timeout: 245 seconds]
Bike has joined #lisp
Lord_Nightmare has quit [Quit: ZNC - http://znc.in]
Lord_Nightmare has joined #lisp
vlatkoB_ has joined #lisp
vlatkoB has quit [Ping timeout: 244 seconds]
fikka has joined #lisp
m00natic has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
steiner has joined #lisp
steiner has quit [Remote host closed the connection]
elfmacs has joined #lisp
ggole has joined #lisp
Mr-Potter has joined #lisp
Mr-Potter has quit [Ping timeout: 240 seconds]
robdog has quit [Remote host closed the connection]
fikka has joined #lisp
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
anewuser has joined #lisp
thodg has joined #lisp
thodg has quit [Client Quit]
confusedwanderer has joined #lisp
thodg has joined #lisp
graphene has quit [Remote host closed the connection]
Essadon has joined #lisp
Essadon has quit [Max SendQ exceeded]
Essadon has joined #lisp
graphene has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
nicksmaddog has joined #lisp
fikka has joined #lisp
Bike is now known as Bicyclidine
lmy9900 has joined #lisp
lmy9900 has quit [Client Quit]
gxt has joined #lisp
rocx has quit [Remote host closed the connection]
kyby64 has joined #lisp
nikka has joined #lisp
esrse has quit [Ping timeout: 250 seconds]
joast has quit [Quit: Leaving.]
bradfonseca has joined #lisp
shifty has quit [Ping timeout: 250 seconds]
solyd has joined #lisp
FreeBirdLjj has joined #lisp
joast has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
nicksmaddog has quit [Quit: Leaving]
hiroaki has joined #lisp
nicksmaddog has joined #lisp
fikka has quit [Ping timeout: 252 seconds]
Kaisyu has joined #lisp
mason has left #lisp [#lisp]
fikka has joined #lisp
xrash has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
gxt has quit [Ping timeout: 264 seconds]
warweasle has joined #lisp
elfmacs has quit [Ping timeout: 252 seconds]
fikka has quit [Ping timeout: 264 seconds]
makomo has joined #lisp
Inline has joined #lisp
anamorphic has joined #lisp
kajo has quit [Ping timeout: 264 seconds]
nika has joined #lisp
nikka has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
rippa has joined #lisp
LiamH has joined #lisp
ebrasca has joined #lisp
gxt has joined #lisp
sjl_ has joined #lisp
ebrasca has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
rpg has joined #lisp
heisig has quit [Quit: Leaving]
shrdlu68 has quit [Quit: WeeChat 2.2]
svillemot has quit [Ping timeout: 252 seconds]
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
robotoad has joined #lisp
nika has quit [Ping timeout: 250 seconds]
kajo has joined #lisp
svillemot has joined #lisp
rpg has quit [Ping timeout: 268 seconds]
rumbler31 has joined #lisp
rumbler31 has quit [Remote host closed the connection]
jkordani has joined #lisp
wilfredh has quit [Quit: Connection closed for inactivity]
thodg has quit [Ping timeout: 245 seconds]
solyd has quit [Ping timeout: 272 seconds]
nicksmaddog has quit [Ping timeout: 252 seconds]
robotoad has quit [Quit: robotoad]
wilfredh has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
gxt has quit [Ping timeout: 250 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
gxt has joined #lisp
nika has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
easye has joined #lisp
nikka has joined #lisp
nika has quit [Ping timeout: 240 seconds]
eminhi has joined #lisp
thinkpad has quit [Ping timeout: 268 seconds]
Guest47970 has quit [Ping timeout: 264 seconds]
fikka has joined #lisp
robotoad has joined #lisp
FreeBirdLjj has joined #lisp
thinkpad has joined #lisp
josh5tone has joined #lisp
fikka has quit [Ping timeout: 250 seconds]
lavaflow has quit [Ping timeout: 240 seconds]
SaganMan has quit [Quit: WeeChat 1.6]
orivej has quit [Ping timeout: 272 seconds]
ebrasca has joined #lisp
anamorphic has quit [Quit: anamorphic]
Guest47970 has joined #lisp
nikka has quit [Ping timeout: 250 seconds]
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
thodg has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
frgo has quit [Ping timeout: 240 seconds]
lumm has joined #lisp
nikka has joined #lisp
Bike has joined #lisp
wigust has joined #lisp
anamorphic has joined #lisp
kajo has quit [Ping timeout: 252 seconds]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
pjb has quit [Remote host closed the connection]
nika has joined #lisp
pjb has joined #lisp
nikka has quit [Ping timeout: 250 seconds]
malice has joined #lisp
JohnMS has quit [Read error: Connection reset by peer]
tryingoutlisp has joined #lisp
<tryingoutlisp> Hello
fikka has joined #lisp
nikka has joined #lisp
<beach> Hello tryingoutlisp.
<tryingoutlisp> I've been trying out Lisp for a few days for a work project.
<tryingoutlisp> And I've ran into some issues. So here I am.
<beach> I am sure a lot of people here would be happy to help if they can.
nika has quit [Ping timeout: 250 seconds]
nika has joined #lisp
<tryingoutlisp> Of course, I'm sure it's only kindergarten errors. I'm still warming up.
<tryingoutlisp> I ran into issues trying to use let.
<beach> If they are really trivial, we will point you to #clschool.
<tryingoutlisp> I get an unbound-variable error. Let me pastebin an example so I can show you.
<tryingoutlisp> Oh, right, I didn't know that channel.
<pjb> http://cliki.net/IRC gives a list of channels.
rpg has joined #lisp
nikka has quit [Ping timeout: 252 seconds]
<pjb> http://cliki.net/Online+Tutorial gives a list of tutorials
<pjb> What a suspens!
Kaisyu has quit [Quit: Connection closed for inactivity]
xrash has quit [Remote host closed the connection]
shka_ has joined #lisp
cage_ has joined #lisp
shka_ has quit [Read error: Connection reset by peer]
shka_ has joined #lisp
shka_ has quit [Read error: Connection reset by peer]
nikka has joined #lisp
nika has quit [Ping timeout: 250 seconds]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
nika has joined #lisp
jochens has quit [Remote host closed the connection]
kajo has joined #lisp
jochens has joined #lisp
doubledup has joined #lisp
nikka has quit [Ping timeout: 268 seconds]
doubledup has quit [Max SendQ exceeded]
doubledup has joined #lisp
anewuser has quit [Read error: Connection reset by peer]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
elderK has quit [Ping timeout: 240 seconds]
graphene has quit [Remote host closed the connection]
jochens has quit [Ping timeout: 272 seconds]
graphene has joined #lisp
jkordani_ has joined #lisp
nikka has joined #lisp
jkordani has quit [Ping timeout: 272 seconds]
Necktwi has quit [Quit: leaving]
nika has quit [Ping timeout: 252 seconds]
Mr-Potter has joined #lisp
Necktwi has joined #lisp
jmercouris has joined #lisp
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
flazh has joined #lisp
<jmercouris> so, I'm running (bt:make-thread (lambda () (uiop:run-program "xyz"))), how can I know when xyz has started?
<jmercouris> mind you, xyz is a long-running process, and will continue to run, it's not like I'm looking for an exit code or anything
Necktwi has quit [Quit: leaving]
<jmercouris> is what I am asking impossible?
Necktwi has joined #lisp
<flip214> jmercouris: well, what means "running"?
<jmercouris> yes, it seems I'll have to write a signal from the port
<jmercouris> because "running" is indeed too ambiguous
<flip214> for a true "initialized and up for service", you'll need to monitor STDOUT or so.
<jmercouris> yeah
<flip214> or you look at the child process' CPU usage - and after 1 sec or so you know it's "up" (and not crashed yet)
<|3b|> looks like there is uiop:launch-program which runs something in background
<flip214> or you can use ptrace and see when it has reached some important point (listening socket open, etc.)
<|3b|> but yeah, if you need to interact with it, probably better to just have it tell you when it is ready if possible
<jmercouris> I will have it tell me, it will send a signal
<flip214> jmercouris: is there some external effect you can watch for? like a http server which you can ask for /status or so?
<flip214> jmercouris: signals are not that easy to handle correctly; even less so in multi-threaded programs.
<jmercouris> yes there is, but I would have to loop on connection refused
<flip214> jmercouris: right.
<flip214> or you can wait for a pipe to become read- or writable.
<jmercouris> you're convincing me :D
nika has joined #lisp
<flip214> good!
<flip214> might be the first time somebody else just accepts my experience that easily... ;)
<jmercouris> alright, so I get a condition
Bronsa has joined #lisp
nikka has quit [Ping timeout: 244 seconds]
<jmercouris> Socket error in "connect": ECONNREFUSED (Connection refused)
<jmercouris> [Condition of type SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR]
<jmercouris> however, this will be my first time working with conditions
<jmercouris> so I'm not sure how to loop on retrying the command until I don't get a connection-refused-error
<jmercouris> I guess something like (handler-case econnrefused (try-command-again))?
v0|d has joined #lisp
<jmercouris> man I feel like such a noob
<fortitude> jmercouris: you might want to use that handler case in a function that returns T or NIL based on whether the connect succeeded
<fortitude> then you can loop until that result is T
<jmercouris> fortitude: so that the exception case calls itself?
<jmercouris> the function itself*?
<jmercouris> or do you literally mean loop?
<fortitude> jmercouris: you /can/ do that, or set up a continue restart, but I wouldn't
<fortitude> I'd stick with a plain old loop
<jmercouris> I'm sorry, I'm very much a noob with regards to this part of common lisp
<jmercouris> this is the line that triggers that error if the other program is not yet ready
<fortitude> jmercouris: if it helps, handler-case is known as try/catch in other languages, so if you've ever used that before, you can do the same sort of things
<jmercouris> I don't even know how I would do what you are saying in a loop format
<jmercouris> (make-window) in the above code is making the XML-RPC call which depends on the other program to be running
<dlowe> jmercouris: that's probably the sort of thing you want
<jmercouris> dlowe: ah, so you set the loop expression it is looking out for within the cases
<jmercouris> I get it
<jmercouris> sorry, I mean outside the case
<jmercouris> so if the above call doesn't trigger a case, it'll keep looping
<jmercouris> let me give it a try and see how it goes
orivej has joined #lisp
shka_ has joined #lisp
* |3b| tends to just loop on 2nd value of ignore-errors when i'm expecting lots of errors :p
m00natic has quit [Remote host closed the connection]
<dlowe> ah, the try-catch-ignore pattern
<dlowe> I want to know when and how things break
<|3b|> yeah, ideally it would check the type of the error
<|3b|> so doesn't have to be 'ignore'
<dlowe> the temptation though :D
<|3b|> :)
<jmercouris> can someone tell me how this code is wrong: https://pastebin.com/Y4AmGyrD ?
<jmercouris> it looks exactly like what dlowe posted, but maybe not?
<fortitude> jmercouris: your handler-case form doesn't have any error clauses, and your handler-bind form doesn't have a body (they're two separate ways of handling errors)
<fortitude> what you want is (handler-case <your thing> ((sb-bsd-sockets:connection-refused-error () <your handling code>)))
FreeBirdLjj has quit [Remote host closed the connection]
<dlowe> jmercouris: ignore the handler-bind clause - I'm using that there for restarts
<jmercouris> ok, let me try again
<dlowe> handler-case will unwind the stack so that the restarts are unavailable
<jmercouris> fortitude: I was just about to get there, I swear!
figurelisp has joined #lisp
<jmercouris> the syntax reminds me of cond
<jmercouris> which I also always get wrong
figurelisp has left #lisp [#lisp]
<fortitude> jmercouris: if it makes you feel better, I can never remember which syntax goes with which form either
<fortitude> since they're not the same
doubledup has quit [Quit: Leaving]
<jmercouris> man, still no luck
<dlowe> don't pass a lambda to handler case
<jmercouris> just put the body right in there?
<dlowe> yes
<dlowe> did you not read the hyperspec on handler-case?
rpg has joined #lisp
<jmercouris> I did, but I didn't *read* it
anamorphic has quit [Quit: anamorphic]
<jmercouris> you know, I often look at the hyperspec, and I'm still not that good at understanding it
<jmercouris> maybe I am not so intelligent :D
<fortitude> jmercouris: the grammar notation can be a little tricky sometimes, but it helps if you pair it with the examples
tryingoutlisp has quit [Quit: tryingoutlisp]
Necktwi has quit [Quit: leaving]
anamorphic has joined #lisp
Necktwi has joined #lisp
tripty has quit [Ping timeout: 252 seconds]
tripty has joined #lisp
<jmercouris> is it possible to sleep for a fraction of a second?
<jmercouris> seems like!
<jmercouris> ok, I don't want to spam the server until it is ready
<malice> jmercouris: HYPERSPEC is imho a nice documentation that is very poorly written.
<malice> it lacks examples and the grammar specification isn't easy to read.
<dlowe> hm? It's not great, but it doesn't lack examples
<jmercouris> well, the grammar specification is something similar to bnf
<jmercouris> i just can't ever keep it in mind
<jmercouris> I have a terrible memory
<dlowe> I think the hyperspec is kind of poorly laid out
<malice> However, there is an effort by phoe called CLUS, short for COMMON LISP ULTRASPEC, which tries to provide a better hyperspec: http://phoe.tymoon.eu/clus/doku.php?id=cl:macros:handler-case
<jmercouris> I don't want to disparage the ultraspec project, but it is on permanent hiatus afaik
<dlowe> and one day it will be finished, maybe
<malice> it doesn't provide much more data, but the layout is nicer
<malice> dlowe: On more than one occasion I found that examples weren't clear enough or didn't showcase what I wanted to know (and I do not think I was looking for anything extraordinary).
<dlowe> okay, so insufficient examples
<malice> Right.
<malice> my bad :)
svillemot has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
<jmercouris> no malice intended :\
<jmercouris> ba dum tsh
lavaflow has joined #lisp
eminhi has quit [Ping timeout: 250 seconds]
scymtym has quit [Ping timeout: 252 seconds]
Necktwi has quit [Quit: leaving]
eminhi has joined #lisp
Necktwi has joined #lisp
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cmatei has joined #lisp
eminhi has quit [Client Quit]
thodg has quit [Ping timeout: 240 seconds]
Blukunfando has joined #lisp
Zaab1t has quit [Ping timeout: 240 seconds]
rpg has joined #lisp
nika has quit [Ping timeout: 245 seconds]
nika has joined #lisp
jmercouris has quit [Ping timeout: 250 seconds]
Necktwi has quit [Quit: leaving]
Necktwi has joined #lisp
nika has quit [Ping timeout: 240 seconds]
nika has joined #lisp
rpg has quit [Ping timeout: 246 seconds]
ggole has quit [Quit: ggole]
sauvin has quit [Ping timeout: 250 seconds]
nikka has joined #lisp
malice has quit [Ping timeout: 256 seconds]
nika has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 268 seconds]
Zaab1t has joined #lisp
nika has joined #lisp
v0|d has quit [Ping timeout: 252 seconds]
nikka has quit [Ping timeout: 268 seconds]
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
orivej has quit [Ping timeout: 250 seconds]
robotoad has quit [Read error: Connection reset by peer]
v0|d has joined #lisp
veddox has joined #lisp
robotoad has joined #lisp
fikka has joined #lisp
vlatkoB_ has quit [Remote host closed the connection]
<veddox> Hey everyone, I have a bit of a problem with usocket and I'm wondering whether somebody here might have the time to help...
<veddox> I have some Lisp experience, but haven't done any networking yet.
<veddox> Basically, I am working on a client-server game. The relevant code is here: https://gist.github.com/veddox/d0df0d6ea685a348d5674c30b2cdfe6d
<dlowe> you didn't say that problem
<veddox> I can create the server (`run-server`), and connect to it (`connect-server`), and `handle-connection` will confirm a connection has been made
<veddox> However, when I then call `query-server`, the string I send to the server socket won't arrive
<veddox> at least not until I close the client socket again with `disconnect`
<veddox> It appears the stream is not being flushed, but I do call `finish-output` (line 102), so I'm a bit baffled.
<veddox> that's the state of affairs at the moment...
<dlowe> (format servstr request) request should probably be a string or you shouldn't use FORMAT
<veddox> It is one. For test purposes I call it as (query-server "ACK") - which ought to return "ACK ACK"
<dlowe> I mean, use (format servstr "~a" request) or (princ request servstr)
<veddox> but thanks for the hint
<dlowe> otherwise if request contains a ~, you will get a surprising result
<sjl_> dlowe is saying that if your request happens to contain format directives, it'll do surprising things
<dlowe> this isn't your problem, but an aside
<veddox> good point
<dlowe> do you get the "waiting for server response" message?
<veddox> yes, I do
<sjl_> How do you know the string you're sending doesn't arrive? I see where you log the connection, but not where you log the strings you receive
<veddox> line 75
<veddox> in `answer`
<sjl_> Oh, there it is
<sjl_> Does (logging ...) flush its output? The strings don't end in newlines
<sjl_> I've had this bite me before -- everything's actually working, but my final log line was stuck in a buffer waiting to be flushed
<veddox> logging is a macro: (defmacro logging (str &rest format-args) `(write-to-file (format NIL ,str ,@format-args) *logfile* T))
<veddox> where *logfile* is specified with defparameter
<dlowe> (you could do this with a function (format *logfile* "~?" str format-args)
<sjl_> Okay, does (write-to-file ...) flush its output?
cage_ has quit [Quit: Leaving]
<dlowe> veddox: have you tried using a packet sniffer?
<veddox> `write-to-file` takes a string or a list of strings and writes them all to file (calling `open` directly), the closes the file connection
<veddox> @dlowe no I have not
pierpal has quit [Quit: Poof]
<veddox> I'm working locally at the moment. Would a packet sniffer work?
pierpal has joined #lisp
<dlowe> use the IP of your network interface instead of 127.0.0.1 and it should work fine
<dlowe> it *might* work fine over loopback
<dim> guys, McCLIM is interesting and fun to hack with, just saying ;-)
<veddox> so that would be to test whether the packet is actually sent?
<veddox> McCLIM?
<dim> a CL lib to handle GUIs
<sjl_> do you get the "received a connection" logging line?
<dlowe> veddox: right. if you know the packet is sent then you know a lot more about where the problem might be
<veddox> @sjl_ Yes I do. I get "received a connection", "sending request" and "waiting for server response"
<veddox> "received request 'ACK'" only comes once I disconnect the client
<sjl_> Oh, I see the problem
<sjl_> (query-server "ACK") is what you're doing
<sjl_> so you send the three characters A C K and flush the stream
<sjl_> but on the server side, you're saying (read-line)
<sjl_> which is looking for a newline
<sjl_> to terminate the line
<veddox> bingo
<sjl_> I knew it was something newline related :)
<veddox> let me test that, but sounds like you got it ;-)
<dlowe> also, does extract-elements return a symbol as a player name?
<veddox> yes
<veddox> it parses a string into a list of symbols
<sjl_> be careful wil parsing user-supplied input into symbols in a package -- since they don't get GC'ed you can exhaust the server's memory by just sending tons of symbols
<sjl_> s/wil/with/
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<sjl_> but, this is orthogonal to your socket issue
<veddox> OK, the server now receives the request :-)
<veddox> Unfortunately, the client still doesn't get the reply back :-(
<veddox> I've changed line 101 to (format servstr "~A~%" request)
<sjl_> line 71 is where the server replies, but that probably needs a newline as well
<sjl_> because the client is also doing read-line
<veddox> right! should have thought of that :-/ next attempt
<veddox> it works! :D :D
<veddox> Thank you very much for your help! I've been chasing that bug for a couple of days now :-)
<veddox> BTW dim: I'm using croatoan for ncurses
scymtym has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
elderK has joined #lisp
<elderK> Moin all :)
meepdeew has joined #lisp
slyrus1 has joined #lisp
veddox has quit [Quit: Leaving]
shka_ has quit [Ping timeout: 268 seconds]
slyrus1 has quit [Client Quit]
slyrus1 has joined #lisp
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
xkapastel has joined #lisp
angavrilov has quit [Remote host closed the connection]
anamorphic has quit [Quit: anamorphic]
anamorphic has joined #lisp
confusedwanderer has quit [Read error: Connection reset by peer]
<no-defun-allowed> morning elderK
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
kajo has quit [Ping timeout: 252 seconds]
<gendl> Hi, how do I join the Lisp Discord?
<dlowe> There's a lisp discord?
<pjb> Is there an emacs mode to access discord? If no emacs mode, it doesn't exist.
arbv has quit [Ping timeout: 260 seconds]
arbv has joined #lisp
varjag has joined #lisp
debsan has quit [Ping timeout: 272 seconds]
anamorphic has quit [Quit: anamorphic]
kajo has joined #lisp
anamorphic has joined #lisp
<no-defun-allowed> discord is absolutely proprietary
hiroaki has quit [Ping timeout: 272 seconds]
<elderK> Guys, is it standard practice to, when loading a "system" without ASDF, to compile a file, and load it immediately after?
<pjb> Of course.
<pjb> (load (compile-file "foo.lisp"))
<elderK> I may be misunderstanding compile-file, but as far as I know, each call of compile-file basically runs the compiler in a new environment, one based on the environment in effect when compile-file was called.
<pjb> elderK: notice that just compiling the file doesn't put the definitions compiled in the run-time environment!
<pjb> elderK: yes.
<elderK> So, to compile a whole system, you compile the files, load them, which brings their stuff into the environment ready fro the next compile-file to use.
<pjb> But note for example:
<Xach> elderK: it is common to compile a file and load the fasl.
<pjb> clhs defun
svillemot has joined #lisp
lumm has quit [Quit: lumm]
<pjb> "defun is not required to perform any compile-time side effects. In particular, defun does not make the function definition available at compile time. "
<elderK> pjb: Right, which is why if you use the function as part of compiling some file, you need to wrap it in an eval-when.
<pjb> So, just try it: Put (defun foo () 'foo) in a file foo.lisp, and (compile-file "foo.lisp") (foo) <- boom undefined function error!
lumm has joined #lisp
<pjb> elderK: exactly.
<pjb> And this is why asdf loads the compiled files before compiling the next ones.
<elderK> But, say, we compile/load file A. And it defines a function. When we compile file B after A, the function is available - since we loaded it from the compiled file A
<elderK> I think I understand why my system loaded and stuff now without problems :)
<pjb> If you just compiled a bunch of files, the definitions of one wouldn't even be known to the other you'd get undefined function errors while compiling B for functions defined in A.
frgo has joined #lisp
meepdeew has quit [Remote host closed the connection]
<pjb> To prevent the warnings, you could use (with-compilation-unit (mapc 'compile-file '("A" "B")))
Yaargh has joined #lisp
<elderK> So basically, unless you're using some function - or data generated somehow - during compilation of a file that defines that function or builds that data, you don't need eval-when.
<pjb> But (dolist (f '("A" "B")) (load (compile-file f))) works better, and you end with being able to call the functions in the REPL.
<pjb> yes.
<pjb> And you may not need to load the compiled file either.
<pjb> It's just like separate compilation in C.
<pjb> It's done in separate processes (it could be the case in a CL implementation too).
<pjb> loading the fasl file = linking.
<elderK> pjb: Thank you. It seems like, to actually compile a system defined in multiple files, you'd have no choice but to compile->load each file. Since, otherwise, stuff that one file needs, wouldn't be visible to it in the compilation environment.
<pjb> elderK: if there are dependencies between the files, they need to be loaded ot compile the next, yes.
<pjb> If two files don't have any dependencies, they can be compiled, without loading one or the other.
<elderK> I.e. compile-file always creates a new environment based on the one in effect at the time compile-file was called. Any changes the compiler makes to the environment during compilation, are not guaranteed to still be in effect once compile-file terminates.
<pjb> Indeed.
<elderK> :) Ah, I'm so glad this has clicked :)
<elderK> I was really puzzled as to why my system loaded fine for a bit :D
<pjb> It's the case in most image-based CL implementation. ecl may be different.
<pjb> asdf ensures it works nicely by loading them for you.
shifty has joined #lisp
Mr-Potter has quit [Quit: Leaving]
frgo has quit [Ping timeout: 246 seconds]
<elderK> pjb: Right, but ASDF is smart enough (via use of depends-on) to compile a bunch of independent things, without loading after each. Like, it'll load the things that are needed before the compilation of stuff that depends on those things, right?
<pjb> Yes.
<elderK> Neat:)
<pjb> This is why you should use :depends, instead of :serial t.
<elderK> I always use depends :)
<pjb> On the other hand, you must be careful to set them correctly and to update them :-)
anamorphic has quit [Ping timeout: 250 seconds]
<aeth> Too bad there's no parallel ASDF
<aeth> Developers will be having affordable 32-64 core CPUs soon.
<pjb> There was XCVB intent.
<elderK> pjb: Another question: What's the deal with IO errors encountered during write-sequence? Do they cause file-error to be signalled?
<pjb> elderK: they should.
mooshmoosh has joined #lisp
<aeth> Currently you can get an AMD x86-64 32 core / 64 threads for $1799 and next year there will be an AMD 64 core / 128 thread CPU for probably a few hundred more... and then the price will slowly come down over the next 10 years until every serious programmer has one, and then we'll really miss not having parallel compilation.
<elderK> pjb: :D Another question: Does call-next-method regenerate the applicable-method-list if necessary?
<pjb> yes.
<ebrasca> aeth: I like to have parallel copiling, do you plan to update ASDF?
<pjb> elderK: Well, actually, applicable-method-list is computed first.
<pjb> since it's needed to call the first method.
<aeth> Oh, and IBM's POWER isn't far behind AMD. And in some measures it could be ahead because it'll have fewer cores, but 4x hyperthreading instead of 2x
<aeth> ebrasca: ASDF is too complicated for me
<elderK> ebrasca: Hey!
<ebrasca> aeth: I have PC with Power9 but sbcl don't work on ppc64le.
<ebrasca> elderK: Hi
<elderK> pjb: I'm just curious because atm, I'm allowing you to specify a symbol as a parameter, rather than a concrete object. The method specializing on the symbol, just retrieves an object based on that symbol, and reinvokes the GF on the object.
<elderK> It'd be neat if I could call-next-method instead, since I'd assume that'd avoid reinvoking :around
<aeth> ebrasca: Take a look at this, this isn't easy to understand: https://github.com/fare/asdf/blob/master/lisp-action.lisp
<pjb> elderK: each time you call a GF, an applicable-method-list is computed. (But it may be cached).
<aeth> I think the hardest part about understanding ASDF is that you can't just navigate it with M-. because *your* version of ASDF is going to be "compiled" all into one file.
<elderK> pjb: So this is valid? (defgeneric f (a)) (defmethod f ((a symbol)) (call-next-method (get-thing a)) ?
<pjb> clhs call-next-method
<pjb> "When providing arguments to call-next-method, the following rule must be satisfied or an error of type error should be signaled: the ordered set of applicable methods for a changed set of arguments for call-next-method must be the same as the ordered set of applicable methods for the original arguments to the generic function. Optimizations of the error checking are possible, but they must not change the semantics of call-next-me
<pjb> elderK: just read clhs, it says it all! ;-)
<pjb> it is not valid.
<elderK> Ah, okay :)
<pjb> You need to make a new call to f.
<elderK> Darn, that means arounds will be invoked again :P
<jcowan> Call-next-method with new arguments is a Bad Thing.
<elderK> I'm using :around methods to force a certain default for optional arguments, for all methods on the GF.
<jcowan> Actually, IMO call-next-method is a Bad Thing itself.
anamorphic has joined #lisp
<pjb> jcowan: well, it works with optional and rest arguments. You can change those.
<elderK> Also, to perform type-checking in one place.
* jcowan nods.
<elderK> Still, I'd like to avoid redoing all that if I can.
<pjb> use another internal method or function.
<pjb> (defmethod f ((o c)) (%f (real-object o)))
<pjb> You can have :around on f, and nothing on %f, %f can even be a plain fucntion.
<elderK> Cool :)
<_death> elderK: in general I avoid optional/key params in generic functions.. instead I have an ordinary defun as the user's interface and it should call a generic function, the extender's interface
rozenglass has joined #lisp
<ebrasca> aeth: I am thinking someting like (add-job (perform-lisp-compilation ...))
<aeth> ebrasca: The problem with Lisp compilation is that there are globals that could be modified that have an effect on the compilation. For instance, some people for whatever reason decide to #+sbcl (setf sb-ext:*derive-function-types* t) even though that's imo the wrong thing to do as a library. There are also portable ones like *read-default-float-format*
<ebrasca> aeth: What if you compile more than 1 library at a time?
<jcowan> aeth: probably the moral is to compile-file only from a fresh Lisp instance each time. Slower but safer.
iAmDecim has joined #lisp
Bronsa` has joined #lisp
Yaargh has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Zaab1t has quit [Quit: bye bye friends]
<aeth> jcowan: But *you* as the user might want to change those values around
<aeth> I think the way to do it would be to track all of the "default" globals (i.e. ones that come with the implementation), which can be implementation-specific, and restore them to the default value after each system, which could be different from their actual default value if the user wants something like *read-default-float-format* as 'double-float
<aeth> (Also, if run from SLIME, all of the stream globals would have different values from the original without the user explicitly setting them.)
<Xach> i done got bit by that a few times
Inline has quit [Ping timeout: 264 seconds]
debsan has joined #lisp
Inline has joined #lisp
<elderK> Is there a convention for like, exporting symbols that are meant for public use, and naming those that are exported but intended for developers?
<aeth> There are still two complicating factors that I can think of right now: (1) *features* is designed to be appended to and (2) this only allows parallel compilation for independent libraries because once you get A depending on B, B could introduce its own globals that A depends on.
<elderK> _death: Say, I use read-from as the public-facing API for reading some binary type. It does type checks, defaulting, etc.
* |3b| uses %foo something like that
<|3b|> or %foo:bar
Inline has quit [Read error: Connection reset by peer]
<elderK> Cool :)
<elderK> |3b|: Do you prefix types with the % too?
Inline has joined #lisp
<|3b|> %foo is generally a sort of "internal/dangerous" marker
<|3b|> actually i guess i mostly just do %package:foo rather than package:%foo
<|3b|> though usually when i do either, they are intended for other people to use
<|3b|> "exported" = "for other people to use", unless the entire package is internal
sz0 has quit [Quit: Connection closed for inactivity]
nika has quit [Quit: Konversation terminated!]
kyby64 has quit [Quit: Leaving]
frgo has joined #lisp
lumm has quit [Quit: lumm]
anamorphic_ has joined #lisp
<ebrasca> How to balance learning new thinks and writing code?
anamorphic has quit [Ping timeout: 268 seconds]
anamorphic_ is now known as anamorphic
<|3b|> write code that makes you learn new things, or try to find better ways to wrfite your code
frgo has quit [Ping timeout: 268 seconds]
<ebrasca> |3b|: And how to balance write code and search for better code?
<whartung> better to do new things in new code than redoing old code. in the end you know more, and your projects do more rather than just polishing the same wheel over and over and over again.
sjl_ has quit [Ping timeout: 268 seconds]
varjag has quit [Ping timeout: 250 seconds]
Bike has quit []
Kaisyu has joined #lisp
LiamH has quit [Quit: Leaving.]
<aeth> I disagree. I'd do the exact opposite and just continue improving the same old thing.
Kundry_Wag has joined #lisp
<aeth> Take what you learn and fix your old, ugly code with a new style
<whartung> all depends on your goals.
fikka has quit [Ping timeout: 268 seconds]
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
mooshmoosh has quit [Ping timeout: 268 seconds]
mejja has joined #lisp
Essadon has quit [Quit: Qutting]
Kundry_Wag has quit [Remote host closed the connection]