[df] has quit [Read error: Connection reset by peer]
ft has joined #lisp
[df] has joined #lisp
loskutak has quit [Ping timeout: 245 seconds]
<beach>
flip214: I recommend using genitive 's only for proper names. If you write "the suffix of the file" instead of "the file's suffix", you get the additional advantage that the important word (i.e. "suffix") comes first.
jkvl has joined #lisp
<beach>
flip214: I also suggest you follow the recommendations on page 13 of the LUV slides.
<beach>
In your case, it means not using CALLBACK as a Boolean, and using a WHEN/UNLESS rather than a one-legged IF.
notzmv has quit [Remote host closed the connection]
<beach>
flip214: It also looks like indentation is wrong in several places. (header-out...) and (decf bytes-to-send...) for instance.
slyrus__ has joined #lisp
libertyp1ime has joined #lisp
slyrus_ has quit [Ping timeout: 258 seconds]
rippa has quit [Read error: Connection reset by peer]
libertyp1ime has quit [Client Quit]
frgo has joined #lisp
libertyprime has quit [Remote host closed the connection]
jonatack has quit [Ping timeout: 248 seconds]
frgo_ has joined #lisp
frgo has quit [Ping timeout: 265 seconds]
raghavgururajan has quit [Remote host closed the connection]
frgo_ has quit [Ping timeout: 258 seconds]
<_death>
maybe choose a more specific name for the callback.. and in this case I would consider just adding it as another optional
cosimone has quit [Quit: Terminated!]
notzmv has joined #lisp
<_death>
beach: the indentation is not wrong, it's just different chunks of the diff
epony has quit [Quit: QUIT]
<flip214>
beach: thanks! I hoped for _technical_ feedback, TBH
<flip214>
_death: thanks as well! you think just having a second &optional is cleaner? How about a third one, then, etc.?
<flip214>
No idea whether that will come up, though
<flip214>
beach: which LUV slides?
noobineer1 has joined #lisp
<_death>
flip214: right, but you already have 1 optional and need to maintain backwards compatibility
noobineer has quit [Read error: Connection reset by peer]
shangul has quit [Remote host closed the connection]
shifty has quit [Remote host closed the connection]
shangul has joined #lisp
<_death>
there are other ways to add this functionality.. e.g., instead of callback provide additional headers.. or add hooks
shifty has joined #lisp
<flip214>
hmmm... for only a second argument &optional might be okay... if more comes up later, having another function with &key might be better
<flip214>
and a callback means that authorization can be done as well; more flexible than just a list of headers to send
<flip214>
thanks a lot!
<_death>
another thing to think about is that the user can supply a pathname and a content-type, but the callback is called just with the pathname, so if it wants to dispatch based on content-type as well it needs to find it out using another way (the content-type function).. may not be a big deal, but another indicator of ad-hociness
<flip214>
yeah, right. I'll pass that in as well.
<flip214>
beach: how would I _not_ use CALLBACK as a boolean? I need to check whether one was passed, right?
<_death>
maybe hooks would be a better approach.. it'll mean a larger change
<_death>
flip214: you could have it default to a noop function
<flip214>
beach: ah, I guess you mean using a callback-given-p, right? But that breaks as soon as some function or macro just relays an incoming NIL value...
<_death>
(my preference is that nil be treated as a noop, though)
<flip214>
_death: yeah, but I'm not sure that's faster - and it breaks for functions just relaying their parameters
<_death>
right
bitmapper has joined #lisp
epony has joined #lisp
frgo has joined #lisp
frgo has quit [Ping timeout: 268 seconds]
smokeink has quit [Ping timeout: 265 seconds]
bitmapper has quit [Remote host closed the connection]
random-nick has joined #lisp
oxum has joined #lisp
oxum__ has quit [Ping timeout: 258 seconds]
<flip214>
which of the 5 different CSV libraries in QL is the "best"? Any opinions?
oxum has quit [Ping timeout: 260 seconds]
bitmapper has joined #lisp
<_death>
I would guess cl-csv is the most complete one
shifty has quit [Ping timeout: 268 seconds]
shifty has joined #lisp
oxum has joined #lisp
<flip214>
thanks
<Xach>
flip214: there is a comparison report, i think!
<beach>
flip214: callback is not a Boolean, it is a variable with a default value of NIL.
<beach>
flip214: When you write (IF CALLBACK, you use it as a Boolean.
<beach>
When you write (IF (NULL CALLBACK), the Boolean is (NULL CALLBACK) which tests whether CALLBACK has its default value.
<beach>
In this case, since you have a one-legged IF, you can write (UNLESS (NULL CALLBACK) (FUNCALL CALLBACK PATHNAME))
<beach>
Which means "unless the variable CALLBACK happens to have its default value (which is not a function), call it with PATHNAME as its argument".
<beach>
Whereas (IF CALLBACK (FUNCALL CALLBACK PATHNAME)) means "if the Boolean variable CALLBACK happens to be true, then call that Boolean value ...".
<beach>
_death: Ah, yes, I see what you mean about the indentation.
ebrasca has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
shifty has quit [Ping timeout: 265 seconds]
lukego has quit [Quit: Connection closed for inactivity]
xkapastel has quit [Quit: Connection closed for inactivity]
sjl_ has joined #lisp
<reepca>
Is it acceptable to have a pathname with a nil NAME (according to the spec, anyway)? I wanna have a list of "search paths" I can use merge-pathnames with to test whether a file is under a given directory, but it only seems to have the desired effect when NAME is nil and instead the last element of DIRECTORY.
Cymew has quit [Quit: Konversation terminated!]
ralt has quit [Quit: Connection closed for inactivity]
luna_is_here has joined #lisp
<p_l>
i think it's supposed to operate just like that, might need to take a look again
vs has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
<reepca>
I'm somewhat uncertain because uiop:getenv-pathnames keeps spitting out pathnames with a non-nil NAME component, which would seem to be contrary to what I assume is its purpose of "handling search path environment variables".
wsinatra has quit [Quit: WeeChat 2.7]
orivej has joined #lisp
<flip214>
reepca: there's a difference between PATH/ and PATH - the former is a directory, the latter the entry in the parent directory.
Lycurgus has quit [Quit: Exeunt]
AnimalClatter has joined #lisp
<scymtym>
reepca: (uiop:getenv-pathnames "NAME" :ensure-directory t) seems to do that. there is also UIOP:GETENV-ABSOLUTE-DIRECTORIES if you don't mind the absolute part
pjb has quit [Ping timeout: 248 seconds]
<reepca>
scymtym: ooh, thanks. I guess I didn't see that parameter since it's just lumped in with "constraints" in my minibuffer
dddddd has joined #lisp
je4i has quit [Remote host closed the connection]
kajo has quit [Ping timeout: 246 seconds]
hostile has joined #lisp
<pfdietz>
ASDF package inferred systems should understand package local nicknames entries in defpackage.
jonatack has quit [Ping timeout: 260 seconds]
EvW has quit [Ping timeout: 260 seconds]
shka__ has quit [Ping timeout: 265 seconds]
jmercouris has joined #lisp
<jmercouris>
I feel like I'm doing something seriously wrong because I'm going through a list of objects and doing an operation based on their type
<Bike>
change it to mapc with a generic function?
<jmercouris>
I would make a method for each object
<jmercouris>
however it is unfortunate that what each object should do depends on the method...
<jmercouris>
it's like a double combination
<Bike>
i do not understand
pjb has joined #lisp
<jmercouris>
OK, let me re-explain
<jmercouris>
I have four methods that each go through a list of objects
<jmercouris>
in each of those four methods, what each object does is different
<jmercouris>
you know what, that's fine
<jmercouris>
I will do that
asdf_asdf_asdf has joined #lisp
<beach>
Wow!. Hold on. Objects don't do anything.
<jmercouris>
Ah, yes
william1_ has quit [Ping timeout: 258 seconds]
<jmercouris>
let me make it very concrete and see if there is a better approach here, give me a second to write it out
<jmercouris>
I have a list of objects, buttons and links. I have two functions "open-in-new-tab" "copy-url". In "open-in-new-tab" when I get a link object I want to do action A. In "open-in-new-tab" when I get a button object I want to do action B. In "copy-url" when I have a link I want to do action C. In "copy-url" when I have a button I want do action D.
jprajzne has quit [Quit: Leaving.]
<jackdaniel>
define a method specialized on both action and object
<beach>
Might not be worthwhile.
<jackdaniel>
having "a method for each object" doesn't make much sense. you may have a slot in each object to store its function if you really want to have a separate function for each object.
<dlowe>
I'm confused, this just sounds like two generic functions with two methods each
<jmercouris>
dlowe: yes
<jmercouris>
IF I could specialize on a function
<jmercouris>
is this possible?
asdf_asdf_asdf has quit [Remote host closed the connection]
<dlowe>
you can specialize on a symbol
<dlowe>
you have a list of functions too?
<jmercouris>
I don't have a list of functions, no
<dlowe>
you want (defun open-in-new-tab (list) (mapc 'dwim-open-in-new-tab list))?
gaqwas has quit [Quit: Leaving]
<jmercouris>
OK, I will define four defgenerics, one for each function (in my original problem)
<jmercouris>
that is the most logical I think
<jmercouris>
time will tell of course, but that makes sense, thank you all
smazga has joined #lisp
clothespin has quit [Ping timeout: 260 seconds]
wsinatra has joined #lisp
brettgilio has joined #lisp
asdf_asdf_asdf has joined #lisp
Guest5293 has quit [Changing host]
Guest5293 has joined #lisp
Guest5293 is now known as nitrix
jmercouris has quit [Ping timeout: 260 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
bitmapper has quit [Ping timeout: 260 seconds]
kajo has joined #lisp
william1_ has joined #lisp
jkvl has quit [Quit: WeeChat 2.6]
enrio has quit [Read error: Connection reset by peer]
jonatack has joined #lisp
je4i has joined #lisp
<reepca>
in CASE, does the OTHERWISE symbol have to be in the COMMON-LISP package? Apparently using a keyword doesn't work there...
<reepca>
oh huh, apparently there's more distinction between symbols and keywords than just "one is in the keywords package" I guess?
<pfdietz>
Yes, it must be that specific symbol.
<pfdietz>
Not a different symbol for which SYMBOL-NAME is STRING=.
hhdave has quit [Quit: hhdave]
<pfdietz>
There are very few places in standard CL that allow one to use any symbol with the same symbol-name, rather than some specific symbol.
<pfdietz>
LOOP is one.
william1_ has quit [Ping timeout: 260 seconds]
khisanth_ has quit [Ping timeout: 265 seconds]
gareppa has joined #lisp
Lycurgus has joined #lisp
je4i has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
lavaflow has quit [Ping timeout: 268 seconds]
khisanth_ has joined #lisp
jfb4 has joined #lisp
jfb4_ has quit [Ping timeout: 268 seconds]
bitmapper has joined #lisp
Lycurgus has quit [Quit: Exeunt]
sjl_ has quit [Quit: WeeChat 2.3-dev]
jfb4_ has joined #lisp
jfb4 has quit [Ping timeout: 240 seconds]
Kundry_Wag has joined #lisp
clothespin_ has joined #lisp
AnimalClatter has quit [Ping timeout: 268 seconds]
Kundry_W_ has joined #lisp
Kundry_Wag has quit [Read error: Connection reset by peer]
Kundry_W_ has quit [Remote host closed the connection]
phoe has quit [Ping timeout: 250 seconds]
Kundry_W_ has joined #lisp
phoe has joined #lisp
Kundry_W_ has quit [Remote host closed the connection]
william1_ has joined #lisp
clothespin_ has quit [Ping timeout: 268 seconds]
X-Scale has quit [Ping timeout: 268 seconds]
Kundry_Wag has joined #lisp
EvW1 has joined #lisp
madage has quit [Quit: leaving]
asdf_asdf_asdf has quit [Remote host closed the connection]
X-Scale has joined #lisp
orivej has quit [Ping timeout: 268 seconds]
je4i has joined #lisp
malfort has joined #lisp
william1_ has quit [Ping timeout: 258 seconds]
malfort has quit [Client Quit]
malfort has joined #lisp
gareppa has quit [Quit: Leaving]
je4i has quit [Ping timeout: 264 seconds]
AnimalClatter has joined #lisp
je4i has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Lycurgus has joined #lisp
asdf_asdf_asdf has joined #lisp
AnimalClatter has quit [Ping timeout: 258 seconds]
je4i has quit [Read error: No route to host]
clothespin_ has joined #lisp
je4i has joined #lisp
Kundry_Wag has joined #lisp
Irenes[m] is now known as Guest13147
jfb4_ has quit [Ping timeout: 260 seconds]
jfb4 has joined #lisp
DGASAU has quit [Read error: Connection reset by peer]
Kundry_Wag has quit [Read error: Connection reset by peer]
Kundry_W_ has joined #lisp
guaqua has joined #lisp
didi has joined #lisp
william1_ has joined #lisp
madage has joined #lisp
bitmapper has quit [Ping timeout: 268 seconds]
<didi>
How do I make a struct if it has no constructor function, as in (defstruct (foo (:constructor)))?
bitmapper has joined #lisp
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
nirved has quit [Ping timeout: 252 seconds]
fookara has quit [Remote host closed the connection]
<asdf_asdf_asdf>
didi hi. I don't understand.
<didi>
asdf_asdf_asdf: Suppose you define a struct as (defstruct (foo (:constructor))). Now, how do you make a struct foo?
<dlowe>
defstruct creates a make-foo function
<dlowe>
as well as all the foo-field functions
<didi>
dlowe: Even if I tell it not to?
nirved has joined #lisp
<didi>
Maybe it should be (defstruct (foo (:constructor nil))).
<pfdietz>
You can force defstruct to make no constructors.
<Bike>
:constructor nil tells it not to, yes
<didi>
Right right.
<didi>
Then, how do I make foo?
<dlowe>
oh. well, I don't think you do
<didi>
dlowe: oic
<pfdietz>
That makes sense if you are defining a "base" struct that will only be used as a supertype of structs that include it, or if it's not a struct-struct but rather one using lists or vectors.
<pfdietz>
You can define constructors for those child types.
<didi>
pfdietz: I see.
<pfdietz>
Think of the constructor-less one as an abstract base class.
AnimalClatter has joined #lisp
<pfdietz>
While you're in that neighborhood, look up BOA constructors, admire the pun, and then look at things you can do with BOA lambda lists.
AnimalClatter has quit [Ping timeout: 258 seconds]
<asdf_asdf_asdf>
Is fashion to append new data to created structure (defstruct)?
buffergn0me has joined #lisp
ggole has quit [Quit: Leaving]
<Bike>
what the what?
<asdf_asdf_asdf>
(defstruct ship (a "hello")) ; And now I have append (b "world") to this structure.
<asdf_asdf_asdf>
I want after modification it (defstruct ship (a "hello") (b "world")).
william1_ has quit [Ping timeout: 265 seconds]
william1_ has joined #lisp
<buffergn0me>
asdf_asdf_asdf: classes can do that
<asdf_asdf_asdf>
(append-to-ship (b "world")) ;?
<buffergn0me>
asdf_asdf_asdf: DEFCLASS will add new slots to existing objects and give them proper default values
<asdf_asdf_asdf>
Thank, but on only (defstruct... is it not possible?
ebrasca has quit [Remote host closed the connection]
clothespin_ has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 260 seconds]
dale_ has joined #lisp
dale_ is now known as dale
AnimalClatter has joined #lisp
clothespin has joined #lisp
je4i` has quit [Remote host closed the connection]
AnimalClatter has quit [Ping timeout: 265 seconds]
scymtym has joined #lisp
je4i has joined #lisp
buffergn0me has quit [Ping timeout: 260 seconds]
jfb4_ has joined #lisp
gravicappa has quit [Ping timeout: 268 seconds]
jfb4 has quit [Ping timeout: 265 seconds]
<pjb>
shangul: nil = false ; 'nil = the symbol nil ; () = empty code list (in code) ; '() = empty data list (in code).
didi has left #lisp ["O bella ciao bella ciao bella ciao, ciao, ciao."]
jfb4 has joined #lisp
<phoe>
;; (progv () ()) = overkill
<pjb>
shangul: now, it depends on the current *readtable* and *package*. "NIL" and "()" can read to very different things, and different from |CL|:|NIL| < and even "|CL|:|NIL|" could read as something very different!
jfb4_ has quit [Ping timeout: 265 seconds]
<pjb>
asdf_asdf_asdf: or use the MOP (to add slots). But it's not necessarily a good idea to do that, since new slots mean new accessor functions, and adding new functions at run-time means that you didn't knew it when you compiled your program, so they are not called, so they're useless.
<pjb>
asdf_asdf_asdf: unless you are also adding new code, which will call those new functions. Are you implementing an IDE?
<pjb>
asdf_asdf_asdf: it is better to have one slot holding an a-list or a hash-table, and to add entries to it.
<pjb>
asdf_asdf_asdf: addding a new slot to a class is very costly an operation, since ALL the instance of this class and its subclasses will have to be updated!
buffergn0me has joined #lisp
<asdf_asdf_asdf>
pjb, no I not implementing an IDE. How create a new slot using hash-table, example?
william1 has joined #lisp
<pjb>
asdf_asdf_asdf: you don't.
<pjb>
asdf_asdf_asdf: I just explained that creating a new slot was a BAD idea.
<asdf_asdf_asdf>
OK, thank. What mean "it is better to have one slot holding an a-list or a hash-table, and to add entries to it."?
<pjb>
So instead of using slot-value, you use attribute-value.
Kundry_W_ has quit [Remote host closed the connection]
shifty has joined #lisp
Kundry_Wag has joined #lisp
bitmapper has quit []
buffergn0me has quit [Ping timeout: 260 seconds]
<asdf_asdf_asdf>
Thank You.
Kundry_Wag has quit [Ping timeout: 260 seconds]
bitmapper has joined #lisp
femi has quit [Ping timeout: 250 seconds]
je4i has quit [Remote host closed the connection]
nanananaminanami has joined #lisp
femi has joined #lisp
kajo has quit [Ping timeout: 260 seconds]
nanananaminanami has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
AnimalClatter has joined #lisp
atgreen has quit [Ping timeout: 265 seconds]
wsinatra has quit [Quit: WeeChat 2.7]
AnimalClatter has quit [Ping timeout: 268 seconds]
devon has joined #lisp
orivej has joined #lisp
Bike has joined #lisp
<aeth>
Depending on the problem, if you want to add a bunch of 'slots' at runtime then a hash-table definitely seems better than actually using object slots. Then you don't need to 'add slots to existing objects' since any key is going to be valid. For alternatives, alists/plists are lists, so they're only good if it's short or if you're always iterating over them with something like alexandria:doplist.
<aeth>
plists are great in macros, though, because they're just syntax and you can use destructuring-bind on them
smazga has quit [Quit: leaving]
<aeth>
GETHASH supports default values as an optional third argument so if your hash table doesn't have the slot, you specify the default on access or in a helper function. e.g. (gethash :color foo :red)
<_death>
you can also use the mop to define your own slot storage
luna_is_here has joined #lisp
<aeth>
_death: I suspect that thinking in terms of instances of DEFCLASS-defined classes is overthinking it, though. Unless it's a public API that has to take this form.
<aeth>
It depends on the problem, but this really seems like a better fit for hash tables.
sahara3 has joined #lisp
<_death>
sure, I doubt asdf_asdf_asdf needs this sophistication
<pfdietz>
The default value is useful with some macros: (incf (gethash x table 0))
<no-defun-allowed>
Speaking of hash tables, are there any implementations of hash tables that are specialised on using strings as keys?
<aeth>
It solves half of the problem. Now you get a meaningful default value instead of NIL when there's no entry present, but it won't stop you or someone else from adding some value that violates your constraints (in that case a non-number) somewhere else.
vaporatorius has quit [Quit: Leaving]
<pfdietz>
no-defun-allowed: just EQUAL hash tables.
<aeth>
hash-tables/alists/plists (especially the latter two since they're just lists) require discipline, but with the MOP you can really enforce things if you can describe it as a DEFCLASS (and DEFSTRUCT gives you :type which depending on the implementation can guarantee quite a bit, if the implementation respects that)
<pfdietz>
Or EQUALP if you want to ignore case.
dyelar has quit [Quit: Leaving.]
william1_ has quit [Ping timeout: 258 seconds]
<no-defun-allowed>
Sure, but those appear to be a performance problem in some code, especially on my Pi 0 where it takes more than 10 seconds to read a space delimited file and store it into a hash table.
<pfdietz>
All you'd save would be the dispatching time to recognize a key is a string.
<no-defun-allowed>
Hm, true.
<aeth>
pfdietz: hmm... if the key is always a string, wouldn't a modern CPU with branch prediction basically make that time go away?
<pfdietz>
If you have a specific constant set of string keys, STRING-CASE can be much faster.
<_death>
have you tried implementing your own hash-table?
<pfdietz>
aeth: you'd think so.
luna_is_here has quit [Ping timeout: 260 seconds]
<no-defun-allowed>
That file has "only" 100,000 made up values, but it is much faster than I think it should be on my desktop.
<pfdietz>
Which lisp are you using?
<no-defun-allowed>
Maybe it's another SBCL vs Clozure thing; Clozure on my desktop is also a bit slower.
<pfdietz>
One thing to worry about with strings (and comparisons of strings) is encodings. By default SBCL will read strings as (array character (*)), which uses 4 bytes per character. If you know it's 8 bit characters, you can read as base strings.
<no-defun-allowed>
The strings aren't constant, and realistically I can't assume they're all 8 bit characters.
<no-defun-allowed>
Yeah, gethash on an equalp hash table in SBCL is 3.5x faster for a miss, and 46x faster for a hit with a single element.
lavaflow has joined #lisp
<no-defun-allowed>
The latter drops to only 16x if I provide `:lock-free t`.
pfdietz has quit [Remote host closed the connection]
<no-defun-allowed>
_death: Well, I have for Netfarm slot lookup, since I don't have to implement resizing or removal or most of the interface other than GETHASH and (SETF GETHASH), but a complete hash table seems daunting.
<sahara3>
hola
clothespin has quit [Ping timeout: 265 seconds]
<no-defun-allowed>
(You can insert "because the number of slots in a class is usually pretty small" somewhere in that sentence.)
asdf_asdf_asdf2 has joined #lisp
<_death>
no-defun-allowed: I don't know what netfarm is... btw you can provide a size parameter to make-hash-table
asdf_asdf_asdf has quit [Ping timeout: 265 seconds]
nitrix has quit [Read error: Connection reset by peer]
nitrix has joined #lisp
AnimalClatter has joined #lisp
nitrix is now known as Guest73624
<no-defun-allowed>
It's irrelevant stuff that involves the MOP and another way to get at slot values which goes through a hash table.
<no-defun-allowed>
That didn't really help, I don't think it was a resizing problem.
<_death>
profile it?
AnimalClatter has quit [Ping timeout: 268 seconds]
asdf_asdf_asdf2 is now known as asdf_asdf_asdf
asdf_asdf_asdf77 has joined #lisp
<no-defun-allowed>
I couldn't get https://github.com/eugeneia/sam to run too well on the Pi, nor on my desktop profiling all threads.
asdf_asdf_asdf has quit [Ping timeout: 268 seconds]
raghavgururajan has joined #lisp
jmercouris has joined #lisp
LiamH has quit [Quit: Leaving.]
sahara3 has left #lisp [#lisp]
kajo has joined #lisp
davisr has joined #lisp
Tordek_ is now known as Tordek
payphone` has quit [Ping timeout: 248 seconds]
* no-defun-allowed
is now very confused
<no-defun-allowed>
Out of curiosity, I unplugged the charger from my laptop. Clozure halved in speed, which would make sense given the laptop would throttle more, but SBCL dropped from 20ns or so to 1ns.
<no-defun-allowed>
I guess now the-cost-of-nothing's initial tests for latency and overhead and all that don't apply, and it then gives incorrect results.
asdf_asdf_asdf77 has quit [Remote host closed the connection]
asdf_asdf_asdf has joined #lisp
jmercouris has quit [Remote host closed the connection]
brettgilio has quit [Quit: Quit]
brettgilio has joined #lisp
AnimalClatter has joined #lisp
defaultxr has quit [Quit: brb]
AnimalClatter has quit [Ping timeout: 258 seconds]