freenode/#lisp - IRC Chatlog
Search
15:38:27
ecraven
thanks for pointing out cl-yesql, this finally seems like a sane approach to "sql as a dsl"
15:57:04
engblom
When building up a plist, is it ok to first push value and then push key? Or could I push both at the same time?
16:00:17
engblom
nij: It will be something like (:key1 :value1 :key2 :value2 :key3 :value3 ...) and I will begin with an empty list, and then adding one pair at the time
16:00:49
beach
engblom: You can push the value and then the key, provided you don't use the list between the two operations.
16:01:34
engblom
beach: Thanks, then I will do so. I am just asking if it is OK, as I am still very new to lisp and somtimes there are better ways to do things that what I know about.
16:03:16
nij
There are many ways. At the end just make sure you get something you want. Then it's ok.
16:03:45
nij
But I've heard someone saying it's better to only use plist operations.. aka we should live on top of the abstraction..
16:04:35
nij
minion, tell theothornhill that I've read the log and am glad to know if there's any news back from the people you mail.
16:04:42
vms14
pjb: recommended me to use defstruct over plist, I've just obeyed without no reasoning about
16:06:06
vms14
;; Those structures will go on the lists ;; pjb recommended me to use defstruct ;; instead of property values of symbols ;; 2020-04-13
16:06:13
engblom
beach: I tested it. I did not know you can use (setf (getf plist :key) "foo") when :key do not exist yet, but it does what I want
16:08:21
nij
I remember there's a CL system that allows you to get access to a specific place of a highly nested object easily.. is it called accessor?
16:09:31
nij
minion: memo for theothornhill: I've read the log and am glad to know if there's any news back from the people you mail.
16:12:51
nij
ebrasca: if it's enough stumpwm-like, you should be able to add a config file for it to read at startup
16:14:40
nij
ebrasca: here's a config example for stumpwm that I learned a lot from. Its starting point is init.lisp : https://github.com/alezost/stumpwm-config/blob/master/init.lisp
16:33:31
engblom
Is there something as simple as (dotimes (i 4) ... ), but allowing you to specify the starting point?
16:34:19
Bike
there is not a standard macro like dotimes that lets you specify a starting point. you can use addition or loop though.
16:35:37
nij
http://www.gigamonkeys.com/book/loop-for-black-belts.html engblom search "from" in this page
16:38:23
Bike
you shouldn't modify an iteration variable. also, even if it did work, it might only loop twice - i = 0, then i = 3, then i = 5 so it quits
16:39:36
nij
However, this works: (dotimes (i 6) (let (( i (+ i 3) )) (format t "~a" i))) ;; => 345678
16:43:01
nij
Suppose I'm to hack minion as a toy, for a random user to let it evaluate random codes.. what's a good strategy to blacklist malicious codes?
16:45:37
pjb
engblom: you can use list* to push both at the same time: (list* :new-key 'new-val plist)
16:45:38
_death
whitelist is a better solution.. so you can have a package where only allowed symbols are present
16:48:16
pjb
vms14: there are always exceptions and circumstances. If the set of fields is fixed, it may be better to use structures than plists. If the set of keys is variable and you want to accept keys not known at compilation-time, then plists are better.
16:49:39
pjb
nij: tiling let's you prevent a certain class of cockpit error: the case where something is displayed in a window, but you cannot see it because that window is hidden behind another window.
16:50:01
pjb
nij: therefore tiling is important on control panel applications where you want to be sure that the information is visible to the operator.
16:51:48
semz
Is there a way to get access to an internal function (generally but in CCL is fine too) as an object? DISASSEMBLE will only give me the outer function's code and pulling it out would be rather annoying.
16:52:00
pjb
nij: it's simply not specified how and when the loop variables are bound. Even (let ((fs '())) (dotimes (i 6) (push (lambda () i) fs)) (mapcar (function funcall) fs)) is not conforming. So mutating the variable i is even conforming.
16:55:12
pjb
Instead, you can write either: (let ((fs '())) (let (k) (dotimes (i 6) (setf k i) (push (lambda () k) fs)) (mapcar (function funcall) fs))) #| --> (5 5 5 5 5 5) |#
16:55:12
pjb
or: (let ((fs '())) (dotimes (i 6) (let ((k i)) (push (lambda () k) fs))) (mapcar (function funcall) fs)) #| --> (5 4 3 2 1 0) |#
16:56:52
pjb
and of course, if you want to modify your loop variable: (loop with i = 0 while (< i 10) collect i do (incf i (1+ (random 3)))) #| --> (0 3 5 6 8) |#
17:25:18
theothornhill
beach: So Kent Pitman came back to me, with an enthusiastic reply. Nice! He says that the dpANS is the way to go, and a suit is unlikely. He'd _not_ recommend making a CLHS 2.0, and would rather focus on creating a "WikiSpec" starting from the dpANS, allowing the spec to be alive, without requiring to go through a committee for every typo, not to mention real bigger changes
17:25:19
minion
theothornhill, memo from nij: I've read the log and am glad to know if there's any news back from the people you mail.
17:27:15
theothornhill
nij: I think this sounds smart. We could then start by displaying the spec as it is, then work incrementally on creating a live, documented and annotated spec that caters to more modern needs
17:30:18
theothornhill
(If we allow a feature to disable every annotation we'd avoid the need to go through some uncoordinated committee, since the real, trusted spec is only one click away)
17:31:42
theothornhill
His reply is way too long to post here, so I'll ask him if I could publish some or all of it for posterity.
17:35:45
theothornhill
phoe: I say we try. I'll start work on htmlizing the spec this evening. I also have done some initial work on making the transition from dpANS to something else reproducible, so we don't have to worry about keeping things verbatim, which would be super important as a first step should this work
17:47:43
phoe
tvraman is not capable of seeing, so he wanted a way to translate TeX papers into audio
17:48:05
phoe
and he did that by parsing TeX into Lisp and then serializing Lisp objects into commands sent to a TTS device
17:48:43
phoe
it seems that this code mostly loads and works even on modern lisp implementations, though it needs to get some overall polishing
17:51:54
theothornhill
Pitman also told me to be sure to organize such an effort with other people, to make sure we don't double the work, considering it's a small community
18:47:09
engblom
I did my first try with a macro, but failed: I tried to put both the macro and some kind of explanation of what I want here: https://pastebin.com/snBdwRdE
18:49:22
phoe
engblom: second thing, what do you want the resulting, macroexpanded code to look like?
18:49:25
flip214
second, there are some things missing... some declarations (what is set-on-change?), and the problem you have.
18:50:44
engblom
There is no applicable method for the generic function #<STANDARD-GENERIC-FUNCTION CLOG:VALUE (3)>
18:51:34
engblom
(set-on-change ...) is a function from clog library and service-type is a clog object
18:52:12
engblom
https://rabbibotton.github.io/clog/clog-manual.html#x-28CLOG-3ASET-ON-CHANGE-20GENERIC-FUNCTION-29
18:55:48
_death
engblom: I suggest to replace "defmacro" with "defun" and try to get (custom-set 'set-service-parameters 'p) to result in the form you want
18:58:29
_death
oh, I missed the problem description.. the issue you may have is one discussed today in this channel..
19:00:46
_death
where a binding is changed in a loop.. perhaps an expansion like (let ((p-var p)) (lambda (obj) (declare (ignore obj)) (set-service-parameters p-var))) will work (note that I use "p-var" but in your macro you should generate a symbol each time, say using GENSYM)
19:01:11
engblom
_death: So I have a loop that creates a lot of clog objects, and each clog object needs its own function that should be run when they are changed. In this case the only difference that should be in the function is the argument to set-service-parameters. The p binding is changed in the loop, so I tried to use a macro to generate the function.
19:03:09
_death
well, you can just use a function to generate the function.. you'll pass #'set-service-parameters to it instead
19:04:22
engblom
_death: I do not understand how. The problem is that the clog obj will always be passed to whatever I give (set-on-change ...)
19:08:38
_death
you need a function that takes f and x, and returns a function that takes an obj (and ignores it) and calls f with x
19:19:09
_death
so now you can change the name to a more general name, say ALWAYS and have it take &rest parameters instead of just (f x) or (obj).. or you could call it say ALWAYS-FN and have an ALWAYS macro that expands to `(always-fn (function ,function-name) ,@args)
19:20:18
_death
so that you can write (always (set-service-parameters p)) ;; inner parentheses are stylistic
19:23:26
kiwichap
so like there's certain parts involved like authentication, session, different users
19:25:42
theothornhill
kiwichap: lisp can do that for sure. I guess it depends on what you'd be interested in focusing on. If just getting that app up and running, I'm sure some python, ruby og js frameworks will be quicker
19:26:34
kiwichap
I never did any of them and haven't done all the much programming but I somehow got a degree in it if that makes sense
19:26:55
Xach
Yeah, there are other environments where tasks like that are a matter of filling in some blanks. Common Lisp isn't one of them, mostly.
19:28:06
kiwichap
I did a little bit of Java in school , so much complications there, then I did some php on my own, I did my first cgi scripts and a hello world or 2 in lisp
19:28:29
Shinmera
here's a start then: https://github.com/Shirakumo/radiance-tutorial/blob/master/Part%200.md
19:55:29
rumbler31
phoe: I'm looking at running your ansi-tests branch of ccl. I'd like to reproduce your results. How did you go about building that branch?
19:57:08
phoe
I will be able to help you build that on Thursday or later - right now I'm 100% in ELS-local-chairing mindset
20:03:23
rumbler31
yea I bet. I'm disappointed because I was looking forward to watching it live, but this is the week I have to go into the office and I won't be able to watch
20:14:46
_death
I asked because I never looked at abcl.. but I just cloned it and cloc gives about 60kloc in each language
21:09:19
LispSporks
Probably means where it saved it and where you tried to rename it too, are on different filesystems. Try a file copy instead.
22:14:38
|3b|
ACTION wonders if slime's receive-if (on sbcl) should bind *break-on-signals* to NIL, since it seems to get confused if condition-wait SIGNALs a deadline, causing it to try to run a debugger-loop inside the with-mutex, which does receive-if, which gets recursive lock error in with-mutex, which runs debugger, etc
22:15:32
|3b|
or if there is some better way to handle things, or if that isn't what's happening in the first place
22:39:30
|3b|
or alternately, if force-output on slime-output-stream shouldn't use deadlines in the first place
22:43:45
|3b|
(let ((*break-on-signals* t)) (loop repeat 10000 do (format t "~c" (code-char (random 1000000))) (force-output))) seems to reproduce it reliably (random characters so emacs has to go digging for fonts slowing it down enough to trigger the 0.1 sec deadline)
22:46:31
mister_m
is there a way to check for the presence of a value of a slot in an object without tripping an UNBOUND-SLOT condition? I was using (slot-value ...) when I ran into this, thinking I could test with (null ...)
0:26:20
mister_m
using slime, is there a way to recompile a function in a manner like C-c C-c, but with `(declare (optimize debug))`? I can add that to the function and recompile as normal, but I am wondering if slime can do this for me.
0:27:26
no-defun-allowed
See the documentation (i.e. when in a Lisp buffer, type C-h k C-c C-c): "With (positive) prefix argument the form is compiled with maximal debug settings (āC-uā). With negative prefix argument it is compiled for speed (āM--ā)."
1:38:12
nij
minion: memo for theothornhill: I've read the log again.. and I melted. Thanks so much :-D Let me know if I can help any.. (beware i'm just a noob)!
1:38:36
nij
minion: memo for beach: Good news from theothornhill! Seems like UltraSpec is going to come back alive :-D
3:04:19
minion
beach, memo from nij: Good news from theothornhill! Seems like UltraSpec is going to come back alive :-D