freenode/#lisp - IRC Chatlog
Search
9:10:20
no-defun-allowed
might be a good time to remind people that despite the clhs being quite restrictively copyrighted you can download the CLHS for personal use, and it's only about 15MB including crappy GIF images and all 2300 HTML files
9:11:38
no-defun-allowed
it's 2mb in the targz you get from lispworks so you can do it any time you're bored or have a minute where you're thinking "what language documentation should i download today?"
9:13:43
jackdaniel
here is even better version which is not copyrighted: http://cvberry.com/tech_writings/notes/common_lisp_standard_draft.html
9:14:27
jackdaniel
you may build your own standard draft, change it, annotated it and put it on the website (also use as a pdf with bookmarks - much better to navigate than clhs directly if you ask me, I'm still sold to l1sp.org though)
9:40:28
flip214
no-defun-allowed: also, please contribute to CLUS: https://github.com/phoe/clus-data
9:51:40
ogamita
More worrying is that lisp logs at ccl have been down since login is required on freenode…
10:13:39
no-defun-allowed
If so, subseq works fine, as long as you check the string isn't shorter than your desired length.
13:58:50
heisig
What is the best way to obtain the value of a form that is CONSTANTP, e.g., within a compiler-macro? EVAL?
14:05:22
_death
but there is an issue.. I believe a form may be a constant form but still its value may not be available at that time
14:06:53
_death
for example (defconstant foo 'bar) means FOO is a constant form but at compile-time its value may not be available (for that you'd need eval-when)
14:07:52
flip214
heisig: EVAL won't do - the value might use the wrong binding (global vs. thread-local, etc.)
14:08:19
flip214
it depends on what you're doing with it; perhaps NUMBERP and/or STRINGP is good enough?!
14:08:25
heisig
Hmm, the glossary states a constant form is "any form for which evaluation always yields the same value, ...". Not sure how to interpret that.
14:08:41
flip214
if it's a constant, the compiler will fold it anyway - even without a compiler-macro.
14:09:04
_death
heisig: it means (eq (eval form) (eval form)) => t, given that its value is available
14:09:06
flip214
but I understand the wish to optimize for such cases -- perhaps inlining the "outer" part of a function helps, and that calls some non-inlined inner part?
14:09:55
heisig
flip214: In practice, NUMBERP is probably fine for my case. I just thought there might be an 'official' way to address this problem.
14:10:06
flip214
heisig: that is not sufficient. (IDENTITY *X*) with (DEFVAR *X* 1) will always return 1 (EQL to 1), but any thread that used (IDENTITY *X*) in an argument list might have *X* bound to a different value!
14:11:22
flip214
my CLHS has a few examples; see eg. (constantp '(sin pi)) => implementation-dependent
14:12:16
lieven
the two authors both think the wording is unambiguous, they just disagree about what they meant
14:14:08
_death
flip214: (identity *x*) with *x* naming a special variable won't be a constant form...
14:15:40
heisig
I think I will use (defun conservative-constantp (form) (or (quoted-form-p form) (and (not (listp form)) (not (symbolp form))))) to be on the safe side.
14:16:59
flip214
heisig: " If object is a cons, listp does not check whether object is a proper list; it returns true for any kind of list. "
14:18:45
_death
heisig: still won't pass the symbolp check though.. maybe (and (symbolp x) (constantp x) (boundp x))
14:21:35
scymtym
heisig: what is the purpose of your predicate? is it suitable for your use-case to, for example, consider (+ 1 2) not constant, but #<CLASS …> constant?
14:22:35
heisig
scymtym: The purpose of that predicate was to determine whether a form is so constant that I can EVAL it at any time.
14:26:57
heisig
It's not terribly important for my program. I just thought that maybe there is already an agreed upon way to deal with this situation.
14:27:45
scymtym
moving the evaluation to load time instead of all the way to compile time sometimes works
14:34:05
scymtym
cl-ppcre has an example of this approach and illustrates a caveat: for a long time it did "if (constantp regex env) then (load-time-value (compile-regex regex))". this is wrong if REGEX is constant in ENV but not in the null lexical environment
14:55:15
heisig
I conclude - the right way is to use constantp without an environment and then load-time-value. Thanks everyone!
15:22:25
dim
is there a good documentation somewhere on CL environments and how to use them as a CL user? I'm lacking the practical implications of the idea, and I have no idea how to use &environment in the operators where it exists...
15:23:21
jackdaniel
dim: as it is specified in CL &environment is mostly good for only passing it to other macros
15:23:47
jackdaniel
some important primitives did not get through to ANSI CL, but they were specified in CLtL2
15:24:00
pfdietz
The only thing I have consistently used environments for is as an argument when manually expanding macros.
15:25:04
jackdaniel
dim: for more useful things check out https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node102.html#SECTION001250000000000000000 (they are defined in both sbcl and ccl, they will be defined in ecl too)
15:42:22
pfdietz
The thing I've used it for is to exploit the environment as a kind of poor man's symbol table. If I have a macro that wants to make declaration-like things visible to lexically enclosed forms, I encode that with macrolets whose only purpose is to be deliberate expanded by other macros to get the information back out again.
16:58:45
sjl_
Is there a guide on how to use a proxy to make quicklisp download over HTTPS so it's not horrifyingly insecure?
16:59:09
sjl_
I know about http://netprophetblog.blogspot.com/2014/02/tool-posting-quicklisp-with.html because it's linked from the docs, but that's about how to layer a SECOND proxy over an existing one.
16:59:59
sjl_
I have tinyproxy running locally. I can e.g. `curl https://beta.quicklisp.org/... --proxy http://localhost:8888` and this works fine
17:00:30
sjl_
but when I tell quicklisp to use that proxy with (ql-config:config-value "proxy-url") it's still making the requests to http://beta.quicklisp
17:01:01
Xach
sjl_: I don't know of a guide, sorry. you can modify ql-http:*fetch-scheme-functions* to use e.g. drakma or something with ssl support.
17:01:29
sjl_
I tried setting (setf ql::*client-base-url* "https://beta.quicklisp.org") but that doesn't affect the archive urls that it fetches, because I think it reads those straight from releases.txt which has the bare http:// in there
17:02:27
sjl_
Xach: running tinyproxy should handle the SSL stuff, I just need a way to tell quicklisp to request https:// instead of http://
17:04:32
sjl_
Is a config option for "Please use HTTPS urls everywhere, I'll provide a proxy for you" something that could be added to quicklisp?
17:05:13
sjl_
I'm not even sure having QL use Drakma would work, because wouldn't it still be requesting http://?
17:06:24
Xach
I think *fetch-scheme-functions* is attractive because everything that fetches flows through it.
17:06:57
sjl_
Oh, so you're saying I can wrap the existing "http" fetch-scheme-function to rewrite the URL and then delegate to the old one
17:07:25
Xach
sjl_: I don't know if that will work - I don't know what the existing one will do with a https URL.
17:08:29
Xach
I mentioned this yesterday, but I have a system that is almost ready to deploy that involves fetching signed things and checking checksums and adding more confidence aside from https.
17:11:23
sjl_
Ah, so the user would download your public key over https (bundled in the initial setup file or whatever) and then this pure-CL implementation of PGP checks that whatever it downloads is correctly signed?
17:11:54
Xach
sjl_: yes. the bootstrap file embeds a pgp signature checker and the initial dist key.
17:12:20
sjl_
That would work, I think. Doesn't really matter if I get MITM'ed if it can be detected before executing the code.
17:13:06
sjl_
And if someone wants to use a dist other than yours, they'd get the author's pubkey securely somehow and add it into the list of keys that QL trusts