freenode/#lisp - IRC Chatlog
Search
17:16:19
beach
lexa_: It depends a bit on the style of parser you want. For combinator parsing that is cl-parser-combinators, and also (I hear esrap).
17:21:32
beach
lexa_: Since the Common Lisp language is not moving, libraries that used to work still do.
17:22:08
lexa_
Sorry, I just came from the world of C/C++, and there if software is not updated to recent changes in OS/Libraries it has a tendency to fall apart.
17:23:08
shka
luckly, in lisp land you can sometimes even run 80s software after few changes to port it to the common lisp standard
17:23:41
pagnol
can this be written more compactly using some special loop-macro foo? https://gist.github.com/anonymous/8eed8669312072879c451f5b3de550a4
17:24:49
pjb
I don't know if it's more compact, but (loop for x in '(1 2 3) for foo = (+ x 2) for bar = (* foo 3) for baz = (+ bar 4) collect baz) #| --> (13 16 19) |#
17:26:13
pjb
the point of mapcar here is that you don't have to introduce variables: just use subexpressions.
17:29:04
shka
shrdlu68: yes, but the point is that language is standardized, so it is not like conservative library that depends on other conservative library will stop working because lisp has changed and dependency was not updated
17:36:09
osune
jackdaniel: I'm sorry but I searched the EQL and ECL examples for how to translate c-structs to lisp forth and back, but in the ECL examples I found nothing and the EQL internals are really not easy to follow for me. I can see how with ffi:clines a struct can be declared, and that with ffi:c-inline I can declare the types of the arguments. But what is still unclear to me is what should be the c-type given to fii:c-inline for the struct
17:36:09
osune
(eg struct foo { int a;};) . Currently I can only imagine to create where I provide explicit conversion functions, where I build a up a c-struct by accessing one slot after the other via cl_slot_value, and vice versa. Can you provide some more hints please?
17:38:13
jackdaniel
if you want to introduce some C structure as a native type to ECL, you need to add it in src/h/object.h (and a few other places) and I doubt you want that. If you want to simply pass it around as an opaque object, check out src/lsp/ffi.lsp. That said, your best choice is to use CFFI which has a well-written ECL backend
17:45:30
osune
So to get this working without CFFI I will need quite some callbacks into C. Thank you, that cleared this up to me.
17:46:14
jackdaniel
osune: you may check out how ECL support is implemented in CFFI as well to find some hitns
17:51:53
osune
I'm on a small embedded ARM system and have to fit with some pretty big binary blobs on a 32MByte SPI Flash.
17:54:48
jackdaniel
oh, then remember to not use sstrip with ECL fasl's and libecl.so (strip is fine though)
17:55:34
jackdaniel
as of cffi, you can get down to 3.3M to have it all in one fasl (dependencies included)
17:57:42
jackdaniel
http://hellsgate.pl/files/500c6b9c there for fasl which may be `load'-ed from ECL
18:05:11
osune
minion: memo for jackdaniel: the :type :shared-object / :static-object is not mentioned in the Documentation? Thanks again for the hints :)
19:33:01
flip214
Xach: well, I already knew about :serial, so I only needed something that "always" changes...
19:33:47
flip214
if it doesn't, do a bind-mount of /proc/uptime _only_ into the chroot/jail/container etc.
19:39:57
Xach
flip214: So it seems this delight is only conceptual, as you can't have an absolute pathname as a :file component...
20:18:30
shrdlu68
varjagg: There will likely be warnings about some of the certificates in the bundle having issues, they'll just be skipped.
20:27:34
shrdlu68
varjagg: You could try using curl's bundle: https://curl.haxx.se/docs/caextract.html
20:33:17
varjagg
shrdlu68: that got me a bit further, now it throws x509-decoding-error from x509-decode
20:36:03
shrdlu68
What site did you try to connect to? Let me try to reproduce it, and get curl's ca bundle as well.
20:47:12
minion
sjl, memo from flip214: thanks a lot for the vlime update.... (but) I'm currently looking at spacemacs.... let's see.
20:47:56
sjl
According to the ADSF manual the only correct value for this slot is (keyword string), but I see systems on Github using all kinds of things there, like:
20:48:57
sjl
Ideally I'd like to be able to specify *multiple* entries there, e.g. :source-control ((:git "github.com/...") (:hg "bitbucket.org/..."))
20:51:38
Xach
If you use something contrary to the ASDF manual, it might stop working and break in the future just out of spite.
20:53:16
Xach
sjl: I dig through system file forms but I don't do anything with source-control, personally.
20:53:40
sjl
Shinmera: I use mercurial because git's ui is a shitshow, but want to still provide a github mirror to accept PRs.
20:54:08
jackdaniel
osune: I mean :shared-library and :static-library, for some complementary doc see: https://common-lisp.net/project/ecl/static/ecldoc/Extensions.html#System-building
20:54:08
minion
jackdaniel, memo from osune: the :type :shared-object / :static-object is not mentioned in the Documentation? Thanks again for the hints :)
20:54:22
sjl
Xach: yeah that's what I figured. I'll just leave it blank, I think. The README lists the repos anyway.
20:54:34
shrdlu68
varjagg: There are non-ascii characters in the ca certificate, which is throwing off a function that tries to distinguish between DER and PEM files by the fact that PEM files are supposed to be ASCII (base64-encoded): https://github.com/shrdlu68/cl-tls/blob/master/src/utils.lisp#L125
20:56:48
sjl
Shinmera: Vim has fugitive which makes it tolerable, but I don't like using a TUI for version control. I want shell commands with a sane syntax.
20:57:33
osune
jackdaniel: uhm what is the difference between https://common-lisp.net/project/ecl/static/manual/ and https://common-lisp.net/project/ecl/static/ecldoc ?
21:00:24
jackdaniel
osune: manual is complete to some degree, ecldoc is wip (but has some chapters expanded)
21:15:27
shrdlu68
varjag: It seems to work with other sites: twitter.com, facebook.com, github.com...
21:21:31
varjag
"Error encountered while checking the certificate status. Details: Response status: unauthorized"
21:22:23
shrdlu68
That's OCSP. The OCSP server responded with "unauthorized", so cl-tls couldn't verify the revocation status.
21:22:54
Xach
ACTION ponders replacing system-index.txt with system-index.cdb for insanely large system-index.txt files
21:47:28
rpg
sjl: The source control metadata aren't used for anything. An issue in ASDF is that on the one hand one wants to encourage people to provide useful information, of just about any sort, but on the other hand, one wishes to provide useful error-checking to help people debug their system declarations.
21:48:02
rpg
Perhaps I should have said "ASDF itself doesn't use the source control metadata for anything."
21:49:24
shrdlu68
varjag: cl-tls validated every single certificate in the chain upto the root found in the trusted CA certificates. In the case of Google, it doesn't find a matching root at the last step of the chain.
21:52:31
shrdlu68
The last certificate presented by the server says it's issued by "Equifax Secure Certificate Authority"
21:55:31
shrdlu68
There's no certificate identifying itself as "Equifax Secure Certificate Authority" in the curl ca bundle, that's why validation is failing.
21:57:32
shrdlu68
It seems most clients are configured to validate up to just below the final level (a "depth" argument). If I do that with cl-tls, it works in this case.
22:00:10
varjag
i could hack that in for my specific case, or are you going to push that to the repo?
22:03:35
shrdlu68
https://github.com/shrdlu68/cl-tls/blob/master/src/x509/validate.lisp#L54 Changing (length chain) to (1- (length chain)) makes it work.
22:15:02
shrdlu68
www.bitstampt.net fails because of OCSP. If you disable revocation checking, it'll work: https://github.com/shrdlu68/cl-tls/blob/master/src/x509/validate.lisp#L84
0:21:18
rpg
I think my colleagues have used MongoDB from lisp, but I'm afraid I don't know what API they used.
0:22:04
aeth
I don't think there's a major modern NoSQL (or SQL) database written in Common Lisp. Most people who need a database afaik use postmodern to use PostgreSQL.
0:23:50
aeth
Some databases are written in Java, which is roughly the performance of SBCL (it's hard to compare languages) so there's probably nothing stopping someone from writing a DB in Lisp.
0:24:36
aeth
Interestingly, a database isn't on this list. http://metamodular.com/Common-Lisp/suggested-projects.html
3:41:19
jasom
that's the question a docstring should answer, with a secondary question of "when should I use this function"
3:41:33
jasom
if someone is looking at the docstring, they think they ought to use the function, but aren't sure how
3:42:03
jmercouris
e.g. second arg should be an int, this integer moderates the function in this way
3:42:56
aeth
e.g. if there's a meaningful return value "Returns foo..." or "and returns foo..." probably should be in that docstring
3:44:16
aeth
I usually write that in prose, but you could probably get away with literally just listing those
3:44:26
jasom
jmercouris: they should *not* document how the function works, that belongs in comments.
3:45:39
aeth
Ideally, the way the actual function works should be obvious, even if you need to add helper functions (there's basically no penalty if you move stuff out into meaningfully named functions that are inline)
3:46:13
jmercouris
aeth: I thought declaring functions inline within a function form was a bad idea?
3:46:54
aeth
jmercouris: no, I mean move stuff to top-level helper functions that are obvious if some part of your function isn't obvious, rather than comment
3:47:20
jasom
jmercouris: inputs/outputs/side-effects is a good checklist for "how do I use this function"
3:47:43
jmercouris
if there is enough complexity that warrants a comment, you should probably abstract it out into a function?
3:47:43
aeth
I'm agreeing with jasom that "that belongs in comments", but then adding that imo if you do need to comment, you probably should break the function up
3:49:11
jasom
jmercouris: aeth is suggesting (foo bar baz (biff (boff buff))) ;; I can't just frobnotz bar and baz because sbcl's optimizer is dumbs --- instead: (frobnotz-efficiently-on-sbcl bar baz)
3:50:18
aeth
jmercouris: If you are mostly going to avoid side-effects, you might like the Scheme convention of ! when there are side effects present
3:51:04
Zhivago
jasom: Perhaps that's something that would be better solved by adding a compiler-macro for sbcl rather than changing the code.
3:52:19
aeth
Pretty much the only thing in "Conventions in Scheme" that you should never do and I've never seen is $foo for constant (since CL has +foo+) http://www.cliki.net/Naming+conventions
3:53:26
aeth
jmercouris: The problem with alternatives to "foo!" is that there is no direct CL equivalent. The n in nfoo means "non-consing" but that doesn't guarantee that it is destructive... also you can be both destructive and cons
3:59:37
aeth
I think you don't see foo! in CL because Lispers don't care about destructive code as much as Schemers... but if you're writing part of a program that does care, why not use that convention?
4:02:34
aeth
jmercouris: Oh, and before you mentioned about documenting types. Don't trust the user imo.
4:03:48
aeth
There are two approaches. check-type is 100% portable, but not necessarily what you want. Type declarations might just assume the type in Cthulhu Lisp or some other non-euclidean eldrich abomination lisp from before time, but should work as expected on most modern Lisps when saftey != 0 (and that should always be the case)
4:05:09
aeth
A ton of code written recently uses type declarations and assumes they work as expected, with type checking when safety != 0
4:06:37
aeth
Iirc, an added advantage of type declarations is that they don't need to check type if they're running on Lisp machine hardware that is designed with Lisp types in mind.
4:13:03
aeth
It can generate very efficient code for non-bignum numbers and sequences because a lot of built-in functions are generic over numbers or sequences (like + or map)
4:13:31
aeth
Although a check-type should produce a very similar result, just with the type-checking in the function instead of before the function
4:14:42
jasom
jmercouris: there is no exaustive list of types since e.g. (integer 5 8) would be all integers in the range [5,8)
4:14:58
aeth
Actually, the checking in a foo with type declarations seems to be considerably more concise than the checking in a foobar with check-type when I use sb-disassem:disassemble-code-component to see the full disassembly (which disassemble does not provide)
4:15:12
jasom
jmercouris: but the hyperspec lists types in the various sections (e.g. the numeric types are listed in the chapter on numbers)
4:15:36
aeth
this might be SBCL specific, but I think it's because of the semantics of check-type vs type declarations
4:16:30
aeth
Hmm, this seems to be the difference in SBCL. check-type will let you insert a valid replacement and a type declaration won't
4:18:37
jmercouris
ah, so a type is a function that accepts args to produce some sort of check function?
4:19:15
jmercouris
well (integer 5 8) looks like a function call to "integer" with the arguments 5 and 8
4:20:23
jasom
you will almost never define a new parameterized type in lisp because Lisps type parameterization is not very powerful
4:20:54
aeth
You almost certainly want to restrict the integer type for it to be useful. "fixnum" is the laziest way to do it, but is non-portable. Stuff like (unsigned-byte 8) and (unsigned-byte 32) are great because they're almost certainly going to be supported in 64-bit implementations' specialized-arrays
4:21:38
aeth
But if you want type information to produce more efficient code you really want the compiler to know that the integer is never going to be a bignum (which might have to require more complicated code on your end)
4:22:27
jasom
jmercouris: cmucl and sbcl at least will emit some compile-time checks in the presence of types, and will always emit run-time errors if safety is non-zero
4:22:27
aeth
Afaik, for the most part, the compiler already knows what the type has to for a variable be by the function you try to use on it.
4:22:33
Bike
if you want an actual assertion, use check-type or negotiate with your vendor (i.e. read the manual)
4:23:19
jasom
jmercouris: yeah, once you use a lisp like that, it becomes so obviously the right way, that most implementations have copied it
4:23:47
aeth
Bike: I think it's more nuanced than that, i.e.: For the most part the compiler does know anything between function boundaries because (foo 42) might return 43 now, but could be redefined at runtime to return "Hello, World!"
4:24:22
jmercouris
I just want to emit useful error messages to the user if they have supplied an incorrect type
4:24:51
jmercouris
because if the compiler knew what I was trying to program, it could possibly do it for me instead of me having to type it out :D
4:27:17
aeth
jmercouris: instead of having a foo-fixnum, foo-single-float, foo-double-float, foo-bignum, etc., you can just have one foo
4:28:09
aeth
If it's inline, it produces exactly the same code as if you had that many inline functions
4:28:34
aeth
But... you could do an inline function call as a sort of compromise (and that's probably common enough that that library should support it imo)
4:29:41
aeth
(class-of (make-array 3 :element-type 'single-float)) => #<BUILT-IN-CLASS SB-KERNEL::SIMPLE-ARRAY-SINGLE-FLOAT>
4:29:48
aeth
(type-of (make-array 3 :element-type 'single-float)) => (SIMPLE-ARRAY SINGLE-FLOAT (3))
4:30:05
aeth
Not only is that class not portable afaik, it also doesn't have some critical information, like length
4:30:54
aeth
And, yeah, specialization store is most useful when you want to inline or at least inline the function call so the runtime dispatch is avoided
4:31:47
aeth
Dealing with C libraries through CFFI is a nightmare... and C++ is ultra-nightmare or something.
4:45:26
aeth
jmercouris: My personal design philosophy for my Lisp code is that anything that can be done ahead of runtime should.
4:59:50
jmercouris
beach: Good morning, and in case I don't see ya, good afternoon, good evening, and good night!
5:02:36
aeth
Do implementations turn (list 1 2 3 4 5) into (cons 1 (cons 2 (cons 3 (cons 4 (cons 5 nil))))) or is there a better way that I'm overlooking?
5:03:14
jmercouris
aeth: I don't see how you could avoid the linking operations when making a linked list
5:04:58
aeth
https://github.com/sbcl/sbcl/blob/0d398686138fa05504c57567d28130cb85fb143e/src/code/list.lisp#L343-L345
5:09:37
aeth
To save people a click, the source is just this when newlines and the docstring are removed: (defun list (&rest args) args)
5:10:28
pillton
aeth: Specialization store can do the optimization you were talking about before. https://github.com/markcox80/specialization-store/blob/master/tests/standard-store-syntax-layer.lisp#L357
5:11:11
jmercouris
just because SBCL happens to make a list of args and then returns that list, doesn't mean that along the line it didn't make the list in the way you are describing
5:11:38
jmercouris
I don't see how it is avoidable to make a linked list without linking the elements of the list
5:12:25
aeth
pillton: so named specializations are inline function calls instead of runtime dispatch?