freenode/#lisp - IRC Chatlog
Search
20:40:04
slyrus__
all of sudden some code that used to work started throwing an error about 12 being an invalid index for a (SIMPLE-VECTOR 12). I suppose I should have guessed what was going on right away.
20:40:47
_death
we should return to old times, where names meant something and december was the tenth month
20:45:02
_death
was the workaround to increase vector size by 1? or to change indices?.. if the former, hope there's no modular arithmetic
21:02:23
vsync
imagine if in our calendaring for some reason we kept the numbers associated with names like "tenth month" and indexed the rest chronologically
21:03:02
vsync
so one would actually write "2019-10-01" for today; july and august would end up as 11 and 12
21:05:51
Bike
"why isn't october the eighth month? i wish the guy who made it the tenth got stabbed" "Good news!"
21:06:52
pjb
slyrus__: In Pascal, you would define an enum january .. december, and use it to index the array. In CL, you could use keywrods and a hash-table…
21:08:43
pjb
Bike: because the guy who named it was a Roman, and Romans started they year in March. But then Christians came and started it in January.
21:09:35
pjb
Bike: become world dictator, and set the start of the year to your birth month for fun!
21:19:05
vsync
stupid date/array tricks: (let ((year (make-array '(52 7) :initial-element nil))) (dotimes (month 12 year) (map-into (make-array 30 :displaced-to year :displaced-index-offset (* month 30)) (constantly (elt #(jan feb mar apr may jun jul aug sep oct nov dec) month)))))
21:28:35
_death
the whole purpose of moving the leap day around was so that people celebrate less and work more.. and your calendar adds FOUR nil days
21:34:04
aeth
Shinmera, _death: The problem with change-class here is that the one reference where you're changing the class might not be the only reference. Especially not related to _death's example where you're setf'ing x, not changing the value of 5 into -123. It'd be more like (setf (aref x) -123) there.
21:35:44
aeth
In particular, you could have objects that use the MOP to enforce constraints about the information that can be stored in the object. Obviously, the compiler won't trust that because of things like change-class, but the user might.
21:36:10
aeth
Imagine having a class that restricts x to plusp via a check on all sets to the slot, which is afaik bulletproof except for change-class.
21:55:24
aeth
_death: You can create a metaclass which enforces an ASSERT on a slot SETF based on some constraint defined in the DEFCLASS. e.g. https://gitlab.com/zombie-raptor/zombie-raptor/blob/d5771d8b78973e44aa98af8916dbed6fb49f5588/util/metaobject.lisp
21:56:17
aeth
I did this because more than half of my docstrings for slots were basically expressable as types, although since that apparently requires ASSERT instead of CHECK-TYPE (since the type isn't known at compile time) you could assert basically anything.
21:57:06
aeth
_death: Right. So let's say you enforce a PLUSP on slot x via the MOP. That enforcement can be completely broken by CHANGE-CLASS afaik. In another thread, too.
22:20:11
_death
but there is an issue.. if update-instance-for-different-class signals an error, what is the state of the object? it's already of the target class, and the discarded slots are nowhere to be found.. maybe a change-class wrapper would do.. this suggests a more elaborate protocol
22:28:19
Xach
cool, https://github.com/mare5x/LispQR does something I was thinking of making myself just a few days ago
22:38:25
Xach
I'd like to modify it to just return the 2d bitmap so I can draw it however I please, but that will have to wait for license info
22:50:04
_death
oh well, tried to read the QR code with google goggles, but apparently they disabled it with only a link to google lens.. the store page for it tells me it's not compatible with my device.. hooray. but at least I came up with a new Bruce Schneier fact: Bruce Schneier can not only decode QR codes with his eyes, but also encode them
23:28:26
akoana
Xach: seems a license (MIT) has just been added: https://github.com/mare5x/LispQR/blob/master/LICENSE.txt
23:44:48
no-defun-allowed
It is foremost a "common" language that's made of several somewhat incompatible Maclisp dialects (and Scheme if you check the CLTL1 cover).
23:45:02
aeth
ebrasca: CL conventions are mostly consistent, but it has to maintain almost complete compatibility with legacy Lisp, which can date to the 1960s/1970s.
23:45:49
aeth
ebrasca: Some of the older functions like rplacd were probably from systems with character limits
23:48:40
aeth
ebrasca: Scheme does update some of the naming, e.g. set-cdr! instead of rplacd. It goes too far, though, and in some cases it's actually a disadvantage, because it replaced MAPCAR with map, leaving map as a list-specific procedure, unlike CL's MAP function because CL had the name available.
23:49:42
aeth
LdBeth: Function argument order is arguably more important to be consistent because it makes things more easily guessable. e.g. for accessing an item, you need to put the index/key/etc. second so you can have AREF's arbitrary indicies, e.g. (aref foo) (aref foo 1) (aref foo 1 2) ...
23:49:57
aeth
LdBeth: All new functions are in AREF's order, but a lot of the old ones aren't, like NTH
23:52:27
aeth
LdBeth: I like that CL is the opposite of terseness. Very little of the naming changes made in Clojure actually improve things. I mean, sure, certain things like aref and + are good as short names, but most things don't have to be that short. If DEFUN was DEFINE-FUNCTION, things wouldn't be that bad.
23:53:52
aeth
What's good about traditional Lisps including CL and Scheme is that they're concise at a syntactic token level but not at an absolute character level. So the names tend to be longer and meaningful, but replace foo-bar-baz with µ or whatever and you can see just how concise Lisps really are.
23:54:23
Josh_2
I honestly like the long names, and I like giving my functions and my variables descriptive names
23:55:08
aeth
Names should only be short if they're frequently used and intended to be used "inline", like AREF and +. So vec+ is probably better than vector-add, but for the most part, your names should be pretty long.
23:55:25
no-defun-allowed
I didn't choose the update-system-for-new-interesting-object-predicate life, the update-system-for-new-interesting-object-predicate life chose me.
23:56:57
fengshaun
where does one get a human-readable overview of all `loop` keywords and how they fit together?
23:57:32
aeth
LdBeth: The only reason you should use single character names (except perhaps i, j, k, ..., for iterating) is if you're doing mathematics/physics and that's the most clear name for the variable you're using. It's kind of unfortunate that "t" is taken since it shows up all of the time.
23:58:24
nirved
recently someone was using := and :+ for setf and incf, but I find it slower to type
23:59:18
aeth
ebrasca: Eh, talk to a computer scientist or a physics and they might say "t for time" is accurate. Talk to a mathematician working with the same differential equations sort of stuff and they will tell you that "t" absolutely is just a meaningless character and not necessarily "time"
23:59:44
LdBeth
nirved: that’s because : needs a shift key press, assuming you are using US keyboard layout
23:59:54
aeth
I do sometimes substitute in "time", of course, but for the most general stuff like an RK4 implementation, "t" is absolutely not necessarily just time.
0:00:14
aeth
RK4, in case you're wondering... https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods#The_Runge%E2%80%93Kutta_method
0:01:39
aeth
ebrasca: I haven't written the backend to a machine learning system, but I wouldn't be surprised if a lot of the algorithms there deal with "t" in equations in a non-time manner.
0:02:38
fengshaun
no-defun-allowed, not *unreadable* per se, just takes time to put together all the bits
0:03:24
aeth
LdBeth: Yes, dv/dt, but is that change in velocity w.r.t. time in physics or is that the vector v (probably the second vector in your equations, with u being the first) in some arbitrary differential equation that could be applied to any domain where diff. eq. makes sense?
0:04:10
aeth
LdBeth: Perhaps "velocity" and "time" are good substitutions for "v" and "t", but perhaps "v" and "t" are the most straightforward variables here, in which case you have to replace "t" with "u" or "t*". If vectors, then "u" is probably taken, so you'd have to do "t*"
0:05:15
aeth
LdBeth: Right, but that's just the application of physics, which might not be what you're doing with your numerical code... and if it's a library, you have to assume that someone will have some exotic application, too.
0:05:30
mister_m
If i have two classes A, and B - and B is a subtype of A - and they also both define intitialize-instance :after methods - if I thenperform a make-instance on the subclass B, will the initialize-instance method of the parent type A also be executed?
0:05:47
aeth
LdBeth: Although, really, you can just see "time" as a useful fiction even if it has nothing to do with time. I think some people interpret "t" that way.
0:07:44
LdBeth
mister_m: yes, and beach mentioned there’s something wrong with your code design if you intends to get rid of the :after method of class A
0:08:03
aeth
ebrasca: No, I was talking specifically about calculus, especially differential equations. There are quite a few equations of t, and "t" is just afaik a variable that you use to step through things in your system, at least when viewed as numerical computations.
0:08:36
aeth
ebrasca: Interestingly, Wikipedia says "time dependence of a point in geometrical space" for "dynamical system" so it sort of disagrees with me. https://en.wikipedia.org/wiki/Dynamical_system
0:08:56
mister_m
LdBeth: in this case I have a general bit of initialization that happens with the superclass A, and some more specialized initialization with B. Shouldn't really change I don't think
0:09:49
aeth
I wouldn't be surprised if t's use in physics and differential equations is the main reason why Scheme went with #t instead of CL's T
0:55:28
aeth
dlowe: The main disadvantage with true is that you have "true" and "false" and they're different lengths, but it's not like CL even has an f. Nope, it's just t and nil.
0:58:10
aeth
dlowe: I will probably use "true" and "false" in my SXP file format because dealing with t/nil vs. #t/#f/() is a mess and those are just the two languages where it's the most trivial to implement an SXP reader
0:58:54
aeth
No ()s at all. All lists will require a first element. That kills an ambiguity issue with e.g. using lists like JSON's [] and plists like JSON's {}
0:58:55
White_Flame
and then there's true/false/null/undefined, and zero vs non-zero, etc across other languages
1:00:09
aeth
I like how CL uses nil as false and as null, effectively meaning that there *is* no null, since it's more of a false than a null.
1:00:27
aeth
Using it as the empty list, too, can cause some ambiguity issues when serializing to/from a text-based format, though.
1:01:20
aeth
Your naive s-expression writer probably won't know when to print nil as () and as NIL and will probably err on the side of too many NILs
1:03:48
aeth
Too bad Advent of Code dropped at the wrong time for me. Well, I mean, it's not like it was going to appear at some other time.
1:04:50
aeth
I can tell when I'm too exhausted to have time for CL when most of my comments are things like comments and docstrings instead of substance. (It's still pretty useful to document code, of course.)
1:08:21
White_Flame
aeth: technically in the image (but usually not in serailized data), there's NIL, non-NIL, and unbound
1:11:08
aeth
I mean, general and portable. Images aren't even portable across versions typically afaik
1:11:32
White_Flame
but one could consider unbound to be a "special value" tested with unboundp (sort of like NaN tests need a different predicate), as that is also how it's often implemented
1:12:02
White_Flame
although I don't believe anything in the spec considers unboundness in that sense, especially with the history of a-list environments
1:13:54
aeth
White_Flame: The easiest way to handle serialization of an instance of an arbitrary class is to make the user deal with it
1:15:35
aeth
Some architectures are easier to serialize than others, e.g. the Entity Component System that's currently popular in game engine dev
1:26:59
pfdietz
I want serialization (in the sense of being able to put them in fasl files) of closures and lexical environments.
1:36:08
vsync
what's a good word for "I've completed the first pass over some work and there may or may not be more work to do after handing it off, which fact I may or may not actually already know"?
1:50:52
vsync
oh, slice because rather than a single-purpose "split this string into single-char strings", I made something to slice up a sequence into equal lengths and then defined string-char-strings in terms of that
1:51:33
vsync
unless this already exists I have plans to augment it with many lovely keyword arguments
1:52:00
vsync
could it be implemented in terms of split-sequence-if? perhaps, but this seems clearer and, I think, more performant
1:53:10
White_Flame
I've heard the notion that 10-12 list items is where it becomes faster to use a hashtable than searching the list. Has this been measured for Lisp implementations, or do you think it's more specific to other-language implementations?
1:53:56
vsync
mfiano: I thought I had seen that somewhere, but when I looked at util packages it seemed to be an alias for split-sequence
1:57:07
mfiano
vsync: actually partition is for splitting based on a predicate function. "batches" is what you want. It's found in a few libraries such as serapeum
2:00:16
vsync
tanagra, a function which takes a function designator and returns a meme reference if available
2:19:30
mfiano
White_Flame: Instead of emoji, just use combinations of unicode whitespace and non-printable character symbol names.
2:21:58
mfiano
You'd be left with a series of parens, and you could change the dispatching characters for them to be similar
2:31:21
kmeow
I have an array defined like (defvar arr #('(5 "David") '(3 "Sarah") '(2 "Alex"))), but doing a (car (elt arr 2)) gives me QUOTE, which is not what I was expecting [since (car '(3 "Sarah")) gives 3]
2:32:23
kmeow
I know how to get the numbers out of those lists in the array, but I don't understand what's going on exactly
2:34:44
White_Flame
try (vector '(5 "David") ...). That's a function that will evalate them as parameters.
4:48:15
no-defun-allowed
fengshaun: Wikipedia tells me the name beach had in mind "is the French certification granted to certain French geographical indications for wines, cheeses, butters, and other agricultural products."
4:55:26
fengshaun
I don't have any projects that lend themselves to high level languages, so AoC is a good place to do some lisp
4:56:01
beach
fengshaun: I have a web page of suggested project in case you are looking for something.
4:58:46
aeth
fengshaun: one of these days some unfortunate person is going to read 'a web browser' from the list, not realize how hard it is, and 5 years later actually have one written
5:14:52
beach
And "web browser" can be thought of as a collection of modules for displaying text, images, movies, PDF documents, etc.