freenode/#lisp - IRC Chatlog
Search
21:49:23
aeth
You can still define a deep copy by renaming the copy function to %copy-foo and defining an inline copy-foo that does a deep copy
21:50:27
aeth
didi: The standard-object (not CLOS object) way to do it would be to define a copy generic
21:50:34
didi
aeth: But shallow copies can be useful. I'm using it right now. I want a struct just like the original, but with only one slot changed.
21:51:13
aeth
I'm not sure why there isn't a copy method that defaults to a shallow copy for defclass
21:52:13
aeth
jasom: Well, the main point in modern CL is that structs can be optimized for storage and access if :type is provided for a slot
21:55:51
aeth
Except for multiple-value-list and multiple-value-call, if you request the nth value and it doesn't exist, you get NIL as the default value
22:00:12
jasom
the thing I like about the random version is that it is only probabalistically defined to terminate from the standard, but most (all?) real-world implementations it is guaranteed to terminate.
22:02:02
jasom
Bike: if a non-cyclic rng is used, then the probability approaches 1 of it terminating over time, but never reaches it. Real prngs tend to be cyclic though, so there is bounded time for it to terminate (even if it's absurdly large).
22:03:24
Bike
"A cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number." uh
22:04:11
Bike
most-positive-fixnum is finite, and since it's an integer the distribution is discrete
22:05:20
jasom
Bike: consider flipping a fair coin. Let's say I flip the coin until I get 5 heads in a row. That is not guaranteed to terminate, though it is very likely to for any large number of iterations.
22:06:20
jasom
similarly an implementation with less than (integer-length most-positive-fixnum) state in its prng might never terminate on that.
22:07:02
jasom
and it's guaranteed that there are some values it will never return from (random most-positive-fixnum) if there are that few bits of state in the prng.
22:07:55
Shinmera
jasom: Though the spec does say: If limit is an integer, each of the possible results occurs with (approximate) probability 1/limit.
22:08:44
jasom
Shinmera: no finite state prng can do this when you consider bignums, unless you think the spec implies the state must be larger than the largest allowed bignum.
22:09:28
jasom
Shinmera: if it required each possible result to occure with identical probability, then it would explicitly not allow holes.
22:10:37
jasom
Shinmera: there are lots of imperfect prng with 100% even distribution of values (a simple LCG does this, for example).
22:28:20
adlai
re: "most interesting way to get the value NIL" ... how about "as return value of #'type-of"
0:04:31
aeth
Has anyone seen pillton? I just did a `tail -n 100000 '#lisp.log' | grep '\(pillton\)\|\(Day\)'` and it looks like he was last here 21 August
0:10:44
aeth
I'm recompiling with my cache clear to verify it but I think I get problems with specialization-store and ECL and I always try to verify things like that over IRC first.
0:12:16
Colleen
Bike: drmeister said 36 minutes, 42 seconds ago: (ql:quickload something :verbose t) provides lots of info - thank you.
0:18:04
aeth
Hmm, yeah, in ECL I get "* The macro form (VEC--INTO! TEMP-VECTOR-1 VEC2 VEC1) was not expanded successfully."
0:22:42
Jachy
minion: memo for nixfreak: https://github.com/t-sin/one (example of using CL with bash one liners)
5:15:39
nyingen_
So there's a CL lib on github I forked and made a minor patch to (to make it work in modern times). Last commit was 7 years ago. Should I still file an issue and/or make a PR?
5:31:21
jackdaniel
nyingen_: one reason you should do that is a possibility, that someone takes a burden of maintaining this library in the future (not the original author). place he'll take the code and issues is the original repository, same goes for accepting pull requests
5:32:10
jackdaniel
fwiw that's one of things we did with log4cl: we've retyped issues from the original repository and merged dangling pull requests
6:53:15
beach
If you think you are dealing with decimals, you will be very confused when you try (+ 0.3 0.6)
6:54:05
no-defun-allowed
my personal favourite is 0.1 + 0.2 but i think it's double floats only or something
6:54:26
beach
A large proportion of my students told me that SBCL had a bug, the first time they saw this behavior. Very interesting that they had never noticed it in any other language.
6:55:14
lieven
what every computer scientist should know about floating point still isn't read widely enough :)
6:55:40
no-defun-allowed
beach: if you're not busy, could you please explain how SICL manages finding the GC roots in a program?
6:55:44
asarch
Well, I helped my younger brother to add fractions with just pen and paper and I couldn't find in my notes the way to get '0.5' :-(
6:56:32
no-defun-allowed
sbcl uses a conservative approach on x86 and x86_64 but i was wondering if you used specific registers or anything to distinguish unboxed and boxed values
6:57:07
beach
no-defun-allowed: Well, the SICL GC has not been entirely implemented yet, but here is the plan...
6:57:35
beach
no-defun-allowed: For each value of the program counter, the compiler emits information about what is contained in which register.
6:58:32
no-defun-allowed
so the GC just looks up the program counter in your table and looks at what types exist in the registers?
7:00:26
beach
Anyway, you have the complete description in that document. As I wrote, the thing is complicated by callee-saves registers.
7:01:01
no-defun-allowed
(after reading about gothreads i thought about an OS which could manage thousands of threads in one memory space and uses GC and JIT threads and message passing and stuff)
7:02:08
beach
If it weren't for callee-saves registers, each stack frame could be processed independently according to the return address of the next frame.
7:02:38
no-defun-allowed
racket's gc language provides the roots for the programmer which is good but i wanted to know how to find roots as well
7:04:23
no-defun-allowed
it's quite fun being able to debug it in something other than gdb, but the not real (loop across heap collecting garbage) is probably my favourite gc development tool :P
7:06:06
no-defun-allowed
i thought about doing a similar thing in CL but the visual heap viewer was too good to pass on.
7:10:05
ecraven
using slime, is there a way to influence how emacs displays things? can I send something over the wire that will change the fontification in emacs?
7:11:00
phoe
you theoretically could send stuff from the Lisp image for evaluation in emacs, but I haven't seen that used widely
7:11:50
ecraven
I'm getting to the point where I wish I could use emacs like a listener on the old lisp machines :-/
7:18:18
Elyis
hi, i'm trying to set up slime-atom but each time i have the error "If this is your first time running atom-slime, this is normal. Try running slime:connect in a minute or so once it's finished compiling." without any changes (i'm on macos)
8:13:56
no-defun-allowed
however, i don't think there's too much to change if you can do one but not the other.
8:15:57
dorothyw
No. I remember in class there was some very big equation and we learned some rules to take what I would call an expression (4x^2 + x + 3) and do it in our heads without needing the equation. And this had alot to do with acceleration which is meters per second per second.
8:18:25
no-defun-allowed
briefly, the rule for derivation of ax^n is anx^(n-1) and integration of ax^n is a/(n+1)*x^(n+1)
8:18:53
dorothyw
Yes this looks to me much like computer code. I feel it could be converted to lisp.
8:19:12
no-defun-allowed
if you don't have something of that form, just try again with each part of the expression and keep the same operator
8:19:38
dorothyw
If I parse left to right a represents the integer to multiply against the variable to n power.
8:19:47
no-defun-allowed
(so if you have (+ a b), then you'll need to integrate/differentiate a and b and substitute them back in)
8:23:21
no-defun-allowed
dorothyw: everything before x is the new coefficient, everything after is the power
8:23:46
splittist
dorothyw: you now know that 'symbolic differentiation' is the key term to search for. Looking for that plus 'lisp' gives a squillion hits, some with interesting urls including things like 'calc404' in them.
8:25:10
dorothyw
If I am correct that the first example is the only way to derive then I have done it. Though I am not sure that is the case.
8:25:35
Jachy
If your physics is good you might be able to use SICM (Structure and Interpretation of Classical Mechanics) Example: https://mitpress.mit.edu/sites/default/files/titles/content/sicm_edition_2/chapter001.html#h1-5
8:27:43
no-defun-allowed
i'd frankly make up a *-and-expt "operator" in a program like that to save on some parsing while keeping it short
8:32:46
no-defun-allowed
(setf (fdefinition 'pow) (fdefinition 'expt)) is always possible but probably not useful
8:33:02
dorothyw
jdz: if one presents itself. If one does not exist or I find one my query is terminated.
8:35:00
no-defun-allowed
dorothyw: just port [SICP's differentiator](https://sarabander.github.io/sicp/html/2_002e3.xhtml#g_t2_002e3_002e2) to CL thanks
8:39:32
Jachy
dorothyw: Going back to the original question, is the request for some book/resource that combines teaching calculus from the ground up (e.g. no past familiarity) with Lisp as a backdrop? Or just doing calculus with lisp?