freenode/#lisp - IRC Chatlog
Search
11:29:08
jackdaniel
Godel[m]: I think you'll get more lucky by pasting question on roswell repository
11:31:09
Godel[m]
jackdaniel: I think I solved it. But now I'm having trouble with `~/.sbclrc` which doesn't load on startup anymore (once I installed quicklisp and sbcl via roswell).
11:32:43
flip214
How would I access an Oracle DB from sbcl? I know about PostModern etc., but the best choice for Oracle is CL-DBI? does CLSQL work?
11:33:47
no-defun-allowed
If it uses the SQL wire protocol (which IIRC is a standardised thing), probably.
11:33:51
jackdaniel
Godel[m]: I've tried roswell and I had a lot of problems like that (so the experiment lead to software rejection)
11:35:00
no-defun-allowed
I tried to work on refactoring some code in Roswell and it was very nasty. Maybe that is just how "contrib" code goes being a lower priority, but it doesn't make me think too nicely of Roswell as a whole.
11:35:49
no-defun-allowed
And I basically spend all my CL work time in git or SLIME so I don't see why I want a Unix-y interface to CL system management either.
11:35:52
flip214
no-defun-allowed: what is an "SQL wire protocol"? every database has it's own (binary) protocol. I don't know about something like TELNET for SQL.
11:36:19
no-defun-allowed
Oh, maybe it isn't a standardised thing. I assumed every database used the same protocol.
11:37:27
no-defun-allowed
In the output of (ql:system-apropos "oracle") I see "dbd-oracle" and "hu.dwim.rdbms.oracle" which look promising though.
11:40:58
aeth
I like the concept of Roswell, but the implementation is a very buggy C program that's hard to upgrade. Someone should make a similar tool that assumes that the host already has a Common Lisp installed, just not literally every Common Lisp ever. That would greatly simplify things imo.
11:43:08
aeth
no-defun-allowed: The point of Roswell, at least to me, is so you can test with CLs that are either newer than your Linux distro offers or that your Linux distro doesn't offer.
11:45:32
aeth
Last time I tried Roswell for testing literally everything, it works for me for everything except for MKCL (not provided... but apparently it's provided now) and clasp (takes forever to compile and then fails for me... they really need a clasp-bin)
11:46:26
no-defun-allowed
Now I don't remember which file I thought I could clean up. Happens every time.
11:47:07
aeth
The main downside to Roswell seems to be that I have to close my current emacs+slime and launch emacs specially through "ros use foo && ros emacs &" in the terminal. And then I have to put "ros use sbcl-bin &&" in front of every other command because ros will remember and use foo for everything, and might have issues with using foo over SBCL.
11:48:24
jackdaniel
another problem is that you couldn't plug it with your own builds of desired software
11:49:24
aeth
it seems to detect my ~/quicklisp/local-projects. Do you mean your own builds of the implementations?
11:50:39
aeth
I guess it also means you probably can only use the trial versions of allegro and lispworks there.
11:52:26
no-defun-allowed
Oh, here is the file that spooked me: https://github.com/roswell/roswell/blob/master/lisp/extend-quicklisp.lisp
11:54:32
no-defun-allowed
Most of the read-from-string madness could be fixed with a #+asdf, unless it's uncertain if it'll get loaded before or after ASDF and Quicklisp maybe.
11:57:22
no-defun-allowed
But again, I don't run a pragmatic get-work-done-now ~1000 star project for making Lisp more digestible for a shitstain of an OS, I am just an armchar critic. I'll stop whinging now.
12:41:11
no-defun-allowed
But I can't tell if all this is intentional because we don't know if it will be loaded before Quicklisp and/or ASDF (in which case: what is the purpose of loading it?) or if it is just because the author did not consider it (which would hopefully lead to someone pointing out it could be cleaned up, or someone complaining at least)
12:43:46
no-defun-allowed
And now this problem will ponder my dreams if I'm not lucky. Eh well, night.
13:04:17
jmercouris
any reason not to use subseq to trim a list down from '(0 1 2 3 4) to '(0 1 2 3)?
13:04:35
jmercouris
I have this feeling in the back of my head that there is some other function I am not thinking of
13:07:02
lieven
of course, the usual wisdom applies that if the list becomes big or this is a common operation, a list might not be the best datastructure for the job
13:12:38
jmercouris
I do however have another problem I am trying to think of, I want to avoid writing a conditional here
13:52:00
shka__
is there anything like INTEGER-LENGTH but for finding the first position of the least significant 1 bit?
15:14:05
pfdietz
The LOG... functions in CL are effectively "infinite" 2's complement, so that trick works.
15:38:08
pjb
Always use the most generic operators, so that your functions are generic functions that can be applied on more types. So when you change your data structures, you don't have to rewrite all your program!
15:38:49
pjb
(defun foo (x) (subseq x 0 (1- (length x)))) (mapcar 'foo '( (1 2 3) #(1 2 3) "123")) #| --> ((1 2) #(1 2) "12") |#
15:39:18
pjb
(defun foo (x) (butlast x 1)) (mapcar 'foo '( (1 2 3) #(1 2 3) "123")) #| ERROR: The value #(1 2 3) is not of the expected type list. |# DUH!
16:12:36
flip214
I'm using CL-STORE and override SERIALIZABLE-SLOTS to not include an open stream in a class' instances. Upon restoring I don't get the :INITFORM NIL, but an unbound slot.
16:13:18
flip214
I'm fairly sure that did give back the :INITFORM a few years back; does someone know about an intentional change in CL-STORE?
16:27:22
flip214
well, (CL-STORE:RESTORE ...) should use the initform for unbound (ie. not serialized) slots
16:31:10
Bike
according to the blame the default backend has not had different behavior for standard objects in the last twelve years, and it doesn't look like it does anything with initforms
16:33:34
Bike
general initforms are forms that may refer to a lexical environment, so they aren't really serializable
20:03:15
pfdietz
If you want a slot to have a default value even if not initialized, I suggest writing a method for slot-unbound.
20:03:46
pfdietz
I use that for slots that implement caches. When unbound, do the expensive computation, then cache the value in the slot.
20:58:32
jackdaniel
pfdietz: I've once heard you saying doing that and I've used this technique a few times since
21:30:32
Xach
I do that quite a bit and sometimes I forget how a slot is initialized. I should start writing describe-object methods that mention how a particular slot is populated.
21:39:44
anlsh
When I do (safe-square (incf *a*)), I expect it to return the (once-only (x) `(* ,x ,x)), and once-only returns '(+ 3 4) no matter what, so I expect (safe-square (incf *a*)) => (+ 3 4)
21:39:56
no-defun-allowed
If you're looking to bind x, then you need to create a let form around the body.
21:41:39
no-defun-allowed
Remember that macros function just like normal functions and are subject to normal evaluation rules, they just happen to output code and have slightly different lambda lists.
21:43:56
anlsh
See here's where I'm confused: lisp functions always return the result of evaluating their last form, correct? (aside from some when some special operators are used)
21:46:14
anlsh
so when evaluating the once-only, the result is `(+ 3 4), so I guess I'm wondering why that isn't just passed up
21:53:08
no-defun-allowed
Well yes, `(+ 3 4) is evaluated in the macro body to yield (+ 3 4), which is then evaluated by the code containing the macro call.
21:58:15
anlsh
I see, I guess not evaluating a macro post-expansions would just make their return values useless haha
22:00:14
anlsh
So am I correct that, aside from a few things like destructuring parameters lists and &body, the forms (labels ((op-name <some-definition>)) (eval (op-name args))) are (macrolet ((op-name <some-definition>)) (op-name args)) are pretty much equivalent?
22:01:14
no-defun-allowed
I'm not sure, macros can get some insight on the environment they're evaluated in. Also, the compiler can optimise macros better.
22:01:43
anlsh
I mean I guess that macros can do critical stuff like control evaluation order which you can't do with the function definition, but the point being the extra eval when written as function call
22:02:15
pjb
anlsh: For example: (defun foo (x) (return-from foo (+ 42 x)) 33) The last form is 33. But the result is the result of evaluating (+ 42 x).
22:06:12
pjb
anlsh: (+ 3 7) is never evaluated. The result of `(+ 3 4), which is (+ 3 4) is evaluated at run-time, after the macroexpansions have been done.
22:07:07
pjb
Now, in (defmacro once-only ((&rest names) &body body) `(+ 3 4)) (defmacro safe-square (x) (once-only (x) `(* ,x ,x)))
22:07:40
pjb
(once-only (x) `(* ,x ,x)) is expanded when the safe-square macro is compiled, and the returned expansion (+ 3 4) is evaluated when the safe-square macro itself is expanded.
22:08:41
pjb
(macroexpand '(once-only (x) `(* ,x ,x))) #| --> (+ 3 4) ; t |# (macroexpand '(safe-square (incf *x*))) #| --> 7 ; t |#
22:09:23
pjb
after the macroexpansion of the call to once-only, it's like if (defmacro safe-square (x) (+ 3 4)) had been written.
22:09:50
pjb
When expanding (safe-square (incf *x*)), (+ 3 4) is evaluated returning 7, and this is the expansion returned by safe-square.
22:10:56
anlsh
I see, realizing macroexpansion consists of both an expansion step and an evaluation step clears things up a lot
22:12:13
pjb
But the resulting expansion that is returned by the macro function is not evaluated AT ALL!
22:13:42
pjb
python476: not currently. Coarsely, I've seen job offers about once every 4 or 5 years, not more.
22:14:35
pjb
python476: the best is to start your own company, and use lisp to develop solutions for your customers, like dim does with his sql tools.
22:16:10
python476
maybe later, when I have a stable situation I'll do [common]lisp project in-house
22:17:06
pjb
For example, when I have to write code in C, I write it in CL first, debug it, and when it's good, I translate it to C.
22:17:43
pjb
Or since I use emacs, I may write emacs lisp code to help me produce the code in the programming languages I need to use.
22:18:46
python476
I sense that this dynamic prototyping for near optimal solution to optimized rewrite is becoming a skill to spread
22:18:47
pjb
python476: I recently improved my LINC translator: https://github.com/informatimago/lisp/tree/master/languages/linc which let me generate C code from sexps.
22:19:06
python476
read a few articles about people ditching straight c++ for python or else on first drafts
22:22:53
pjb
https://github.com/informatimago/lisp/blob/master/languages/linc/test-statements.sexpc generates https://pastebin.com/DWE8Yk4L