freenode/#lisp - IRC Chatlog
Search
13:29:37
shka
heh, this makes me want to make new project named that-one-project-that-uses-get-properties :D
14:13:02
dmiles
for instance if i am printing out information about sometings in a list and that list might repeat.. the way i remember that i prointed the items is to put a property on that time
15:27:18
Xach
Shinmera: getting something new today - http://report.quicklisp.org/2017-12-03/failure-report/lionchat.html#lionchat
16:09:48
Shinmera
Looks like phoe broke it https://github.com/Shinmera/ubiquitous/commit/fca63bbe4c0a4215fe2f11eac16e14bb77ad07c6
16:12:18
scymtym
Shinmera: re that commit: the structure is (if found (values …) (values …) nil) instead of (if found (values …) (values … nil))
16:16:51
scymtym
on the bright side, since a few releases, the offending form would have been highlighted in SLIME instead of the whole method form. comparison: https://techfak.de/~jmoringe/macroexpansion-condition-locations.png
16:21:02
Shinmera
ACTION has been dealing with gamepads crap on all OSs today and isn't ready to handle the rest of the world he built crumbling too
16:33:34
kuwze
could someone point me at a good small codebase to learn how to break a project up? right now I just have a single humongous file.
16:35:04
beach
kuwze: It uses CLOS a lot, just like other modern Common Lisp programs. And it comes with documentation and tests.
16:39:09
pjb
kuwze: http://git.informatimago.com/viewgit/?a=tree&p=public/games/hangman-cocoa-lisp&h=e97207bf8840c93a3aa45f743c3ce3d56820e53c&hb=d2b05300c771147337bcbf074d4d7af60d813ff9&f=src
16:40:58
Shinmera
I guess while we're at it, Ubiquitous is fairly small. https://github.com/Shinmera/ubiquitous
16:57:21
kuwze
okay I am trying to figure out thus bug. first of all, it only happens sometimes when I compile the whole project (ql:quickload "cl-oanda"). the bug/error goes away when I quit slime and restart it.
16:57:31
kuwze
here is the relevant code: https://gist.github.com/kuwze/57079a629a67d8dca229c8d795728d57
16:59:09
Shinmera
dlowe: Apparently you sent me a note about Portacle debug settings a long time ago that I never got because plexi isn't in this channel?
16:59:50
Shinmera
dlowe: The answer is that it used to use restrict-compiler-policy to force debug to 3 at one point, until I discovered that certain systems like cl-opengl perform very poorly with that.
17:05:55
kuwze
beach: I guess I was trying to practice with macros; I am not sure what I was thinking at the time
17:06:42
beach
kuwze: You can practice macros if you like, but then do it with something that requires a macro. I don't think make-book does.
17:07:49
beach
That means either of several things: 1. Your Common Lisp implementation is buggy. 2. You are doing something that the Common Lisp HyperSpec says has "undefined consequences" and your Common Lisp implementation is taking advantage of that, or 3. You are using buggy foreign code.
17:08:58
kuwze
beach, in regards to the segfault: I am not using ffi, and I am using the mature CCL, so I guess it must be 2
17:10:23
beach
kuwze: Oh, and given your level of knowledge of Common Lisp, I think Cluffer is probably too complicated at this point. But I didn't know that when I recommended it. Sorry.
17:15:53
kuwze
I'm sorry, but what's the newbite channel for common lisp? I don't want to bog down this channel
17:18:08
Devon
(fboundp '(setf car)) => NIL (fdefinition '(setf car)) and (function '(setf car)) both err undefined-function; No simple way to detect setf-able names?
17:22:13
Devon
A function named (setf f) must return its first argument as its only value in order to preserve the semantics of setf.
17:23:28
beach
I can't find it now, but I think there is a general rule that when the Common Lisp HyperSpec says it's an "accessor", then it can be implemented either as a function or as a setf expander.
17:24:48
Shinmera
It's a function name, but that doesn't mean that an accessor needs to be a function
17:25:06
Shinmera
There is a section that specifies that an implementation is allowed to implement (setf foo) as a setf-expander on foo rather than a function.
17:29:00
Devon
The symbol CAR and the list (SETF CAR) are both function names. (fboundp 'car) works, if (fboundp '(setf car)) is not required to work, what does?
17:29:18
Shinmera
For each standardized accessor function F, unless it is explicitly documented otherwise, it is implementation-dependent whether the ability to use an F form as a setf place is implemented by a setf expander or a setf function. Also, it follows from this that it is implementation-dependent whether the name (setf F) is fbound.
17:30:23
Bike
the fact that you can (setf (car ...) ...) doesn't mean there's a function called (setf car). the setf working can also be accomplished by a setf expansion (into eg rplaca and returning the value)
17:31:34
Devon
Shinmera: Thanks for finding that. The question of how to detect whether a given symbol is setf-able or not remains unanswered.
17:32:07
pjb
And even if (setf f) is bound, it's still implementation-dependent whether it's used by setf!
17:32:17
Bike
get-setf-expansion will return a default sometimes, and if it returns the default you can check whether (setf f) is bound
17:32:42
Bike
but i don't know if that's reliable, maybe an implementation could return a non-default setf expansion that still doesn't work
17:32:58
pjb
Bike: I wouldn't be so sure. I'd rather use (macroexpand-1 '(setf (f x) v)) to check whether there's a (setf f) function…
17:42:18
Devon
(second (fourth (multiple-value-list (get-setf-expansion '(#:foo #:bar))))) => #'(SETF #:FOO) in CCL but it smells unportable
17:43:41
Bike
there can also be situations like, you have a file with (defun (setf foo) ...), and also (setf (foo ...) ...) forms in the file. while compiling the file there is no setf function (and no custom setf expansion), but it'll be fine when it's loaded
17:44:16
pjb
(second (fourth (multiple-value-list (get-setf-expansion '(car x))))) #| --> #:g66321 |#
17:47:59
Devon
(defsetf file-position file-position) => FILE-POSITION ; So CCL does it and implementations have so much latitude in this, it'd be truly bizarre to forbid it.
17:49:52
Devon
11.1.2.1.2 Constraints on the COMMON-LISP Package for Conforming Programs ... undefined ... 13. Defining a setf expander for it (via defsetf or define-setf-method).
17:52:24
Bike
maybe the reason it doesn't have a setf is that it doesn't return the new value like setf is supposed to.
18:01:32
Devon
Thanks everyone, (incf (file-position s) i) will have to wait for the next *ahem* ANSI committee.
18:10:56
pjb
Devon: notice however that it should work on implementations running on POSIX systems, and assuming the stream is a binary stream or uses a 1-1 encoding.
18:16:17
pjb
Devon: also, (defun fpos (stream) (file-position stream)) (defsetf fpos (stream) (position) `(file-position ,stream ,position)) and then: (incf (fpos stream) i)
18:33:58
Devon
pjb: Needs gensym s `(let ((,s ,stream)) (unless (file-position ,s ,position) (error "Unable to set file position.")) (file-position ,s))
18:34:43
pjb
If you want to give more precise errors, ok. (incf nil) #| ERROR: The value nil is not of the expected type number. |# would do too.
18:37:01
Devon
Sans error checking still needs the gensym temp s '(let ((,s ,stream)) (file-position ,s ,position) (file-position ,s))
18:39:34
Bike
i mean, in the defsetf body stream is bound to a symbol. you don't have to worry about multiple evaluation.
20:54:24
aeth
"The function was called with fourteen arguments, but wants exactly twelve." I've created a monster.
20:55:11
aeth
And, yes, this is *with* helper struct objects, standard objects, and arrays to try to minimize that number.
22:04:53
Devon
false/true in CLHS unless ... if the test-form yields false, the forms are evaluated ... Otherwise, if the test-form yields false ...
22:10:41
Bike
there's http://www.cliki.net/Proposed%20ANSI%20Revisions%20and%20Clarifications, and it mentions that but otherwise I don't think so, no