freenode/#lisp - IRC Chatlog
Search
15:19:34
sjl_
You could certainly define your own generic function that falls back to COERCE, but I don't think you can extend COERCE itself.
15:27:25
|3b|
if i'm defining an asdf module type that processes a directory of files, what do i need to do to get asdf to reprocess it when files in the dir change?
15:29:15
|3b|
right now i have (additional-input-files compile-op) that returns list of files (as relative pathnames) in the dir currently, and (perform compile-op) sees them, but it doesn't re-run compile-op if i reload the system after changing input files
15:35:55
griddle
in lisp, is there a differentiation between the idea of a "scope" and an "environment"
15:37:30
beach
scope n. the structural or textual region of code in which references to an object, a binding, an exit point, a tag, or an environment (usually by name) can occur.
15:37:44
beach
environment n. 1. a set of bindings. See Section 3.1.1 (Introduction to Environments). 2. an environment object. ``macroexpand takes an optional environment argument.''
15:38:39
griddle
so a scope is a subset of the idea of an environment, but a scope can contain environments?
15:40:36
beach
Most programming languages don't have the concept of an environment the way Common Lisp does.
16:20:45
|3b|
apparently my problem was returning relative paths from additional-input-files, so it failed to find timestamps
17:19:50
sebboh
Hi. I don't understand systems. Still. I'm writing a simple script for local use at the command line and I want to use iterate. Do I need to get that via quicklisp?
17:22:04
sebboh
I invoke my script with `sbcl --script ~/src/foo/foo.lsp`. Yeah, I use (ql:quickload "foo" :silent t) in other, similar scripts.
17:23:28
sebboh
But when I try to (ql:quickload "iterate").. then call (iter (for ...) ...) ... I get warning function not defined on ITER and FOR.
17:24:26
sebboh
when I try to (use-package 'iterate).. I get a conflict between iterate:iterate and common-lisp-user::iterate? So.. I'm doing something wrong, I'm trying to do something I don't need to do. I think.
17:28:14
sjl
sebboh: I wrote something a while ago on the differences between packages and systems you might find helpful: http://stevelosh.com/blog/2018/08/a-road-to-common-lisp/#structure
17:28:25
sebboh
oh, right, --script skipts the sbcl init file. Right. Right now, I'm in slime. For actual --script use, I did this: http://paste.debian.net/1048669/ To be clear.. I wrote a couple scripts last year and now I'm trying to add a new one and I'm ... slowly remembering how I put these together. :)
17:28:39
sjl
because like Bike notes, you still need to figure out that in addition to the --script/startup stuff
17:29:19
sebboh
yes, the packages stuff is my problem. The --script vs quicklisp stuff I think I can handle. I have a working example.
17:31:02
sjl
the symbol conflict is an unfortunate interaction between read/intern and the package system that always ends up biting new people eventually.
17:32:22
sebboh
I might be having a problem I don't need to have. Does iterate exist in CL, without resorting to quicklisp?
17:32:59
sjl
I mean, you could use LOOP instead (which is built in) but it's worth figuring this out, because *eventually* you'll probably want something that's not built in.
17:35:15
aeth
LOOP is basically required for conditional :collect/:append as far as built-ins are concerned. It also behaves differently than do/do* when stepping through variables so knowing all three there is useful if you have a complicated iteration
17:35:40
sebboh
phoe, ok, I did (ql:quickload "iterate") (use-package :iterate) in slime, and that's when I got ... dammit, it was a heisenbug.
17:36:44
sebboh
no, sorry, that's more specific. it was a timing-related problem. I remember this now. I have to wait a second when using slime and ql:quickload'ing something before doing the use-package or it fails.
17:37:01
sjl
2. This means the reader reads in the string iterate, notices it hasn't seen this symbol yet, interns it in the current package.
17:37:37
sjl
3. Then you say "oops, I forgot" and use-package it, but now there's already a symbol iterate (the one it just interned) and oops: conflict.
17:38:12
sebboh
sjl OH! it's not timing... sjl is right, I *did* intern a symbol called iter *before* the ql:quickload... much less the use-package! And I do that like.. every time I use slime. *face palm*
17:39:41
sebboh
ok.. why did I think it goes away after some time? What is 4. here, does my use-package succeed when I try it a second time or something?
17:42:23
sebboh
... I don't read the restarts much, I just mash 2 or 5 until the screen goes away. I withdraw my question.
17:43:12
sjl
Either of those would "fix" the problem, which would let use-package finish successfully. The one that would actually fix the problem the way you want is 1 -- unintern the old, mistakenly-interned symbol and keep the new one (from iterate itself).
17:44:37
phoe
once you're in trouble, it has a lot of tools to help you get back up and running quickly
17:45:22
sjl
This isn't Scala where the compiler tells you to eat shit because it stack overflowed while typechecking -- CL errors are often quite good, and the restarts will sometimes let you fix the problem without having to restart whatever you were trying to do.
17:45:48
sjl
(don't ask me how we managed to make the scala typechecker blow the stack -- I have no idea)
17:46:48
sebboh
I am familar with restarts. I even have a better understanding of 'abort, retry, or fail?' as seen in DOS for PCs, now that I saw how restarts work. I got in the habit of disregarding the restarts when I realized that even if I, for example, provide a value... I'm still going to have to edit the code otherwise I'll *always* have to provide the value (for example) when I run it. So I might as well abort and
17:46:50
sjl
And you can get lots of that nice error handling support in your own code by taking advantage of things like ccase, ctypecase, check-type, assert, etc.
17:47:27
sjl
Yeah, that is sometimes the case. If it's a long computation it's nice to have the option to not have to restart the entire thing.
17:48:15
sjl
An example of a "long computation" might be the main loop of a video game, which is one reason I like Lisp for gamedev.
17:48:16
pjb
sebboh: to answer to both your questions (that you don't understand systems, systems vs. packages, and whether you need to get iterate via quicklisp), no, you must not get iterate via quicklisp.
17:48:43
pjb
sebboh: try to locate a git repository, or a tarball with the sources of iterate. download it, unpack it. Read the README.
17:49:59
sebboh
oh. Uh, certainly. But if I do that, I'll end up authoring yet-another-asdf-abstraction-layer
17:50:24
pjb
Well, not exactly. Because I bet the tarball or git repo of iterate will already contain an asd file.
17:51:05
sebboh
presently if I am going to git clone some CL system that is already in the quicklisp manifest, I'm going to git clone it straight into quicklisp/local-projects ... ;)
17:51:32
pjb
sebboh: the point of the exercise, is indeed to make you realize what you would have to author as tools. So you will understand the point of quicklisp and asdf, what systems are, vs. packages and the rest of the lisp code.
17:52:29
sebboh
I mean if I do pjb's suggestion and do the exercise, then I'll -- yes, to see the landscape from the point of view of the author of cl systems meant to be shared.
17:59:11
phoe
https://github.com/keithj/alexandria/blob/e5c54bc30b0887c237bde2827036d17315f88737/package.lisp#L176 is exported for no reason.
18:04:05
anamorphic
Would something like (group-by seq &key test/predicate key) belong in alexandria?
18:17:21
cgay
phoe: serapeum doesn't show up in the "utilities" category on quickdocs: http://quickdocs.org/search?q=utilities you can find it by search for serapeum, but you have to know the name first. not sure if you're the author...might be worth fixing.
18:25:14
fouric
My first thought is start with a hash table, and then replace it with a struct + hash table using macros
18:25:37
fouric
(where the struct holds (1) the hash table and (2) all of the keys that can be determined at compile-time)
18:25:51
fouric
...but i don't know how i would even begin to build up some global table of keys at macro-expansion time
18:29:58
Bike
how much is moved to compile time, exactly? is (gethash 'whatever table) reduced to a constant, an array lookup,what?
18:36:02
didi
Oh, pity. `format' can use a different _char_ to separate groups of digits with ~D, but I want to use more than one char.
18:37:09
phoe
Bike: my question is, by a time a compiler macro function runs, does it have access to the argument it is called with? like, can it detect whether it is a literal?
18:41:08
anamorphic
separeum:partition wasn't quite what I was after. I was hoping to group by a predicate and have a hashtable with keys that are the values passed to the predicate. e.g. (group-by '(11 22 33) #'oddp) => hastable with t -> (11, 33) and nil -> (22). Basically what group-by does in clojure
18:44:33
fouric
wait, in order to implement this, though, wouldn't you need to actually track individual semimaps around? like, if i create a semimap "foo" in one scope and then pass it to a function, doesn't it become incredibly difficult to connect the inferences in the function (e.g. in function bar which was called with the semimap foo, we see that there's a constant access of a key :baz, but then how do we "propagate"
18:57:17
pjb
(com.informatimago.common-lisp.cesarum.list:equivalence-classes '(11 22 33) :key #'oddp) #| --> ((22) (33 11)) |#
19:03:51
sjl_
anamorphic: I ended up writing my own group-by because I didn't find it anywhere already https://github.com/sjl/cl-losh/blob/master/src/sequences.lisp#L69-L113
19:06:52
Xach
cgay: i think for open source lisp stuff it is pretty common, but not so common for lispworks and allegro users
19:12:12
sjl_
https://github.com/informatimago/lisp/blob/master/common-lisp/com.informatimago.common-lisp.asd#L40
19:14:40
fouric
cgay: well, you said something about "stealing" ideas, and that you weren't doing anything in lisp
19:14:50
anamorphic
group-by https://paste.ofcode.org/d4YZ6HVGWBzd5ApXMmFiDa Probably a bad name, though that's what Clojure calls it (I think)
19:15:16
sjl_
Just to be clear: quickdocs is just a random site that programatically generates documentation for everything in quicklisp, it's not maintained by the same people (person) as quicklisp, doesn't have a way to customize/redirect what gets shown, etc.
19:16:09
sjl_
anamorphic: might be worth letting it take a :test arg to speficy the test of the resulting hashtable
19:18:06
Xach
cgay: That doesn't seem too likely, but it's possible. I never seriously looked into Dylan. For a while I worked with Andrew Shalit and he of course is one of the authors of the reference manual.
19:19:24
cgay
I can link you. :) But I'm not giving you one of my precious copies unless you do some Dylan work.
19:19:25
Xach
I have nothing against dylan but don't want to discuss it in #lisp - there is sometimes a tendency of people working on their own language or language tools to come here and discuss their own things and only thinly disguise it as CL discussion. or not even attempt the disguise...
19:20:31
Xach
7 ago today nikodemus and I and a few others were in a late night chip shop in amsterdam trying to think of a name for a new project, and settled on sharplispers
20:22:17
phoe
Of all the people mentioned on https://common-lisp.net/project/alexandria/ I only know beach. And Attila, but I haven't seen him around for a while.
20:52:55
pjb
cgay: phoe: yes, currently it's not in quicklisp, because new sbcl releases detect compilation errors in it, and I'm not paid by sbcl to update my software each time they issue new releases. I'm not against correct it, but it takes time that I don't have.
21:02:57
aeth
phoe: That looks to me like the Gitlab syntax highlighting mistakes, where it will highlight types like that no matter where they appear.
21:03:41
aeth
Of course, CL is a Lisp-2 and types, like functions and variables, are one of those 2 namespaces, so you're free to use type names wherever.
21:04:26
aeth
oni-on-ion: It's the exact same issue in Gitlab syntax highlighting (which appears to be done through a rubygem)
21:05:06
oni-on-ion
i would think github had things for collab/social editing, like edit right in page and submit pull/issue
21:05:34
aeth
oni-on-ion: I'm talking about e.g. the variable "type" here: https://gitlab.com/zombie-raptor/zombie-raptor/blob/e88adefb0f14976ef30ee598c5ea81afe738b3c8/data/generate-glsl.lisp#L91-97
21:06:42
aeth
oni-on-ion: You can replace the hash with "master" and it will work for now, it just won't be permanent
21:08:28
aeth
Anyway, the proper way to write in a Lisp-2 is to use the Lisp-2ness of it. A variable of type symbol should be called symbol if there's only one. (So glsl-name a few lines down is probably a better example of this.)
21:09:06
aeth
But people who write syntax highlighting probably are using Foo-1s where Foo is their language family
21:10:02
aeth
I wouldn't be surprised if it also highlights if/let/etc. incorrectly when using that as a variable (could happen in macros)
21:11:22
slightlycyborg
Hello. I setf *standard-output* but it keeps getting reset to swank. What gives?
21:11:29
aeth
Basically, it takes keyword arguments in the name if there are any, so (define-function (foo :inline t) ...) instead of (declaim (inline foo)) (defun foo ...)
21:11:52
aeth
And it combines the type declarations in with the lambda-list in a very similar way to the classes in defmethod (the main difference is it supports keyword and optional, but defmethod does not)
21:12:48
aeth
oni-on-ion: It uses keywords because it's basically a destructuring-bind with a &key. (Not quite that because it has to handle the case of (define-function foo ...) as well as (define-function (foo ...) ...))
21:13:26
aeth
If I didn't support the flat version, I could just put the keywords in the macro lambda-list directly.
21:18:01
oni-on-ion
i dont fully quite understand yet why i dont like keywords, actively figuring this out