freenode/#lisp - IRC Chatlog
Search
22:25:54
v0|d
dim: (car (reduce (lambda (acc atom) (if (> (cdr atom) (cdr acc)) atom acc)) lst :initial-value '(not-found 0)))
22:41:49
pjb
(let ((transposed-list '(((nil . 1) . 4) . 2))) (loop :for current = transposed-list :then (car current) :while current :maximize (cdr current))) #| --> 4 |#
0:09:43
aeth
A lot of good discussions in https://old.reddit.com/r/lisp/comments/a2yvuz/5_reasons_why_lisp_games_suffer_and_proposed/
1:18:22
aeth
no-defun-allowed: Well, I said the discussion (in the reddit comments) was good, not the OP article.
1:19:16
aeth
It's the most popular thread since yesterday's discussion of ITERATE in the LOOP thread, but I suspect it'll pass it very soon.
1:21:06
aeth
With 43 comments already the gamedev thread is well on the way to be the most commented. 60 might do it, at least sorting by top all time and looking at the comment count (and, hey, unlike the Arc forums, I don't get banned for quickly going through thread listings!)
1:24:51
no-defun-allowed
i probably should, i like that as a compromise between "i hate typing" and "oh god not another symbol collision"
1:26:27
no-defun-allowed
iirc in netfarm there's some packages required that do collide so i'll clean that up soonish
1:34:32
PuercoPop
no-defun-allowed: yeah, I though of beach as well when they mentioned don't use :use, but the only package-per-file style also advocates for explicit import statements
1:55:06
aeth
no-defun-allowed, PuercoPop: Package per file works best when the project is very, very, very large. Most Lisp libraries and applications aren't like that, and the largest ones are probably Lisp implementations, which probably can't use that style while implementing the things that defpackage requires.
6:42:51
kristof
Does anyone know of any discussion on why MAKE-PACKAGE takes a string designator and not a symbol-designator? I thought I read something by kent pitman once but I can't remember...
6:44:12
White_Flame
what would the package of the naming symbol do? if it's ignored, then a string is appropriate
6:45:04
kristof
it would intern the symbol and set it's PACKAGE-VALUE (does not exist, I know) to # <PACKAGE ...>
6:45:05
White_Flame
different symbols can have the same name. different packages cannot. package names are not namespaced
6:45:27
kristof
right, there would be a clear advantage to using symbols instead of strings so that packages could be namespaced
6:45:28
beach
kristof: If a package were named by a symbol, what would be the package of that symbol?
6:45:43
White_Flame
(well, and for holdling values, etc. but a symbol as a name is because it can be namespaced and locally interned)
6:46:53
kristof
oh, I think I remember what it is that I read. kent said he (often) writes his own machinery on top of defpackage that "does what he wants", and he detailed some specifics in a usenet post somewhere
7:11:05
phoe
Is there a format control that will automatically print ordinals? As in, 1 -> "1st", 2 -> "2nd", ...
7:48:10
elderK
Are they just like, the same as most Lisp stuff: Information that an implementation can use but may not.
7:48:54
elderK
Like, experimentally, it seems that SBCL does care about about the :type specified for a structural slot.
7:49:16
elderK
And of course, just because SBCL uses them, doesn't necessarily mean other implementations do.
7:53:02
flip214
but why are you asking about :type specifiers then, if you already see that SBCL uses them?
8:22:30
shka__
sbcl's type errors are rather neat devolping helper, allowing you to realize quicker that you messed up types
8:31:11
flip214
shka__: elderK: for another nice sbcl feature, try (setf sb-ext:*derive-function-types* t)
9:54:13
elderK
Xof: Still, this is horrible enough without adding more. So the question is, how to do this in a cleaner way?
9:55:16
elderK
shka__: Validation was done by those functions. Same with slot-count-valid-p and such
9:55:47
shka__
elderK: that seems to be better, also when type mismatches, you signal type-error specificly
9:56:16
elderK
shka__: The problem with using check-type here, is that they will have to look at the backtrace to know "Oh, right, COUNT is meant to be an integer..."
9:56:29
Xof
you could try (destructuring-bind (&rest sdlist &key (accessor (error ":accessor not supplied")) ...) (assert (= (length sdlist) 6)) (check-type accessor symbol) ...)
9:57:14
elderK
Like, if the slot description was blatantly foobar, then you'd get a destructuring error, rather than something meaningful.
9:57:47
elderK
flip214: A function like this would be used during macro expansion. It would be one of many helpers.
9:58:25
elderK
In general though, I guess... like, I'm unsure of how aggressively to test such... stuff. Like, I could just do what many other systems appear to do: Just assume the client uses the macro as documented.
9:58:25
shka__
elderK: what i like to do in situations like this is to pack relevant arguments into some sort of object and perform check in initialization-instance
9:59:32
elderK
shka__: Well, you would still need to destructure the input list, so to construct an instance of whatever "parameter pack" Object you had.
10:00:15
elderK
I tried actually just say, funcalling a function and using the slot-description as raw arguments. But then, a malformed slot-desc would generate an error when that function was called.
10:00:19
flip214
elderK: well, I guess I'd just check whether the slot description has the same length after REMOVE-DUPLICATES, and then do a DESTRUCTURING-BIND with (ERROR) defaults.
10:00:24
shka__
elderK: yes, but i am always trying to play around that so i can just apply #'make-instance arguments
10:01:06
elderK
flip214: You mean handler-case around the destructuring-bind? But then, you'd be signalling an error while validating the stuff that was successfully destructured.
10:01:12
flip214
elderK: or you just go the default lisp way and allow overriding of such slot definitions with key/value pairs in earlier positions...
10:01:18
elderK
Unless you say, broke it apart: destructure-slot-description and validate-slot-description
10:01:52
flip214
then there's no need to check for duplicates at all, just GETF the required arguments from the spec.
10:02:33
flip214
elderK: no, I meant (DESTRUCTURING-BIND (&key (accessor (ERROR "no accessor")) (count (ERROR "..."))) spec ... )
10:02:44
elderK
As long as the final "value" was sane, it would be happy. And you wouldn't be checking for invalid keywords.
10:03:19
elderK
flip214: Right. The thing is, if you wrapped that in handler-case, you'd have to tease out the difference between a destructuring error, and a validation error.
10:03:48
elderK
And you'd still need to validate that say, count was a non-zero unsigned integer and the like.
10:04:16
elderK
Out of curiosity, what is the convention for functions that validate something, but are not expected to return if the validation fails?
10:04:57
elderK
I was thinkign of simply: validate-slot-name. It would return the name if it was valid, and signal an error otherwise.
10:04:57
flip214
well, so there's no real need to handle the errors - the developer will see the backtrace and can act accordingly?
10:05:33
flip214
elderK: just as additional data point, CLOS allows to specify multiple :accessors....
10:06:14
flip214
elderK: well, in my experience having a good (ERROR "I expect :accessor to be a SYMBOL!") message and the backtrace
10:06:27
elderK
Take for instance, defclass itself. If you say, provide it random keywords or say, something foobar like (name :accessor)
10:08:02
flip214
elderK: well, how about defining a struct type instead of the 4 variables, setting them as the arguments come in, and then just check SLOT-BOUNDP?
10:08:47
flip214
that would at least move the "no ... specified" into one loop, and the "already given" can be checked the same way
10:09:13
flip214
well, allocating that structure isn't much different from having the 4 variables - both can be done on the stack.
10:10:01
elderK
It's like, should parse-slot-description return a slot-description object? Or should it simply return the stuff it parsed?