libera/#commonlisp - IRC Chatlog
Search
20:44:30
nij-
A modern webpage is similar to a interactive program hosted in the browser. If it were CL (but not JS) that dominated the web, it'd be possible to launch a slynk server from-within the webpage, and hack it through emacs. CL didn't dominate the web, but I suspect something like this is possible. Is there some script I can run from-within a webpage that effectly enables me to hack the page with CL, sly, and emacs?
20:47:03
Josh_2
If I have a list like '(a b c d) how can I compute every possible combination of those elements?
20:49:40
edgar-rft
in case of doubt there's a "Common Lisp" code example section here -> https://rosettacode.org/wiki/Permutations
20:54:52
Alfr
Josh_2, to get all (that's 2^n) subsets, you can consider the numbers 0 to 2^n-1, every number n corresponds to a selection for elements, e.g. bit i set, choose element i to be part of the n-th set.
20:55:54
nij-
EdLangley[m]: There's js+swank.. and there's parenscirpt. So I guess something like this should work.
20:57:08
mfiano
Josh_2: something like: (let ((list '(a b c d)) (result nil)) (dotimes (i (length list)) (alexandria:map-combinations (lambda (x) (when x (push x result))) list :length i)) result)
20:57:18
_death
the way clog works is by sending arbitrary js via a websocket.. you can generate that js using parenscript
20:57:49
nij-
Josh_2 just to compare the length of code.. (defun comb (list) (let ((l (length list))) (cond ((= l 0) nil) ((= l 1) (list list nil)) (t (append (mapcar (lambda (x) (cons (car list) x)) (comb (cdr list))) (comb (cdr list)))))))
20:59:37
mfiano
Josh_2: Also might want to nreverse the retval, if you want them in increasing order
21:02:18
nij-
EdLangley[m]: I understand that Parentscript can turn on a server that runs its own webpage. Do you know if it can hack a page that's already running?
21:04:18
mfiano
Fixed code: (let ((list '(a b c d)) (result nil)) (dotimes (i (length list)) (alexandria:map-combinations (lambda (x) (push x result)) list :length (1+ i))) (nreverse result))
22:12:05
masinter
(defun comb (x) (if x (let ((y (comb (cdr x)))) (mapc #'(lambda '(z) (push (cons (car x) z) y)) y)
23:04:22
rotateq
lel a friend of mine to who i talked more than one time about CL said "you need some object-oriented language like Java to get a job"
1:42:05
mfiano
Hmm regarding the about combination mapping function, what if I had a list of 3 elements, such as '(0 128 256), and I wanted to find every 4-tuple with repetitions allowed? Can alexandria (or anyone else here) help me?
2:39:15
EdLangley[m]
That way, I don't have to worry about the license of my application's dependencies and my libraries don't impose too much on their users
2:56:57
aeth
I exclusively use the MIT license because all code's reusable library code if you're clever enough.
2:57:40
aeth
My code starts specific and then generalizes until I spin it off. I probably could keep a monorepo instead and skip the last step.
2:57:52
EdLangley[m]
The great thing about not having any contributors is you can just copy it to a library :)
2:58:29
EdLangley[m]
I have a library of utilities I use in all my projects and I just move useful things there
2:58:48
aeth
But then you'd also have to consider e.g. a CLA, and people might not like a CLA that could turn AGPL into MIT
3:00:13
aeth
And I can't really blame them. Promises are kept until you're acquired by one of the 10 tech megacompanies.
3:05:50
aeth
I suppose everyone could assign their copyright to, say, the Common Lisp Foundation or something
3:58:30
ns12
aeth: Dangerous! When an evil beast takes control of the Common Lisp Foundation, they will change the license to a proprietary one! Say goodbye to all the open source Common Lisp libraries!
4:05:16
beach
contrapunctus: define-save-info specifies a list of "save entries", where a save entry is a list of two symbols, an initarg (usually for some slot) and the name of a reader that corresponds to that initarg.
4:05:20
mfiano
I don't mind using copyleft software, but developing with, especially for the purpose of making a living, is out of the question.
4:15:48
lisp123
When connecting to a remote image in SLY on your current machine, I'm experiencing a tiny amount of lag - does anybody else have this?
6:46:56
contrapunctus
beach: thanks for the response. In trying to find out "when or why does client code need to use `define-save-info`?", I tried to run `do-things-1` and got this error - https://paste.rs/MEQ
7:04:31
EdLangley[m]
Josh_2: did you happen to use the OpenAPI spec for cl-matrix? or handwrite the api wrappers?