freenode/#lisp - IRC Chatlog
Search
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.
18:11:50
rk[ghost]
but for the raspberry-pi server i have.. i was smart and installed Gentoo / openrc
18:17:05
jasom
pjb: OpenRC is classic RC with a few new features; it also consists of a wrapper for the shell scripts (openrc-run) to simplify things a bit (e.g. no need to source a bunch of libraries in your init scripts)
18:18:59
rk[ghost]
LdBeth: ah, that is the path i was attempting the other day. creating my script in init.d
18:19:14
rk[ghost]
anyhoot, i realize i need to rework how my program works as it wasn't designed to be daemonized
18:19:32
rk[ghost]
i mean, i sually run the screen wrapper script to boot the program, which loads everything up
18:25:31
rk[ghost]
hmm, now i am curious. waht would be advantage of adding telnet server (or ssh prgram to CL program) vs. sshing to box and connecting to screen?
18:26:06
jasom
rk[ghost]: I think screen/tmux/dtach are all better than adding a server since you get scrollback and other features already.
18:26:45
rk[ghost]
i wrote a couple cool wrapper scripts around tmux and screen to make something fun
18:27:01
jasom
though I also strongly suggest having a logfile; there's a couple of decent logging libraries for lisp that will do things like log rotation for you.
18:27:37
rk[ghost]
i once came across logstach? too. which was interesting as iirc it does like a ETL for log files
18:27:51
rk[ghost]
to create master log files for cross comparison and reformats them all so that they match
18:28:42
jasom
log4cl is easy to get setup with, but after using it I find it to be a bit janky on the implementation side; IIRC Shinmera has a logging library that I've been meaning to look into, but I haven't written a daemon since making that decision
18:28:59
jasom
rk[ghost]: if you're going to have a REPL via screen then not really a need for daemonize
18:29:22
rk[ghost]
is there also an error handling library people tend to use.. or is it just all custom jazz?
18:29:23
jasom
rk[ghost]: though I do recommend writing out a PID file if you are using OpenRC; it makes it a lot happier.
18:29:42
rk[ghost]
i realized that daemonizing probably isn't want i want as it contradicts screenifying
18:29:54
rk[ghost]
however, i need to set up something such taht there are init script that properly start my stuffs
18:29:57
jasom
if you want to do things like log backtraces on unexpected conditions, dissect is good
18:30:26
jasom
rk[ghost]: screen has a command line option to start in the background, that will be helpful
18:31:38
jasom
rk[ghost]: I've done the send-keys trick before, but I recommend instead having a shell script that starts everything, and telling screen to run that from the command-line
18:31:40
rk[ghost]
@writing out a pidfile.. err i understand this on the surface. but when i think about going about that, my mind becomes murky
18:33:24
jasom
rk[ghost]: if you're using sbcl: (with-open-file (pidfile "/path/to/pidfile" :direction :output :if-exists :supersede)(format pidfile "~A~%"(sb-posix:getpid)))
18:34:04
jasom
if not sbcl, figure out how to get the pid (a CFFI wrapper for getpid is relatively easy to write on the chance your implementation doesn't provide it).
18:35:41
rk[ghost]
gee, now i feel bad as ya'll are too helpful and i am being lazy here just asking questiosn and not programming
18:36:04
jasom
some unix system calls are very hard to wrap, getpid is very easy to wrap, so most lisps have it somewhere internal, if not exported.
18:36:09
rk[ghost]
anyhoot, very cool. this all gives me some things to play with. i think i may try multiple ones just to know for myself which seems to work more
18:36:28
rk[ghost]
but learning to pidify/openrcify and log my programs correctly all seem worthwhile in the end
18:37:29
rk[ghost]
got lisp program running in the interpreter, which was spawned from a sh wrapped in rlwrap
18:37:53
jasom
cool; ironically enough, even though I run gentoo I use daemontools for running my lisp daemons, because all you need to do for that is provide a script to run, and it will run it as a given user and log stdout/stderr to rotating timestamped logs for you. It will *not* work well with the screen trick though because it assumes a single pid for the daemon.
18:38:24
jasom
I either don't provide a repl, or run a swank daemon on a unix socket for getting interactivity.
18:39:10
jasom
does swank exist for armcl? You could ssh forward a port to connect remotely if it does.
18:43:03
rk[ghost]
i see if i am to move forward with lisping, i thnk it may finally be time to install emacs/evil + swank, eh?
18:49:57
jasom
rk[ghost]: I recommend it. Even if you only use swank as a REPL it's worth it (I used vim for editing lisp code and slime for REPL/debugging for years before moving to emacs/evil).
18:52:17
rk[ghost]
(first use was in college. it was some old xemacs and no one taught me how to configure it)
18:52:48
rk[ghost]
then someone showed me 'vi' and i instantly was hooked thinking all program should work like that
18:53:07
rk[ghost]
and to this day, i have vi-like input on my terminals, in my irc client. i use pentadactyl in the browser, ect.
18:53:27
rk[ghost]
imo, there is 100 keys on my keyboard. so if i do less than 100 tasks, i should never press more than a single button at a time to do anything
18:59:31
jasom
rk[ghost]: I have a few customizations to evil for ding lispy things; I'll see if I can dig them up and paste them. A big one is getting M-. (slime's jump to definition shortcut) to work in normal mode since I don't use the corresponding vim key combination ever.
19:03:41
russellw
I'm trying to do this: (loop for (a . more) on s with b = (car more) ...) but it's not working; b is always nil. What am I doing wrong?
19:10:25
russellw
But not strictly? I did use 'with' in another loop for something that would be every time around the loop, and it worked
19:11:44
|3b|
shouldn't work, unless it triggers UNTIL on first iteration or has some other termination clause
19:13:15
russellw
... oh wait. That section of code is the section that just handles block comments, and I haven't tested those yet. So I guess you're probably right and it actually doesn't work, I just don't know it yet
19:59:39
jcowan
I have in fact been thinking about integers-as-bits vs. bitvectors-as-bits. There is a substantial library of integers-as-bits functions, similar to CL's but more extensive.
20:00:37
jcowan
I am trying to decide whether I should propose a bitvector function for every integer function (indeed two, one non-destructive and one destructive),