freenode/#lisp - IRC Chatlog
Search
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?
9:40:37
shka_
razzy: idea was to basicly use vast address space of modern machines to establish access to data on so called persistant storage
9:46:46
razzy
beach: i need flat filesystem on linux. emacs elisp modul, preferably. so i want to ask you, if you ever try to wander flat-filesystem-on-linux way. emacs module would be good place to test ideas in the wild :]
9:54:46
beach
razzy: I am not thinking of Linux much at all, other than as my current tool for most things.
10:00:23
no-defun-allowed
you give it a list of syllables which have length, pitch and phonemes and it puts together samples and adjusts their pitches
10:01:22
no-defun-allowed
i want to add automatic syllable finding (which i think i have an algorithm for) and a better stretching mode
10:01:34
no-defun-allowed
it's in python right now but all the heavy stuff is done by sox and aubiopitch
10:24:28
razzy
if you build it, and you cannot say the difference from original, you can say you understand it
10:25:10
jackdaniel
you have ikea furniture with detailed instruction what goes where, you are able to build the furniture
10:25:25
jackdaniel
if it is complicated enough it is not given, that having same parts but no instruciton you'll be able to build it again
10:25:41
jackdaniel
from atoms? from hardware? from assembly? from programming language? from framework? define scratch
10:28:08
jackdaniel
so "understanding" "something" is a mental state dependent on: object origin and knowledge of the previous person who built it? doesn't make much sense to me
10:28:50
no-defun-allowed
however this rosetta code entry looks like shit and uses lists for the analysed sample which doesn't help
10:53:25
no-defun-allowed
I'd probably use some kind of "step" to avoid more consing with a vector to make fft fast.
11:22:43
no-defun-allowed
*another large quantity of vectors which should have around the same total size as the original.
12:22:19
adlai
no-defun-allowed: if you're talking about the code in https://rosettacode.org/wiki/Fast_Fourier_transform#Common_Lisp ... that is literally "Translation of: Python". they use nth in a loop for O(n^2) performance!
12:57:22
ogamita
So I'm trying to expand cl-lex so that it doesn't scans only prefixes of tokens (yeah, a major bug, but the point is that I'm using a library that is using cl-lex, I have my own lexers that work correctly thank you). So it uses cl-ppcre, and I extend it with a second regexp that should not be matched after the token regexp to validate it.
12:57:22
ogamita
Basically: ("OBJECT" "[-\\w]") should match "OBJECT" in "OBJECT FOO" but not in "OBJECT-FOO BAR".
12:57:22
ogamita
For this, I expand the parse-tree regexp as: (:alternation (:register "OBJECT" (:negative-lookahead (:char-class #\- :word-char-class))) …).
12:59:02
adlai
the only thing worse than "something is wrong on the internet" is... "unidiomatic python is masquerading as common lisp on the internet"
13:00:01
ogamita
(cl-ppcre:scan (cl-ppcre:create-scanner '(:alternation (:register "OBJECT" (:positive-lookahead (:char-class #\- :word-char-class))) (:register (:greedy-repetition 1 nil (:char-class :word-char-class #\-))))) " OBJECT-CLASS foo bar") #| --> 2 ; 8 ; #(2 nil) ; #(8 nil) |#
13:00:18
ogamita
(cl-ppcre:scan (cl-ppcre:create-scanner '(:alternation (:register "OBJECT" (:negative-lookahead (:char-class #\- :word-char-class))) (:register (:greedy-repetition 1 nil (:char-class :word-char-class #\-))))) " OBJECT-CLASS foo bar") #| --> 2 ; 8 ; #(2 nil) ; #(8 nil) |#
13:01:27
adlai
sure... you arrived after the link to the offending code. i am almost loathe to link you to it, out of consideration for your retinae.
13:01:53
ogamita
Note that I'm just asking for an obvious thing here: (:POSITIVE-LOOKAHEAD|:NEGATIVE-LOOKAHEAD|:POSITIVE-LOOKBEHIND|:NEGATIVE-LOOKBEHIND <parse-tree>) should be pretty obvious... (from cl-ppcre documentation).
13:02:32
adlai
and if you are a true glutton for unidiomatic garbage, you can look in the edit history to find the offending sample
13:06:33
jdz
ogamita: cl-ppcre has some restrictions on lookahead/lookbehind. I seem to remember at least something about being constant size.
13:08:49
ogamita
But from the doc of the var *look-ahead-for-suffix* I would infer that the meaning of looking ahead or behind for ppcre is not what was obvious to me…
13:12:12
ogamita
Well, nope. Perl PCRE documents it as I understood it. cl-ppcre doesn't seem to work.
13:38:43
pfdietz
I have occasionally used the plists of symbols, but in many cases it's just better to use a structure or standard object instead of a symbol and store the data there.
13:39:33
ogamita
jcowan: (let ((c 0) (p 0) (ss '())) (dolist (s (dolist (p (list-all-packages) (remove-duplicates ss)) (do-symbols (s p) (push s ss)))) (incf c) (when (symbol-plist s) (incf p))) (values c p (float (/ p c)))) #| --> 69919 ; 800 ; 0.011441811 |#
13:40:41
Bike
but even when i do want a new global mapping from symbols to values i like to just use a hash table or something
13:41:04
ogamita
1- symbols cannot really be considered a global resource, since we have packages. 2- using symbol property lists even on global symbols (eg. keywords or library packages) doesn't generally lead to collision since you can use as keys symbols in your own package!
13:42:03
jcowan
Yes, symbol-plists look optimized for the case of fairly few properties for each symbol
13:42:49
ogamita
jcowan: I would say that the main change in programming style is the use of functional abstraction all the time.
13:43:30
ogamita
So the use of symbol-plist is not apparent in public interfaces, and you can implement them as you wish.
13:44:16
ogamita
Bike: this is not the question. The point is that you can do (setf (getf 'cl:sin 'com.informatimago.i.own.this.there.is.no.collision.risk.ever) 'dont)
13:44:48
ogamita
I mean: (setf (getf 'cl:sin 'com.informatimago.i.own.this.there.is.no.collision.risk.ever:will-you) 'dont)
13:45:24
shka_
saying that packages are global is currently good enough approximation of the current status imho ;-)
13:46:21
jcowan
Well, they are global in the same sense that DNS names are global: literally true, but that doesn't constrain anyone from creating unique ones
13:46:32
ogamita
Well, you could use a custom package implementation such as com.informatimago.common-lisp.lisp-reader.package and store your symbols in those structures instead of cl packages; this would give you "anonymous" packages :-)
13:47:21
ogamita
Also it may be clearer and easier to user clos objects with slots rather than symbols with plists.
13:47:40
ogamita
jcowan: that is, we have a number of modern techniques that seem to be often better than plists.
13:48:32
jcowan
I have been thinking about writing a Scheme library that implements packages pretty much as in CL, but as purely runtime constructs (which is what Scheme symbols are).
13:48:44
ogamita
The uniqueness can be enforced legally on the basis of DNS. Can depend on the jurisdiction, but some accept it.
13:49:54
ogamita
Bike: scheme doesn't have a compilation environment or a readtable that would allow you to use such packages at compilation time.
13:50:03
jcowan
In Scheme, all variables are lexical, so there is no way (short of eval) to obtain the value of a variable from the symbol that names it.
13:51:28
jcowan
But it has no runtime consequences, so symbols in Scheme exist purely as unique objects with one property, the name.
13:52:51
jcowan
There are also runtime environments for the use of eval, but they are not really first-class yet
13:53:47
jcowan
(ogamita: it's more than just legalities, you cannot set up foo.mit.edu because the mit.edu DNS servers won't know about it.)
13:54:28
ogamita
jcowan: I mean that if somebody uses your domain name outside the DNS, you have a good legal case against them.
13:54:52
pfdietz
CL has smashed together a number of different behaviors in its symbols. A lot of that is just tradition.
13:55:09
ogamita
And actually, vice-versa. If you try to register a domain name from the name of an existing company or person that you're not entitled to legally, you may have problems keeping this domain name.
13:55:29
jcowan
If I do make these packages for Scheme, the symbols won't have value/function cells, of course
13:56:26
ogamita
jcowan: this is the classic greenspunning. When you're not using Lisp, you're implementing lisp.
13:56:34
jcowan
However, there is no point in a value cell because changing it can't affect the behavior of existing code (that doesn't call symbol-value, obvs)
13:57:27
ogamita
jcowan: perhaps it would be more productive to implement an application useful to users in Common Lisp, rather than implementing another half-assed lisp in scheme…?
13:57:44
beach
I guess I should figure out what to use symbol plists for in SICL, since I have first-class global environments and the plist is not contained in the symbol.
13:58:07
jcowan
Yes, well, I am the chair of the Scheme revision committee: writing CL packages is not in my remit.
14:00:07
ogamita
jcowan: I would bet symbol plists are more used in unpublished (prototypal) lisp code than in published libraries :-)
14:00:54
ogamita
jcowan: what's nice with lisp is that you have a lot of data structures and abstractiosn that you can quickly use at the repl to have fun (exploration programming), but that you would rewrite otherwise, more cleanly, for release.
14:01:29
adlai
is there a "hate on my code" version of the #RoastMe meme for CL? https://rosettacode.org/wiki/Fast_Fourier_transform#Common_Lisp
14:01:52
jcowan
My work is basically to add things carefully and systematically to Scheme with regard to utility
14:02:50
Bike
i don't think scheme needs packages. modules are probably a nicer way to go about things, though anything be compile time only is eh
14:03:08
jcowan
e.g. sets, immutable (not persistent) lists, deques, generators, boxes, ephemerons, etc.
14:04:32
jcowan
Bike: Scheme macros are already compile-time only (where I am using "compile-time" in the CL sense, not necessarily implying a compiler)
14:06:16
adlai
dlowe: yes yes... my annealing settled on (make-list 2 :initial-element (fft as)) (make-list 2 :initial-element (loop ...)) and that got rid of the let*
14:06:46
adlai
but i decided that (make-list 2 :initial-element ..) is a cardinal sin, and must not be ever used for any reason whatsoever
14:06:48
dlowe
(append (mapcar '+ a aux) (mapcar '- a aux)) seems sufficiently short and understandable not to be replaced
14:08:19
adlai
ACTION leaves the golf bit... people looking for CL code deserve to have their expectations stretched a little
14:09:47
adlai
another little funecdote: before switching from EXP to CIS, there was a (* #C(0 -2) pi)
14:11:48
jcowan
As part of this effort, I read the package chapter of the Chine Nual, and Zetalisp's package system was rather different, with single rather than multiple inheritance,
14:12:10
jcowan
the ability to say "foo:bar:baz" (symbol baz in package bar subsidary to top-level package foo)
14:13:10
Bike
eh? really? we're all extending things with package local nicknames and shit and it was in the chinual? golly.
14:14:10
jcowan
some unavoidable (the Chine Nual describes an implementation, the CLHS prescribes a standard)
14:14:41
adlai
dlowe: ty! ... but it's good to know that the complex toolkit is comprehensive enough to make tricks like that unnecessary
14:15:08
jcowan
of course hierarchy wouldn't mean that use-package couldn't exist (although in fact it didn't until Zetalisp imported a lot of CL stuff in its last stage)
14:21:20
adlai
ACTION wonders why https://rosettacode.org/wiki/Quaternion_type#Common_Lisp was done with a class rather than a 2-element array of complexes
14:24:22
adlai
quaternion operations can be expressed concisely as operations on an ordered pair of complex numbers (aka "cayley-dickson construction")
14:25:57
adlai
ACTION liked John Baez's explanation of this: http://math.ucr.edu/home/baez//week59.html
14:27:06
dlowe
That seems unambiguously better if you can use complexes because then you benefit from the compiler-level complex number optimizations
14:27:38
adlai
ACTION reminds himself to revisit his list of complaints about the CL type system once he has completed another year of school
14:28:44
adlai
the advantage of a struct (or class) is obvious in the later part of that example, with the method dispatch
14:29:35
shka_
my assumption is that no implementation in such case would actually require extra memory allocated
14:32:11
shka_
i am just trying to figure out if there is any way to avoid actually making copy of potentially huge byte
14:32:29
adlai
dlowe: i'd say that it keeps people out of worse trouble, but in here, complaining about CL is the worst kind of trouble :)
15:29:10
Bike
it would be nice if you could convert bit arrays to integers and back without consing, though
15:36:34
beach
That doesn't sound the same as "convert bit arrays to integers and back without consing".
17:25:58
rk[ghost]
typically, i have a wrapper script that creates a named gnuscreen, calls the interpreter, loads the program and then detaches
17:27:00
rk[ghost]
however, i want to be able to attach to the interpreter to make tweaks to the running program
17:36:45
pjb
rk[ghost]: using a private irc server and irc clients to connect to your program may be a nice way to do it.
17:37:17
pjb
rk[ghost]: however, if you prefer a directly connected REPL, you can either use slime/swank, or add a telnet server (or ssh server) in your CL programs.
17:38:16
pjb
rk[ghost]: you can also provide a REPL directly on a socket, but telnet or irc provide better terminal interfaces.
17:38:35
rk[ghost]
pjb: well, for one project, i just made an IRC bot that directly connects to a REPL
17:39:43
rk[ghost]
pjb: my private irc server / client is running onthe same box as the hunchentoot server ;P
17:40:38
rk[ghost]
so, i will think on these little thoguhts for now and be back after i poke around i nthe evening.
17:42:19
rk[ghost]
at this point, lisp has a robust set of libraries, an active and helpful community, and runs on just about any device
17:42:37
rk[ghost]
and it has this funny advantage that 7 year old programs are still working just fine and dandy
17:44:13
rk[ghost]
it is a laptop, but it is armv7.. so it (for most purposes) acts like a mobile-OSy device
17:44:55
rk[ghost]
the difference with my telnet-like program i made for Erlang was, i used public/private keys
17:47:36
rk[ghost]
however, for that project i decided to give in to learn more about public/private keys and such and such
17:47:52
rk[ghost]
i have a feeling, i could probably wrap your telnet script with my erlang script in some way
17:48:57
rk[ghost]
@security options, is there already a robust library (CL) for public/private keys and md5s and such?
17:57:15
rk[ghost]
(i like and run gentoo, but never spent much time to understand openrc beyond running the commands to add an init script to the boot order)
17:57:59
rk[ghost]
just trying to get armcl programs wrapped up as servers that are spawn / managed by openrc with terminal connectivity available and good logging
18:03:18
LdBeth
But what people supposed to do is write OpenRC scripts in init.d, so one can rc-service stop/start/restart them
18:04:35
pjb
rk[ghost]: usually the boot scripts will source rc.local at the end of the boot process, to let you start local daemons.
18:05:03
pjb
rk[ghost]: of course, nowadays you have stuff like systemd and launchd, but nothing beats the simplicity and resilience of the simple rc.local script.