freenode/#lisp - IRC Chatlog
Search
11:59:01
_death
gitlab requires javascript to view static text.. github getting worse day by day.. recently I noticed that followers and then repos are no longer ordered by date of last update.. I expect they'll continue to gimp it down.. so everything is basically terrible
12:01:11
oni-on-ion
aha! i can use M-x eww for github views, even syntax color it; MS is going to try to "do a facebook" with it.
12:01:55
oni-on-ion
that is how i see it. MS always copying stuff and github purchase was perfect to buddy on a social platform. cant wait for windows only featurez
12:32:36
russellw
The standard library function sublis, takes an expression and performs variable substitutions from an alist. I need to write a variant version that performs iterated substitution for an alist returned by unification that e.g. maps x->y->z. The code is easy to write, but what would be an idiomatic name for the new version? sublisr for the recursive version? sublis* for an extended version?
13:44:13
pfdietz
"Other integer sizes often exist. It will round up to the nearest one. e.g. (integer 0 5000000) becomes (unsigned-byte 32) everywhere I tested except SBCL, where it becomes (unsigned-byte 31)"
13:54:59
yrk
why is clsql refusing to build on my machine? "Ensure that you have multiarch i386 build tools and libraries if you want to build 32-bit library"
15:22:36
francogrex
an someone give me pointers as to how investigate and correct this problem here, it's doing my head in: https://pastebin.com/Ke1rXaVN
15:23:30
francogrex
I had no problems in a previous version of that library, but the new one causes errors
15:26:36
francogrex
but the stepping is not that fine-grained and it kinda skips over large parts, so I am not able to understand what is the undefined alien function that is the error
15:38:14
jkordani_
if you've changed your debug level, you will also need to purge all fasls and recompile with those settings
15:41:13
jkordani_
francogrex: mmm.... I wouldn't be surprised if debug declarations are also honored for interpreted code
15:42:11
jkordani_
ccl doesn't have an interpreter for example, so everything is compiled. Even if you used load-source-op, fasls would still be created
15:44:09
francogrex
i could have used it to compare otherwise. in any case though the code runs fine on ccl, it's the library's interaction with sbcl that is problematic
15:44:30
jkordani_
and also if you're relying on ql libraries, it is possible that loading them also causes a compilation, even if your own script is not compiled
15:45:35
jkordani_
but i'm making assumptions here, I would be curious to know if your system has cached fasls around, unless you've made pains to ensure that no compilation is performed on any code your code depends on
15:49:08
jkordani_
there are some things to know to get sbcl to produce the debug output you'd expect but I can't find the specific info at the moment. And gdb is only as good as the optimization settings and debug symbols it can find ;-) trust me I'
15:49:26
jkordani_
ve wasted so much time trying to figure out why I can't see some local here or there
16:37:14
phoe
Is it possible to send binary data inside Lisp strings, as long as I escape the #\" and #\\?
16:38:10
dlowe
the answer is "other people will hate you if they have to deal with this crap in their code"
16:38:39
jasom
The easiest way to handle binary data in strings is to use iso-8859-1 when serializing, since all modern implementations use unicode, that means char-code will be the byte that ends up on the line
16:39:08
jasom
however, there is the issue of line-endings. Many lisps on windows will default to converting #\Newline to #\Return #\Newline on output
16:39:45
jasom
last I checked, all but one (CCL I think?) lisp had a way of specifying the line ending in the external-format, so it is motsly soluble
16:41:57
jasom
On many implementations strings are far faster than byte vectors, perhaps counterintuitively. If you only care about some subset of (SBCL, CCL) then fast-io is probably a better bet, since CCL can't do binary strings on windows correctly and fast-io is only rarely slower (and sometimes faster) than using strings on SBCL.
16:42:50
jasom
As far as doing things that are mixed ascii and binary (many formats work this way) I find the best of the bad choices is to use #. to conver the string to binary at read-time.
16:46:20
jasom
phoe: if you have "mostly text" formats that may contain a small amount of binary information, then using iso-8859-1 is by far the easiest way, except windows/ccl just won't work
16:47:40
asarch
I was reviewing the bodyless Fibonacci computing loop: (do ((n 0 (+ 1 n)) (cur 0 next) (next 1 (
16:48:34
jasom
asarch: I tend to avoid DO since it's a pain to remember that many positional arguments in a control-flow macro
16:50:13
asarch
Common Lisp would be great in this cases: https://www.youtube.com/watch?v=jvIzIAgRWV0
16:52:14
jasom
jkordani_: good to know; I may be misremembering the implementation, or it may have changed in the past 10 years.
16:54:21
jkordani_
jasom: https://ccl.clozure.com/docs/ccl.html#characters-and-external-formats but note that *default is unix, even on windows
16:55:36
jkordani_
I seem to remember having to change *something* else in order to get it to work the way I wanted on ccl though so I don't think you're wrong
16:55:54
jasom
phoe: disregard what I said about CCL, feel free to use binary strings and an iso-8859-1 encoding, though others may hate you (I got more pull requests to change to using byte vectors than I have gottent total pull requests on all other lisp projects I've ever put on github).
16:56:46
jasom
and I eventually switched to fast-io, as it was within an order of magnitude of the speed of strings on all implementations except CLISP
16:57:53
jasom
when your string functions are compiled hand-optimized C and your byte functions are only slightly optimized byte code interpreted, there's no escaping the performance gap.
16:59:34
jasom
I also had 2 different people suggest using offset vectors instead of copying subvectors out both citing "performance" and both obviously never having actually benchmarked the difference...
17:00:19
jasom
I don't know if it's gotten better, but at the time simple-array was several times faster than non simple-array on sbcl.
17:52:27
jasom
and there's always dynamic programming version of fib: (defun fib (n) (if (< n (length *fibs*)) (aref *fibs* n) (progn (vector-push-extend (+ (fib (- n 1) ) (fib (- n 2))) *fibs*) (fib n))))
18:30:40
pjb
AFAIK, it didn't require hardware support. Wouldn't that be an interesting optimization to implement with a multi-generational copying garbage collector? (ie. older generations are not mutated, so we could cdr code lists in them without much drawback).
18:31:37
shrdlu68
When an array has an :element-type that is also an array, is it possible to have an :initial-element that won't just be the one same array?
18:34:19
pjb
shrdlu68: (map-into (make-array 3 :element-type '(vector t 4)) (lambda () (make-array 4))) #| --> #(#(0 0 0 0) #(0 0 0 0) #(0 0 0 0)) |#
18:35:08
pjb
shrdlu68: or (make-array 3 :initial-contents #(#(1 2 3 4) #(0 0 1 1) #(2 2 1 1))) #| --> #(#(1 2 3 4) #(0 0 1 1) #(2 2 1 1)) |#
19:03:00
jackdaniel
trafaret1: you may write a compiler in common lisp which will assemble sexp instructuions tailored for PLC
19:18:59
shrdlu68
Can someome make sense of this type-error? https://gist.github.com/shrdlu68/10ce10d70d4818017a174226382ba990
19:22:38
Bike
shrdlu68: (simple-array single-float 2) means a two dimensional array of single-floats.
19:23:03
pjb
shrdlu68: (typep (make-array 2 :element-type 'single-float :initial-element 0.0) '(simple-array single-float (2))) #| --> t |# that should work.
19:24:46
pjb
You're losing a lot of time with those type considerations. Wouldn't this time be better spent not putting any type declarations and improving your algorithms or your life?
19:25:45
pjb
Not counting that restricting the types of sequences or arrays will generally bite you in the ass later, when you want to pass some other type of sequence or array. Then you will have to copy, and become as slow as C++.
19:27:43
shrdlu68
pjb: sb-sprof says that (SB-VM::OPTIMIZED-DATA-VECTOR-REF T) is the function with the most sample, I'm trying to see whether I can optimize it away.
19:28:23
pjb
shrdlu68: but of course! It's always in optimized functions that all the time is spent!
19:55:01
pfdietz
There is an even better way of computing the n-th Fibonacci number, though, involving raising a certain 2x2 matrix to the n-th power. This takes O(log n) arithmetic operations (and with most of those having small size compared to the last O(1) iterations of the repeated squaring.)
20:59:50
aeth
Oh no. That's making me want to revise my project Euler code again. I think there's an n-th fib question or two
21:06:00
Bike
i remember the fib questions in euler generally being more about identities than computation
21:06:55
Bike
like sums of all, or odd, or even indexed fibonacci numbers are just otherfibonacci numbers, and stuff
21:08:50
aeth
I guess this new information won't be useful in my Euler lib (I separate my answers from the general algorithms/etc. used to solve the problem)
21:49:25
cl-arthur
There was a prime sieve implementation through infinite streams as one of the exercises in SICP if I recall correctly, fun stuff :)