libera/#commonlisp - IRC Chatlog
Search
22:22:48
Bike
treating it as a storage thing would be uh, weird. hash table implementation might put keys and values in the same vector...
22:23:20
stylewarning
jmercouris: so you much prefer that you supply a test function such that the hash function and test function form a reverse implication on the key types you have, and the value types are Whatever You Feel Like Whenever You Woke Up? ;)
22:23:30
phoe
even if it would be just for runtime checks, there is some value in runtime safety alone
22:23:49
jmercouris
stylewarning: the test function is only a mild implication, and it can span across types!
22:23:53
Bike
i'd say if you want safety you can define gethash+(setf gethash) analogues that have declared/checked types respectively. don't feel strongly about it though.
22:23:58
stylewarning
Bike: I'm saying I like the design element of specifying a type in the constructor, not that it directly has to do with storage. (:
22:24:11
stylewarning
jmercouris: types in Lisp are sets, and sets can be unioned, so it still is all the same
22:27:16
Bike
if you do it in the constructor and have gethash/(setf gethash) check the types there you're doing type checks based on a type only known at runtime which is gonna be a lot less performant.
22:29:20
phoe
so you seek a hashtable library which generates different code based on the compiler policy
22:29:28
Bike
unfortunately that's generally tied into impleemntation type inference stuff so it's not possible to deal with portably
22:29:42
phoe
your GETHASH might include typechecks on default safety levels and no runtime checks on (declare (optimize :yes))
22:29:56
Bike
...but if you do want to do this, maybe start with having a table library, and then we can make my shed
22:30:43
phoe
Bike: maybe that's doable portably; an implementation should be able to elide surplus checks, like, if it knows that a thing is a FOO then it doesn't need to check if it's a FOO anymore
22:33:13
Bike
maybe i should just write out a thing about why type-directed transformations might be nice but aren't very doable, since this keeps coming up
22:33:16
phoe
you'd need to try and expand into the code that will then, hopefully, be optimized by the compiler.
22:35:11
jmercouris
which means you should be able, in the worst case to kill the repl and inferior lisp
22:35:12
stylewarning
SLIME's request for input in some random buffer has caused issues in live presentations once
22:37:42
harovali
jmercouris: it's not frozen, right . Maybe it's slime in a loop which emacs cannot exit , and which eventually will exit itself
22:37:50
heisig
I see two ways to obtain typed hash tables: 1. A defstruct-like macro that generates the hash table, its type, and its accessors. 2. Painful, non-portable SBCL hacking.
22:41:34
stylewarning
heisig: i'm probably in favor of a portable intf+impl with painful SBCL hacking
22:44:57
heisig
So the portable interface would be something like (make-hash-table :key-type fixnum :value-type symbol :hash-function #'identity)?
22:45:09
phoe
stylewarning: this sounds exactly like the goal that this library that I linked above has
22:45:24
phoe
it already has some fallback stuff plus depends on implementation-defined stuff if an implementation supports these
22:46:04
phoe
mostly cause of (let ((fixnum 't) (symbol 'nil)) (make-hash-table :key-type fixnum :value-type symbol :hash-function #'identity))
22:47:24
stylewarning
heisig: tbh i'm not sure, i'll play around with an interface, maybe once I have a strawman we can mess around with it
22:50:48
jackdaniel
first I need to truly separate passes in ecl, then why not ,) however, is there any reason that having this will improve anything hash-table-access-wise?
22:52:05
phoe
a compiler will be able to warn if you try to use a non-fixnum key in the gethash, plus it'll know that the result will be (or null symbol)
22:56:33
jackdaniel
hash tables are fast *yet* slow for performance-crictical code (access-wise); the real question is that: is there any data to support thesis, that it would be worth the effort?
22:56:38
pjb
phoe: do you realize that you cannot put anything in the result of (let ((fixnum 't) (symbol 'nil)) (make-hash-table :key-type fixnum :value-type symbol :hash-function #'identity)) ?
23:10:32
phoe
it's just that shadowing CL:EQ makes me die a little inside due to the side effects of that
23:11:54
Xach
mfiano: was there a recent change to plain pngload? i reset my vcs cache and now it seems to be gone and completely replaced with pngload-fast.
23:12:07
Xach
I don't know if it's something that got jiggled around when I purged my cache or what.
23:12:42
jackdaniel
sure, it wasn't very bright though, I've personally never encountered a situation where I'd need such eq, (every (curry #'eq a) other-values) would suffice too
23:13:40
phoe
Xach: https://github.com/mfiano/pngload redirects to https://github.com/mfiano/pngload-fast
23:15:19
phoe
Xach: it seems that it got renamed completely, see https://github.com/HackerTheory/pngload/commits/master
23:15:20
Xach
There was some discussion a while ago about having them both available separately and I'm not sure what happened to break things now. whether it's a local issue or something that coincidentally happened at the same time.
23:26:16
mfiano
I was going to but you said you were going to merge the pngload-fast features into pngload with reader conditionals for implementations to have fallback support
23:27:23
mfiano
I prefer not thinking about either repo. They drain too much of my limited resources
23:41:19
harovali
does anyone know of some current tutorial or documentation to cl-pdf and cl-typesetting?
23:42:24
stylewarning
phoe: I have created the perfect overengineered macro for you: https://github.com/stylewarning/lisp-random/blob/master/associate.lisp
23:42:31
harovali
i'm reading https://github.com/mbattyani/cl-typesetting/blob/master/documentation/cl-pdf-doc.pdf which might be outdated
23:44:12
Xach
phoe: it is because of how i implemented portability. i would do it differently today.
23:45:12
Xach
mfiano: were the pngload-fast changes freshly pushed today also, even though the commits are old?
23:49:01
Xach
Ok. Well, I'm not sure how to account for what I'm seeing, but the missing pngload system breaks a bunch of stuff.
0:12:06
mfiano
Xach: The worst part is this same thing happened the last time you pinged me about it. I had this repository hard reset to a specific commit, and pushing a minor change fast-forwarded it. This is what I get for not paying attention.
0:15:55
mfiano
Repairing this is above my head right now, because I can't rebase or revert with merge commits in the tree
0:20:05
mfiano
I guess I can revert just my working tree and then make another commit. Simple enough idea. Let's see how it plays out
2:09:27
Xach
well, here are a bunch of update failures: https://gist.github.com/quicklisp/97e9df796326da8d0c75af75b91400d9
3:48:39
smokeink
(in clisp): (list :); => (:||) , is there any way to make this work in sbcl as well? illegal terminating character after a colon: #\)
3:49:51
no-defun-allowed
Yeah, I think CLISP is being lenient and you have to at least put :|| there.
3:53:03
smokeink
https://www.reddit.com/r/lisp/comments/72n6gy/the_nest_macro_ported_from_common_lisp_to_scheme/ ": as a universally accepted token denoting a self-evaluating keyword would be handy."
4:06:17
harovali
is it possible to see the coorect glyph in CL-PDF's pdf:draw-text with characters like #\U+00CD ?
4:07:40
no-defun-allowed
From memory, CL-PDF has the kerning information for some Adobe fonts, but only for the ASCII character set.
4:10:03
harovali
I think I should render those unicode strings in another library and compose that in cl-pdf, right? Is cl-typesetting that sort of library? Are there other nice options?
4:16:43
pjb
p0a: :: means you don't care whether the symbol named "BAR" is exported from the package named "FOO" or not.
4:16:58
pjb
p0a: : means that you want to get an error signaled if the symbol named "BAR" is NOT exported from the package named "FOO".
4:17:41
pjb
p0a: so basically, you should always use : and if an error occurs, it means you're messing with the internals of the package, and you should correct and limit yourself to the public, exported API.
4:18:02
smokeink
p0a: they both refer to the symbol named "BAR" from the package named "FOO" . if you want to use foo:bar then first you have to export 'bar
4:23:57
p0a
actually there's no .fasl files I'm super confused. It complains about "/home/emacs/Pictures/foo" but that string does no longer exist in my main.lisp project. I restarted the lisp image too
4:26:45
pjb
p0a: the .fasl files are stored by asdf in ~/.cache/common-lisp/. In general, you don't need to bother with them.
4:27:22
smokeink
HUNCHENTOOT:CREATE-FOLDER-DISPATCHER-AND-HANDLER is trying to access that folder, perhaps
4:28:06
pjb
p0a: CL distinguishes PATHNAMEs designating directories from pathnames designating files. #P"/home/emacs/Pictures/foo" designates a file named foo. #P"/home/emacs/Pictures/foo/" designates a directory named foo.
4:28:59
mfiano
i think you're trying to compile files rather than taking the iterative development approach
4:30:07
harovali
how do I create a new repl in slime if I accidentally closed it ? the inferior buffer is still there
4:35:33
pjb
smokeink: yes, sorry. This was a trick in clisp to read :foo in the keyword package. But for after :, you need to use :||.
5:28:53
p0a
But when I delete that line of code that starts the server in my main.lisp file, the asd file no longer starts the server
5:30:13
pjb
p0a: check your toplevel forms. I would advise avoiding starting things from lisp sources. Instead, define functions, and call them from the repl. Like main, or start-server, stop-server, etc.
5:32:36
p0a
but wouldn't C-c C-c'ing (in-package :project-alpha) get me in project-alpha? It still is in CL-USER> or is that just for the REPL?
5:35:42
no-defun-allowed
If you have it in a file, SLIME will evaluate/compile/&c everything after that definition in the specified package, but it won't affect the REPL.
5:36:32
no-defun-allowed
If you evaluate (in-package package-name) in the REPL, it will change the package there.
5:37:07
no-defun-allowed
And for the love of all things that are not Turing-complete to parse, please don't make a website using C++.
5:37:09
harovali
cl-typesetting has an example which has a sequence type specifier of 'unicode-string-type. I'm trying to compile this code in SBCL, and it seems not to have that name defined. I'm trying without success to figure out the SBCL equivalent. Would you please help me?
5:37:56
no-defun-allowed
harovali: I would use the specifier STRING, because SBCL has Unicode support, so you should be fine.
5:39:29
no-defun-allowed
smokeink: That is a bit of a simplification. *package* is a special variable, and can be bound to many packages by one thread.
5:41:15
smokeink
slime's background evaluation thread peeks at (in-package :package-name) in the source file, and then sets *package* accordingly, before evaling the sourcecode (if I'm not mistaken)
5:42:19
smokeink
pjb : I need help writing that reader macro for #\: https://paste.ofcode.org/sMLY3Awg6pPKtJhrBCRLzT
5:43:40
no-defun-allowed
From memory, the symbol reading stuff is called when there is no macro character to use, so that makes sense, though it doesn't help.
5:47:45
smokeink
I want a macro character that'll allow me to read : as a symbol, and will not break pkg:symbols or :symbols
5:47:53
loke
Apparently it was removed (there is a note about that in CLHS). I must have seen it in the ClTL2 book.
5:54:56
loke
Oh wait. there is more information here: http://www.lispworks.com/documentation/HyperSpec/Issues/iss216_w.htm
6:07:59
harovali
smokeink: no, I'm trying to render a unicode enabled truetype font in making a pdf document with cl-pdf and cl-typesetting
6:12:16
no-defun-allowed
harovali: Those would look like the AFM files in https://github.com/mbattyani/cl-pdf/tree/master/afm
6:14:28
pjb
smokeink: if you want to deal with (foo:) -> (foo:||) then you also need to add reader macro on all consituent characters, and parse foo too.
6:17:35
pjb
smokeink: you could change the test for next-char to something like: (or (find …) (not (nth-value 1 (get-macro-character next-char)))) for more generality, I guess.
6:19:14
pjb
or rather: (multiple-value-bind (rm nt) (get-macro-character next-char) (and rm (not nt)))
8:02:20
galdor
Xach: I was not even aware they were in quicklisp, I have not use them for so many years I do not even remember what they were for
8:03:39
galdor
by all means remove them, I'm pretty sure I never submitted them for inclusion, and I'm not even sure I still have the code