libera/#commonlisp - IRC Chatlog
Search
14:25:25
Josh_2
The MOP is a very good example of the divide between MIT and New Jersey, its pretty complicated but can create a very simple interface
14:28:38
pjb
Josh_2: is CLOS more complex than Smalltalk Meta Object System? (I'd say yes, but that's because multiple-inheritance, and methods attached to generic functions vs. classes).
14:30:00
pjb
flip214: and even, while (the nil (values)) seems logical, there's no specification that no values returned by (values) is of type NIL! We just know that NIL is an empty type.
14:30:39
pjb
flip214: on the contrary, it's specified that (values) = NIL as soon as you need something.
20:16:30
Josh_2
Can I make all instances of a metaclass funcallable without using initialize-instance?
20:19:30
Bike
or do you want these classes to have funcallable-standard-object as their default superclass instead of standard-object like usual?
20:20:15
Josh_2
I've made instances of a class funcallable and tried it, but I'd like the setting of the funcallable function to be done when the class is defined rather than when and instance of that class is initialized
20:22:22
Bike
could you like, provide some context, maybe? i don't understand what you're doing. why would you want to call a class?
20:22:50
Josh_2
I want the funcall function to be set when the class is defined not when an instance is made
20:23:47
Bike
it sounds like maybe you want a default function but i still don't understand what you're doing. what's the problem with doing it in initialize-instance?
20:32:58
saturn2
according to this, there is no other way to set the funcallable-instance-function than calling set-funcallable-instance-function on each instance
22:12:42
hendursaga
Anyone aware of some CL equivalent to this? https://github.com/jgoizueta/sys_cmd
22:13:18
hendursaga
Basically a DSL for 'building up' commands + their arguments to be called on a shell
22:18:21
Alfr
hendursaga, you're after the escaping part of it? Maybe uiop:escape-shell-command fits your needs?
22:20:37
hendursaga
Alfr: like, some kind of macro that takes something say unix-opts might use to parse command-line arguments, but instead of parsing, generate a function that would take in arguments and then output the string of the resulting command to call externally..
22:21:10
copec
hendursaga, I would google using common lisp as shell, I bet that would link to lots of useful things
22:22:52
Alfr
hendursaga, I don't understand what that function is supposed to do. Query a user for the arguments separately?
22:41:47
Alfr
hendursaga, from that package's description and the listed examples, I don't see how that project you linked does anything more than (except for being really verbose): (let ((s (uiop:escape-shell-command '("echo" "arg1" "arg with spaces")))) (uiop:run-program s :force-shell t :output 'string))
23:28:13
Nilby
Psybur: Yes, if you allow nesting of them, they have the same properties as lambda calculus.
23:41:02
edgar-rft
Psybur: if no skilled Lisp archaeologists show up in the next minutes, you can try yourself here -> http://www.softwarepreservation.org/projects/LISP/
23:49:55
Nilby
Psybur: The requirements for lambda calculus are fairly low. Anything that allows variable substitution and function application. Literal encapulation can be used in place of recursive function application, but of course it's quite tedious to construct things.
0:08:03
dieggsy
edgar-rft: it's like strftime, the other way around. e.g. if you give it "2018-12-01" and "%Y-%m-%d" it would spit out a date time object
0:08:42
dieggsy
idk why i've suddenly taking to using "spit out" instead of return, it's rather icky sorry lol
0:10:23
edgar-rft
don't know about allegro but local-time might have such a thing -> https://www.cliki.net/local-time
0:12:23
dieggsy
i try to avoid using extra deps where possible but good grief do we need a proper date/time handling library
0:13:11
dieggsy
we have a bunch of hacked together ways of detecting and converting date formats across several files and it's .... less than ideal
0:14:28
edgar-rft
I also try to keep external dependencies as low as possible but writing your own time/date handling rather quickly becomes an enterprise in itself :-)
0:21:16
dieggsy
there's multiple functions that do the same things, none doing it particularly well or strictly validly lol
0:24:15
edgar-rft
another fun is that in most networks every computer uses its own built-in hardware clock for the time and the clocks are rather seldom synchronized with each other
0:26:18
dieggsy
but i've been doing some tests and who knows how allegro is interpreting (date-time "20-800") lol. "20-200" is the 200th day of 2020...800 ... wraps around maybe? lol
0:27:55
Nilby
There was a good date/time string parser on old lisp machines, but it's much much harder to do now, since you have to know and allow locale and language and cultural specific formats, calendars, etc, and also things like do you allow things like 2 leap seconds?
0:28:50
mfiano
There is a Common Lisp book dedicated to calendrical calculations on my bookshelf I've been meaning to read.
0:37:11
mfiano
Here it is. Well, apparently there is a newer edition now, but I don't know what is different: https://www.amazon.com/Calendrical-Calculations-Nachum-Dershowitz/dp/0521702380
0:37:32
mfiano
One review: "However, some of the calculations are very complicated and it was difficult to translate these from the LISP listings in the book into PHP or Javascript."...
0:40:18
jcowan
Just handling the Gregorian calendar and its near relatives is hard enough. Mayan, fuggedaboudit.
0:46:35
Nilby
It's quite a bit of work to parse "2021年 9月 28日 火曜日" and "mar. 28 sept. 2021" and "Tue 28 Sep 2021" and "22 صفر 1443"
1:00:20
jcowan
THere are just so *many* parameters, some of which are locale-specific, others situation-specific. The U.S. is an m-d-y locale, but there are many ways to write it: September 28, 2021 or Seo, 28, 2021 or 9/28/2021 or 9/28/21 or 9-28-21 ...
1:08:55
hayley
It can be used to count the number of some resource available, and have threads wait until resources are available.
1:10:08
hayley
Well, a lock prevents concurrent access to one "resource", like a shared database. You could use a semaphore for more "resources", like elements in a queue.
1:13:55
seok-
Can I understand semaphores as just a thread-safe integer variable which counts the number of threads working on a function ?
1:15:12
hayley
You can release a resource and increment the counter, or acquire by trying to decrement the counter if it is positive, or waiting if it is not.
1:16:49
hayley
As I said, you can handle multiple resources, like multiple elements in a thread-safe queue, with a semaphore.
1:17:29
seok-
so the difference would be that, locking a variable will apply only to that one resource
1:17:53
mfiano
which is also a mutex, but a semphore is more general, because in a mutex for example, only the thing that locked a resource should unlock it
1:22:04
mfiano
ACTION doesn't do much multi-threaded programming these days, and when i do, i cheat and reach for lparallel, or "hardware mutex" atomics.
1:45:52
hayley
I've only really used semaphores indirectly through thread-safe queues, and occasionally I do nitty-gritty concurrent stuff.
1:50:32
akater[m]
Is there a codified Lisp indentation style guide? In particular, I'm interested in line splits. E.g. there is a practice of keeping “then” on the same line as “if” sometimes but it's sort of unofficial. I can't find any document that would consistently describe various Lisp indentation practices.
1:52:44
hayley
I know in the SICL style there is a linebreak in (loop for x in xs <linebreak> do ...) but it is not mentioned in the Specification.
1:52:58
moon-child
akater[m]: line splits are a matter of personal style, and the complexity of the expressions in question
1:53:39
moon-child
if the condition and the true branch of an if are simple and short, I would put them on the same line. If either is complex or contains many terms, I would put them on different lines
1:55:36
moon-child
(and if all are quite simple, put the else branch on the same line as well. Ditto the body of a loop, contra hayley's note re sicl style guide)
1:56:31
akater[m]
moon-child: I still wonder if there's any text describing Lisp indentation practices. There is personal style but there also is accumulated experience.
1:57:54
akater[m]
Keeping forms concise both horizontally and vertically by using whitespace wisely seems to be recognized as a virtue — again, only informally.