freenode/#lisp - IRC Chatlog
Search
21:39:09
pjb
you could add a variable: (loop for l = (length big-list) :then (- l n) for start on big-list by (lambda (x) (nthcdr n x)) while start collect (subseq start 0 (min l n))) ; but it would still read the big-list twice.
21:42:05
pjb
personnally, I just write: (com.informatimago.common-lisp.cesarum.sequence:group-by big-sequence n)
21:43:51
pjb
But if I tell you that you will come again, "and where does group-by come from?" etc…
21:53:05
pjb
dxtr: it uses a global namespace. In the Internet age, were you get systems from anywhere, you can easily have package name collisions.
21:54:05
pjb
Local package name systems have been defined and implemented, but there are variants, and it's not integrated in all implementations yet.
21:54:44
aeth
There are several issues with the package system. (1) No portable local package nicknames and it's very easy for nicknames to conflict. (2) You will wind up with a million exports for any decently sized program, and the verbosity of it seems very unlispy. (3) There's no easy way to check for unused imports or nonexistent exports because of the dynamic nature of it.
21:55:10
aeth
(2b) That verbose million exports thing could easily also apply to imports, which is why most imports are just used with :USE instead of :IMPORT-FROM
21:56:06
aeth
pjb: I do one package per file to keep the exports down and I *still* sometimes wind up with dozens of exports for a moderately sized (400-800ish) file
21:57:05
aeth
https://gitlab.com/zombie-raptor/zombie-raptor/blob/161143c74c456393a28ccb8618d86dd42444eaf7/math/matrix.lisp#L16-61
21:57:44
dxtr
I buy the package nickname/alias argument and the unused checking. The rest is like.. If you need that many imports and exports you need that many imports and exports
21:59:28
aeth
Actually, you don't. Most of the time when you get tons of exports it's because of struct or CLOS object accessors. If you're okay with forcing the user to use with-foo-accessors (a specific version of with-accessors) you can do something like this: https://gitlab.com/zombie-raptor/zombie-raptor/blob/161143c74c456393a28ccb8618d86dd42444eaf7/util/util.lisp#L263-292
22:00:06
aeth
The only imperfection there is that it doesn't check that it's a valid accessor first. I went for simplicity of definition/implementation, at least for now
22:00:41
copec
shka_ I assume you know more than I and I would like to compare/contrast package systems
22:01:13
aeth
(with-foobar-accessors ((foo foo) (bar bar) (baz baz)) foobar ...) ; 1 export instead of 3. adds up if you have tons of structs and CLOS objects all over the place
22:01:36
aeth
Except it's really 2 exports because I also have (with-foobar-accessors* (foo (bar* bar) baz) foobar ...)
22:02:14
shka_
aeth: https://github.com/sirherrbatka/cl-data-structures/blob/e5b8bf35f906790be83b3ca99f3de1a60ce5fa3f/src/utils/macros.lisp#L299
22:02:36
aeth
Oh and my macro system supports prefixes, too. If you want safety, use one prefix for public accessors. The prefix is implicity added.
22:04:02
aeth
In case I was unclear, the accessors could be foobar-foo, foobar-bar, and foobar-baz, and the syntax would be identical in my examples above.
22:04:27
aeth
So it's not just for simpler imports/exports. I also use it internally within the same package to eliminate prefixes.
22:05:07
aeth
So I'm not sure I need to support some kind of safety to prevent people from using accessors they're not supposed to when the prefix system could work perfectly fine for that.
22:18:41
ealfonso
for the chunking issue, I used my own macro, even though sub-chunk elements are reversed https://pastebin.com/gpduRSqD
22:19:35
ealfonso
(loop-do-chunked chunk '(1 2 3 4 5 6 7) 3 (format t "chunk is ~A~%" chunk)) => chunk is (3 2 1) chunk is (6 5 4) chunk is (7)
22:20:43
dxtr
Possibly. I just want to remove a function because I accidentally made it a defun when I wanted it as a defmethod
23:10:35
dxtr
And when I try to prepare a statement it says my table doesn't exist - although I can select from it from the cli
23:26:50
pjb
Notice how you can thus define as many packages as you want, as different interfaces for different clients.
23:49:38
dxtr
Well, what I'm making a sort-of wrapper around some cl-dbi functions and I've defined my execute like (defun execute (conn query &rest parameters)) - but that fails with prepared statements that is supposed to have zero parameters
23:50:26
dxtr
But I can't just do (if parameters (dbi:execute ... parameters) (dbi:execute ...)) because I don't know if parameters actually is nil
3:13:38
ealfonso
I heard that hunchentoot sessions are not really secure... "Hunchentoot makes some reasonable effort to prevent eavesdroppers from hijacking sessions (see below), but this should not be considered really secure. Don't store sensitive data in sessions and rely solely on the session mechanism as a safeguard against malicious users who want to get at this data!" is there an easy way to make them secure?
4:29:54
pillton
Probably not, mainly because communities write language run-times that don't compose.
4:44:12
vtomole
Is there a "duplicatesp" that checks if a list contains duplicates. I only see remove-duplicates and delete-duplicates from clhs so far.
4:47:06
vtomole
Aha! I finally found a procedure that "Makes sense" to be in cl-user but it's not ;)
4:58:27
vtomole
I forgot that Alexandria is kind of like the "procedures that would be nice to have in cl-user" library.
5:52:12
ealfonso
when I start a repl in slime, how I switch to a package and load some sexps in that package? I've tried (swank:set-package "...") (swank-repl::in-package "..."), but it doesn't seem to work the first time
5:57:48
ealfonso
mathZ I get "var is unbound" for a defvar'd var in package A after (in-package "A")
5:59:10
ealfonso
also, how is it possible that I'm getting a "function is undefined" for a function I declared as an (:import-from package function) ?
6:06:23
beach
ealfonso: I always put (cl:in-package ...) on top of files, because you never know what the current package is when you load or compile them.
6:08:11
ealfonso
this is the sexp I'm using to load my project on a new repl. the "start" and "make-config" functions are defined in one of my packages: (progn (load "my-project.asd") (ql:quickload "my-project") (in-package "my-project") (start (make-config :port 4242)))
6:08:48
theemacsshibe[m]
it's the thing that lets normies like me use IRC with slightly more features
6:09:18
beach
ealfonso: You should probably not LOAD the ASDF file, but instead make sure ASDF finds it on your system.
6:09:40
ealfonso
the second time it works... I'm wondering if there's a way for it to work the first time
6:11:26
ealfonso
beach I feel that even if I did that, the first time the my-package:my-symbol symbols would still be interpreted as being in COMMON-LISP-USER at first in the slime repl
6:12:05
beach
ealfonso: so any symbol without a package prefix is going to be interned in the cl-user package, including make-config.
6:12:49
ealfonso
beach yeah. but if I prefix those symbols with my project, I think I get a read error since the package hasn't been loaded
6:12:53
beach
ealfonso: Plus, you can't really give it a package prefix, because that package does not exist when the form is read either.
6:14:39
ealfonso
so I guess have to live with manually running the form twice. or running two different forms
6:17:51
beach
Instead of (make-config ...) you can do (funcall (find-symbol "MAKE-CONFIG" "MY-PROJECT") ...)
6:27:22
ealfonso
beach it was annoying to have to wait at the repl for one sexp to finish loading only to enter another one
6:35:05
beach
kuribas: If you are new to Common Lisp, you probably want to start with the Common Lisp HyperSpec.
6:36:03
beach
Otherwise, if you are looking for the SBCL manual, it is here: http://www.sbcl.org/manual/
6:38:17
beach
You can download the Common Lisp HyperSpec from the site I showed you, but not in info format.
6:38:45
beach
But there is an Emacs library that accesses the Common Lisp HyperSpec and shows it in an Emacs buffer.
6:41:38
beach
I forget, sorry. I don't need the Common Lisp HyperSpec so much these days, so I haven't bothered installing it.
6:42:51
beach
Yeah, maybe so. But it might require a local copy of the Common Lisp HyperSpec. Again, I forget. You would have to read the documentation.
6:50:25
phoe
elisp uses dynamic bindings by default, as stated at https://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Scoping.html
6:58:42
kuribas
lol "I basically do not have a very high opinion of many of the decisions that were made in Common Lisp."
7:00:48
kuribas
he is very stubborn in his view, but has been a big force in the free software movement.
7:01:34
beach
kuribas: Also, at the time, he complained that Common Lisp was (still is) "huge", but since then, other languages have become even bigger.
7:01:43
phoe
kuribas: many of the choices made in CL were not made because they were good at that moment, but because they were the best at that moment
7:05:35
xificurC
beach: really not much? No new multi-threaded GC algorithms? Stack allocation strategies? Optimization techniques?
7:06:38
beach
xificurC: That's strictly speaking not programming-language design, but implementation techniques. There is a lot of work in those domains.
7:09:40
beach
kuribas: What are you planning to do with Common Lisp? Just learning for fun, or do you have some projects in mind?
7:15:05
beach
But if you stick to the subset that many other languages have, then it doesn't have many surprises.
7:51:29
beach
kuribas: So is there a CLOS-like system in the Scheme standard these days? I haven't been following the evolution of the Scheme standard for some time.
7:53:58
jackdaniel
beach: there is tiny-CLOS developed in Xerox by Gregor Kiczales, it is part of many scheme implementations
7:54:18
jackdaniel
racket built on top of that library called swindle (which is a tiny-CLOS superset)
7:56:33
mange
I'm pretty sure there's nothing CLOS-like in the Scheme standard. I haven't looked at it for a while, but I think I would remember that.
7:59:42
jackdaniel
given the context these pointers were relevant though, because kuribas was talking about de-facto state of scheme ecosystem
7:59:57
jackdaniel
just as we claim that CL may be used with threads (though they are absent in the standard)
8:02:39
beach
For example, if you can add a slot to an instance at run-time, then essentially a slot lookup must always go through a hash table to check whether the slot exists.
8:03:44
beach
But then, there are compilation techniques that make the (usually correct) assumption that instances are basically class-based.
8:04:14
beach
jdz: Yes, and the Self people proved that prototype-based languages can be compiled efficiently.
8:05:15
beach
shrdlu68: So the Common Lisp creators carefully avoided mechanism that were not sufficiently investigated at the time. These days, we could probably push the envelope a bit more if we wanted to.
8:09:01
xificurC
it's a question of what the goal is though, right. If you don't care about speed you don't have to think about whether the implementation will have a chance to compile into something fast.
8:09:38
xificurC
TCL was never meant to be a general purpose language AFAIK, just a glue like shells
8:10:10
beach
xificurC: Right. That's how I characterize "scripting languages" when I talk to industry. They are languages that are basically designed to be slow, sometimes because the creator knew nothing about language implementation.
8:12:15
beach
xificurC: So here is my favorite typical scenario: An application is developed using a static language such as C++ "for speed". Then some configuration or scripting capabilities are needed, so they add a slow implementation of a dynamic language, like TCL. Then the advanced users can only program using that language, so there is now a lot of code that is slow, for a combined slow application.
8:12:38
on_ion
i think of it like textual config file formats became more complex and turned into scripting langs
8:13:12
beach
And that's even worse, because then no real thought was put into the design of the language.
8:16:02
p_l
(using s-expressions cheats around it by pretty much removing the need to write a parser)
8:16:14
xificurC
beach: of course misusing the language will cost you. If you write a bash script that launches a program and does some pre/post-processing you haven't done much harm. If you write the whole thing in bash you might have
8:17:11
p_l
(also, bash ranks pretty high when compared to "random arse language somebody hacked up for their application")
8:17:11
xificurC
UNIX is based on having many small C programs, which are often glued together with a shell script
8:20:17
xificurC
beach: how much are you aiming for speed with SICL? Do you want to be competitive with SBCL?
8:21:57
p_l
Genera at some point added more "interface" in the form of Command Processor (which survives in CLIM Listener)
8:22:48
xificurC
p_l: write your own functions and call them directly doesn't sound much different than bash
8:24:58
shrdlu68
xificurC: As I understand, there were no interrupt-style system calls. It was all like one large CL system.
8:26:39
p_l
older lisp machines would be like booting into full-screen REPL with basic windowing system
8:27:54
p_l
early lisp machines had very simple GUI - you had the basics that were afaik taken from older MIT PDP-10 TV system (reflected in the package name "TV")
8:31:42
p_l
but remember that early lisp machines (CONS) were I think mid-70s, CADR was I think late 70s? got commercialized in first few years of 1980s
8:32:46
p_l
if you run SBCL directly on bare metal (nyef experimented with it) you'd have essentially the same case for GC
8:33:35
p_l
what LispMachines had extra was support for directly typed memory as well as things like forwarding pointers and advanced (comparatively) MMU
8:35:35
p_l
there were microcode assists on 3600 for GC, but overall it was less "GC is built into hw" and more "hardware is built for high-level language including hw-level typing"
8:38:09
kuribas
this is mostly irrelevant today, as special purpose cpu's don't have the speed advantage.
8:44:25
beach
xificurC: I am definitely aiming for speed. But I am more concerned about safety and debugging, so there might be situations where I can't compete. For example, SBCL trusts the programmer to supply correct DYNAMIC-EXTENT declarations. I don't think I want to do that.
8:46:33
beach
shka: Possibly not much. Perhaps I will attempt to prove it correct only if it is explicitly given. But I haven't made up my mind.