freenode/#lisp - IRC Chatlog
Search
9:58:58
jmercouris
but communities with 10x, 100x as many users have the same amount of web frameworks
10:01:05
verisimilitude
This is a good document so far, beach, sans that note about IF, WHEN, and OR I disagree with.
10:02:16
jmercouris
beach: not sure what you mean, I did isearch-backward and I didn't say number or "amount of stuff"
10:03:03
verisimilitude
I'm not always inclined to create a class or struct when I want a record; usually, it's more convenient to use a list and simply control all ways things are modified.
10:03:32
jackdaniel
they (frameworks) probably passed this strange point where numbers become amounts, we can't count them anymore ;-)
10:04:23
verisimilitude
I'm certainly not going to make types that are simply standard types with a documentation string attached.
10:05:19
beach
verisimilitude: Using a list is fine, as long as you wrap it in a consistent protocol. I suspect you wouldn't do that, though.
10:05:48
beach
verisimilitude: Then you would have more code than if you did it with a standard class.
10:06:19
verisimilitude
I'd rather use standard types if I can, then introduce my own types and then functions that only work on those types.
10:06:32
beach
... :accessor bla, vs (defun bla (thing) (car thing)) (defun (setf bla) (new-value thing) (setf (car bla) new-thing))
10:07:01
verisimilitude
One of my favorite type sysetms is APL's; you have arrays or single values of numbers or characters and that's it.
10:09:17
TMA
verisimilitude: try the type system of MUMPS, even simpler... you have string and associative array (each variable is both at once, and each variable value is both at once, although expression values are just strings)
10:10:06
jackdaniel
I like the binary type system, everything is either 1 or 0 ;-) that said I'll check on later \o
10:10:45
verisimilitude
The ``type system'' of a typical machine code is what enables its homoiconicity, so, yes, it's very nice.
10:15:03
xificurC
I have a function that is used from a script and is calling exit at the end. Invoking that in the slime REPL exits the session :)
10:16:26
xificurC
when writing bash scripts and calling a script from the repl the script is a forked process so it exits with an exit code and you're back in the shell
10:17:39
loke
verisimilitude: Bash is reasonably sensible. What aspects of it do you feel that is odd? (as opposed to its ancestors)
10:18:17
verisimilitude
Well, I can't rightly criticize Bash if I don't get to criticize sh and everything else.
10:18:45
TMA
loke: there is no string representation of an array (that is no "builtin" string representation) you can write your own, eg.: a="a" a("a")="a" a("a","a")="a"
10:19:59
verisimilitude
I mostly use sh for writing programs to launch my real programs. I'd hate more to do anything else in it.
10:30:14
verisimilitude
If you want efficiency, it's virtually guaranteed you're going to get a better expansion than LOOP; LOOP implementations are generally quite poor in that respect.
10:31:13
verisimilitude
What does SBCL's LOOP MACROEXPAND to, SB-LOOP::LOOP-BODY; that's very informative.
10:52:59
verisimilitude
Now, with regards to my article, I can recognize the obvious issues with DRAW-WINDOW-BORDER and how some of the other functions could be cleanly split into more parts, but I was aiming for one direct purpose for each function and doing otherwise would've distracted from the actual points being made, I think.
11:18:38
aeth
verisimilitude: I find that the often-neglected DO is a nice middle ground between LOOP and TAGBODY/PROG, especially for macros instead of direct use.
11:18:59
aeth
DO also tends to have a straightforward macroexpand-1, unlike LOOP, and you *can* put GO in it if you need to.
11:21:29
aeth
As for PROG, it's so rare to use it directly that emacs/slime doesn't even correctly format it iirc, unlike tagbody.
11:23:41
aeth
As for sh, imo it's only a good choice for < 20 lines or so, but it's pretty hard to beat for those < 20 lines.
11:28:05
aeth
I've always thought that the optimal length of a scripting language file is about 100 lines.
11:29:32
aeth
That's 5x longer than my intuition for sh. And it does seem to match my experience in trying to convert sh to a scripting language, even CL + UIOP.
11:31:14
dim
is there some docs online showing how to compile SBCL with say openssl already linked in the ELF binary (avoiding dlopen)?
11:32:25
aeth
Some people were experimenting with packaging libraries with binaries in #lispgames so they might have an answer if no one in here knows. (As for me, I never got to the binary part.)
11:47:34
dim
because it may dlopen a different ssl lib at build-time and at run-time, and then the lisp image contains symbols that are not found, and then I don't undertand anything other than it fails
11:53:57
beach
shka: It assumes a total ordering, so if neither (funcall less x y) nor (funcall less y x) is true, then it assumes x and y are equal.
11:55:00
jackdaniel
stability only ensures, that if a preceedes b, and neither is lessp then the other, then a will preceede b in the resulting sequence
12:00:28
beach
shka: Right. STABLE-SORT typically does not have to test for equality. It just makes sure that the order is not altered unless the second is strictly less than the first.
12:20:20
beach
Speaking of which, there is a related project that could result in an ELS paper. It is known that merge sort (which is stable) is faster than quicksort (which is not). But naive merge sort requires O(n) additional memory to sort a vector (but not a list). There are research papers that turn that into O(1) but at a cost. The project is to implement merge sort on vectors by checking whether there is available space on the stack. If
12:20:20
beach
so, use it to make merge sort fast. If not, use one of the published algorithms to make it correct but slower.
12:31:55
beach
shka, jmercouris: now that I think about it. Those papers may not be available for free, so be careful what you do with them.
12:34:38
beach
shka: Sure. Still, someone needs to write the tests and compare to the SORT implementations of various Common Lisp systems. There is plenty of non-academic work in a paper like that.
12:36:14
jkordani
beach: that sounds interesting to me too. but how can it be known how much space is available on the stack?
12:36:44
beach
jkordani: I am pretty sure your Common Lisp implementation has a way of telling you. I know SBCL does.
12:37:33
jkordani
in hindsight I suppose that it is known/enforced by the os so I guess I shouldn't be surprised that there is a way for a program to discover the limit
12:38:11
beach
jkordani: And in the case of SBCL, I believe the default stack size is fixed by SBCL itself. It is per thread.
12:39:39
beach
Now you are asking me to remember that. No way. Let me see whether I can dig it up...
12:40:20
schweers
beach: I thought you knew it off the top of your head, don’t go to too much effort just to satisfy my curiosity please.
12:40:48
beach
OK. I'll see if it is the paper we wrote about processing lists in reverse order. Hold on...
12:43:45
beach
schweers: sb-vm:*conrol-stack-end* sb-vm:*control-stack-start* sb-kernel:control-stack-usage is what I see in our code.
12:45:17
beach
so you do (- sb-vm:*control-stack-end* sb-vm:*control-stack-start* (sb-kernel::control-stack-usage))
12:46:38
schweers
oh, control-stack-usage is not external. that explains why I couldn’t find it at first
14:28:24
beach
loke: I have invented a synchronization protocol for the garbage collectors of SICL. If you feel like reading it, here it is: http://metamodular.com/garbage-collection.pdf
14:28:42
beach
loke: I included the entire chapter, because it explains the different techniques as well.
14:29:17
beach
loke: I am not a synchronization expert. There might be simplifications possible, using (say) condition variables rather than semaphores.
14:30:02
beach
loke: The chapter is not entirely complete. I have yet to describe locking in the global collector as a result of promotion requests and as a result of using multiple threads for the global collector.
14:30:50
beach
Anyone else who would like to read it is of course welcome to do so. I take questions and requests for improvements as usual.
14:31:52
Bike
this isn't directly related, but how are conses recognized if they don't have a class pointer?
14:34:58
Bike
and racks don't move. the only time you'd need to resize one is for change-class, but you can just allocate a new rack instead and actually sorta have to, so there's no problem
14:38:00
beach
A checks the size, then gets blocked. B shrinks the array. A wakes up and sets an element outside the array.
14:38:26
flip214
what's the easiest way to get an (array (unsigned-byte 8) *) MSB-filled from a bigint? a loop with LDB, or is there a faster way?
14:41:31
beach
In SICL, the plan is that A checks the size which is stored in the rack and the rack does not change its size. B shrinks the array by allocating a new rack. It then uses the CAS operation to install the new rack. A needs to access the rack again only after a call to an external function, or in an infinite loop.
14:42:25
beach
So does Clasp have a lock for every array access? Or is it just not thread safe? Or some other solution that I can't think of?
14:50:44
jackdaniel
afaik Jose's idea about thread-safety was that programmer is responsible for locking access when appropriate (and since drmeister reimplemented same algorithms in C++ initially, that behavior is inherited)
14:51:39
beach
There is also the fact that "thread safety" means different things for different people.
14:52:33
drmeister
I think we could add thread safety by making the type that points to the rack and the rack slots to atomic.
14:52:42
beach
But it can give the wrong answer in some situations unless the programmer take precautions.
14:59:01
drmeister
I can't answer at the moment - I'll need to think hard about what you proposed and what I'm thinking.
15:50:44
beach
Suppose I wanted to implement Clordane for SBCL, or rather, for SBCL code compiled with a Cleavir-based compiler, so that I can control precisely what that code does. I translate to HIR, then back to a simpler Common Lisp that I compile with the native SBCL compiler. But the resulting code is supposed to interrogate a table in the thread structure say before and after each form to evaluate.
15:50:57
pjb
loke: message passing was what was envisionned originally by Alan Kay. Unfortunately, he named it object-oriented, and the first implementations used function calls, so all went awry. The difference is that function calls are synchronous, while message passing is asynchronous: the sender doesn't wait for the recipient to process th message. This is not necessarily related to multi-threading or multi-processing, and if you have
15:51:34
beach
Now, SBCL represents threads with structure objects, so I can't change-class if I want to add more stuff to them. Do I need to modify the source of SBCL to make this work.
15:51:44
pjb
loke: when objects are restricted to a single thread, they're called "monitors". Then they're the focal point of synchronisation, since processing their messages is mutually-exclusive.
15:58:03
beach
For native SICL code, I imagined having several tables mapping values of the program counter to source locations, for things like stepping.
16:05:17
beach
That might work. Before and/or after evaluating an expression, the code consults a hash table in the thread object. If the hash table contains TRUE, then the threads stops, waiting for the debugger to allow it to continue.
16:06:55
beach
mfiano: It is inconclusive. In SBCL it is sometimes faster and sometimes slower than the native technique.
16:07:28
beach
I guess it must also indicate where it stopped (the HIR value) so that the debugger can consult a table to figure out the corresponding source location.
16:09:29
Bike
it's faster than what we had. the main issue with it is warmup time, which is exacerbated by unrelated factors. and sbcl has warmup time too. such is caching
16:11:04
beach
mfiano: The beauty of Common Lisp is that several techniques could coexist. Some generic functions could use one technique and some others some other technique, so the best one can be chosen on an individual bases. The same generic function can even use different techniques at different times, depending on the applicable methods.
16:12:03
beach
One might for instance choose one technique for a simple slot reader, and a different technique for (say) PRINT-OBJECT.
16:13:31
beach
I use that fact when I run SICL generic functions inside SBCL. I use the fast generic dispatch technique to create the discriminating function, and SBCL uses its own technique of course.
16:19:47
beach
What someone should do some day is to figure out how to recompile call sites when the callee changes, and doing so while still respecting the semantics of Common Lisp. I am pretty convinced that just recompiling the calling function from scratch would violate the semantics.
16:22:00
beach
How would it violate the semantics? Well, for one thing, if you start from source code, you will have violated the "minimal compilation" restriction, because some macros might have changed in the meantime.
16:30:52
beach
We could represent the discriminating function of the callee as HIR, inline it, and then do things like type inference on the result.
17:05:14
asarch
asarch@hell:~/Projects/clisp-2.49$ ./configure --cbc built-with-gcc > compilacion.log 2>&1
17:27:27
phoe
also you're in Lisp-2 now so these two different forms of def start making little sense now
18:35:42
makomo
is there a way to create a never-before-seen package just like you can do for symbols with GENSYM?
18:36:18
makomo
i can do (make-package (gensym)) but the SYMBOL-NAME is used as the package's identifier right?
18:36:58
makomo
so any other symbol with the same name will return the same package when FIND-PACKAGE is used
18:45:08
edgar-rft
makomo, try (progn (make-package 'foo) (make-package 'foo)) ans see what happens.
18:49:03
makomo
and i want a fresh package every time i READ to make sure that i get a new environment of sorts
18:49:25
makomo
i guess i could reserve a name for myself and then DELETE-PACKAGE when i'm done and ready to READ again
18:49:42
makomo
but i could have multiple "simulations" running, which would require multiple fresh packages at the same time
18:51:03
makomo
i see this as the same problem of "well, just come up with a funny name that nobody else will think of"
18:51:26
MichaelRaskin
I would generate a random name (as in (format nil "~36r" (random (expt 36 20))) ) add prefix, check for collisions, hope for the best
18:52:58
makomo
but i wonder why strings were chosen as package identifiers? would it really be weird if symbols named packages?
18:54:58
MichaelRaskin
By the way, as make-package signals if there is a conflict, you can write a make-random-package function that is guaranteed not to collide with its own things
18:56:09
dlowe
That would be better than using the built-in reader and hacking it to do what you want.
18:56:37
scymtym
makomo: another option would be https://github.com/robert-strandh/eclector which can be customized to not intern symbols
18:57:43
MichaelRaskin
One day beach will release SICL with first-class global environments and there will be much rejoicing
19:03:53
sjl
asarch: ASDF has a manual. It's worth sitting down and reading the whole thing at some point https://common-lisp.net/project/asdf/asdf.html
19:42:32
didi`
So I'm reading CLtL2's section 22.1.1 What the Read Function Accepts, and it contains a description of the reader algorithm. It looks interesting.
19:51:05
didi`
I am trying to write a reader for JSON, using CLOS, but I stopped at writing various (defmethod read-number (stream (x (eql 0))) ...), (defmethod read-number (stream (x (eql 1))) ...), ... CL's algorithm might be a better one.
20:01:38
butterthebuddha
Yeah I thought so; I am implementing an interpreter and was wondering if there was any functional difference between a vector and an "atom" that I wasn't aware of
20:16:38
aeth
atoms were useful... before Lisp added arrays, hash-tables, structs, CLOS objects, streams, ...
20:17:43
MichaelRaskin
https://gitlab.common-lisp.net/mraskin/agnostic-lizard/blob/master/debugger-hooks.lisp — the core of core of portable debugger hooks support. Not as simple as I hoped, not as horrible as I feared (and forced me to add some more useful data in Agnostic Lizard)
20:17:54
aeth
It might still be a meaningful distinction in elaborate macros, but you'd generally be testing for lists and then handling the rest differently, not testing for atoms
20:19:51
MichaelRaskin
For some reason, such names feel good for my attempts at something small that traverses something
20:22:54
MichaelRaskin
When a minimal extension for adding hooks is over a hundred of lines, obviously the thing itself has to be larger
20:23:52
MichaelRaskin
I guess it helps that the choice is either that or «yet another portable code walker, but actually working this time»
20:24:26
aeth
Lines aren't a good measure in Lisp. The problem is that by the time you get to 6k-8k lines, you never have to leave.
20:29:48
MichaelRaskin
And I guess if my mess of throwing together «escape browser dump web to text editor» is ever worth a release, I keep the package name thoughtful-theridion (theridia is the taxon of cobweb spiders)
20:34:35
dim
can I (open "..." :direction :probe :if-exists :rename) and expect the rename to happen?
20:40:31
dim
it seems not, so I'm using with-open-file and a dummy instruction to avoid the warning about the variable being unused