libera/#commonlisp - IRC Chatlog
Search
13:36:08
mfiano
Come to think of it, I rely on my implementation performing a lot of (potentionally) destructive list operations.
13:37:50
hayley
Seems I am doing something unusual, as I rarely write code which mutates lists...ever, I think.
13:39:11
hayley
Very funny, a NBHM is just a vector with some glitter glued onto it. And when I mutate sequences, I usually reach for a vector.
13:43:55
mfiano
I usually reach for the sequence that makes sense. Norvig-style queues and fixed array queues are both useful in different situations for example.
13:44:57
hayley
Usually I just use safe-queue (as most of the time I use queues in a concurrent program too). But then the queue in sb-concurrency uses a list internally.
13:50:53
Nilby
I know it's shameful, but a quick count of some potentially list mutative keywords in my current codebase: nconc 66 rplaca 10 rplacd 26 "\\(setf \\(car" 13 "\\(setf \\(cdr" 15 "nreverse" 209
13:53:24
mfiano
RPLACA/RPLACD annoy me as names, where the convention is to descriptively name your operators, so I barely ever use them. Reminds me of writing an assembler :/
13:58:36
mfiano
_death: Did you like the Paepcke book? Just received my copy, and will probably start reading it later today.
14:01:26
_death
mfiano: it's a collection of papers.. many were very interesting.. there were a few that I didn't care for
14:07:40
mfiano
_death: Ok. By the way, feel free to recommend any other Lisp books you liked. You have recommended 2 I have never heard of so far (the previous being Building Problem Solvers)
14:08:50
Nilby
mfiano: I agree. I wish I could convice my fingers not to type junk like (rplacd (nthcdr ... since it reads like nonsense.
14:09:46
_death
well my favorite programming book, which is also a Lisp book, is PAIP.. which you probably already read
14:15:29
_death
some books I would not call "Lisp books" but do use a kind of Lisp in a low-key way.. for example Hoare's Communicating Sequential Processes book
14:23:28
_death
one way to make a book into a Lisp book is to implement everything it talks about in Lisp as you read it ;)
14:25:59
_death
some books are easier to implement (e.g., they have pseudocode).. others require you to read part of their bibliography & other resources found on the web
14:27:07
_death
then after you read the papers and implement them, you understand where the author put more effort, and where he skimped ;)
14:29:50
_death
some papers are quite cryptic.. others build on other papers.. so you can spend a month implementing ideas from a paper and its related papers, even if the paper was a few pages
14:31:20
_death
sometimes there is not enough information to make it easy to test your implementation..
14:31:33
lukego
I had forgotten about the Lisp in CSP. I love that book, even based on its non-Lisp content :).
14:31:43
mfiano
I have given myself more freedom from gamedev this year to explore other programming interests, and that is exactly something i wanted to do
15:58:38
jcowan
Medley is a programming environment that provides two languages: Interlisp and Common Lisp. Unfortunately, the CL stands somewhere between CLtL1 and CLtL2. This needs fixing.
15:59:21
jcowan
It would pretty much be a Common Lisp project to do so, and I would expect that the CL test suite could drive it.
16:02:24
jcowan
There is an IL interpreter, a CL interpreter, an IL compiler to bytecode, and a CL/IL compiler to bytecode. There is no native code compiler.
16:12:19
jcowan
A fair amount, but IL and CL developed independently for decades. Interoperation is good: CL sees IL functions and fexprs as CL functions and macros (although only some of them return an actual macro definition to CL:MACRO-FUNCTION.
16:13:55
Bike
i'm flipping through the manual now. seems to describe everything as a function... setq, for example
16:16:32
Bike
i was guessing that was what "nlambda" means, but selectq isn't labeled as one (while stuff like cond is)
16:17:12
Bike
"If LAMBDA-WORD is the symboL NLAMBDA, then the arguments to the function are not evaluated" i am a genius
16:17:53
beach
jcowan: And that still leaves duplication between the Common Lisp interpreter and the Common Lisp compiler.
16:18:22
jcowan
Such was the case in Maclisp as well. It was one of Scheme's contributions to CL that locals are lexical unless declared otherwise.
16:20:30
Bike
is interlisp an actual standardized language? i thought it was, but what i'm looking at is obviously an implementation manual
16:20:40
beach
I see. So the reason there is not as much duplication between the Common Lisp interpreter and the Common Lisp compiler is that the interpreter incorrectly uses dynamic binding for lexical variables?
16:24:14
Bike
yeah i can't tell if this thing is being weird about what is and isn't an nlambda. (rpl n form) "evaluates the expression form n times" but it's just listed as a function
16:30:28
beach
jcowan: What would be the special features of Medley that make it the preferred choice over a modern Common Lisp implementation?
16:31:16
beach
Interlisp obviously, but what makes Interlisp preferable to a modern Common Lisp implementation today? And why do you want Common Lisp as one of the languages in Medley?
16:33:34
jcowan
The work rquired to upgrade Medley CL to the ANS should be fairly small; the biggest part is figuriung out wht needs fixing.
16:34:22
jcowan
Admittedly, Medley doesn't look that much like a modern concensus IDE, but more so than Emacs.
16:35:00
Bike
the part of the manual about the environment is longer than the part about the language
16:38:37
jcowan
Maclisp effort wentt into building the language; IL effort into building the environment.
16:40:32
_death
jcowan: one question is how to conciliate a saved image and new changes in the medley repo
16:41:03
jcowan
I have also thought a little about what it would take to implement IL in CL, thus providing the Medley environment with the speed of a modern CL
16:46:17
jcowan
But beyond that you would, I hope, only need to implement the functions currently written in C.
17:40:56
lisp123
one of the ancestors of Common Lisp, there was a discussion earlier today on it. Apparently it had a very good development environment
17:46:48
cosimone
hello, is there some way, to your knowledge, to manipulate the internal representation of floating point numbers as something such as a bit vector?
17:54:28
Bike
there's also https://github.com/Shinmera/float-features which uses implementation specifics to get the actual bits, which is maybe what you want
17:58:58
yitzi
Bike: I saw in the ANSI spec that attempting to delete the cl or keyword package is unspecified behavior. Any idea why that would even be permitted? Some implementation prevent it and some actually let me do it.
17:59:35
Bike
when the standard says something like that i think it's more to let implementations be lazy by not putting in measures to prevent it, rather than because doing it is a good idea
18:00:28
yitzi
Amazing. CCL actually let me do it. SBCL gave me a pile of restarts and then let me do it and then promptly froze.
18:05:43
yitzi
Yeah, both tried to stop me with package locks. So far only ECL and CLASP said no outright. ABCL just did so without complaint.
19:08:38
recordgroovy
ABCL lets me define a condition inheriting stream-error, but doesn't let me apply stream-error-stream to it, hmm...
20:37:44
pjb
recordgroovy: this is indeed an error: (define-condition sec(stream-error) ()) (subtypep 'sec 'stream-error) --> T, T
20:38:26
recordgroovy
I've heard (but haven't experienced) that ABCL has a strange relationship with CL streams, as well
20:54:05
pjb
recordgroovy: that's a serious bug I'd say, I define a lot of condition subclasses expecting to be able to use the accessor of the superclass (condition) slots…
20:59:34
pjb
recordgroovy: Note this is a problem only with stream-error it seems: (define-condition tec (type-error) ()) (type-error-datum (make-condition 'tec :datum 42 :expected-type 'character)) -> 42
23:11:45
CptKirk
is there a way to get stringify the value of a symbol maintaining its original casing?
23:15:35
hayley
(Note that, if the read case is set to :upcase, then a symbol which was read was originally all uppercase.)
23:23:43
CptJimKirk
https://codeberg.org/CptJimKirk/adventofcode/src/commit/2ba73ad0e5799b9bd0f63299787beb01496b51b8/cl/aoc-15.lisp#L36
23:26:05
hayley
"Note that, if the read case is set to :upcase [oh, and it is by default], then a symbol which was read was originally all uppercase."
23:31:03
mfiano
If you ignore the value of read case, all symbols are read into uppercase strings unless character-quoted with |..|
23:46:32
CptJimKirk
so that if its something then it would expand to (some form something other stuff)
23:49:15
saturn2
(progn (something) nil (otherthing)) will have the same effect as (progn (something) (otherthing))
23:50:26
CptJimKirk
but if `(some` is a function, then there is a `nil` being passed as the second argument...
0:33:18
pjb
CptJimKirk: (mapcar (lambda (maybe-nothing) (append '(some form) maybe-nothing '(other stuff))) '( (#|nothing|#) (some thing))) #| --> ((some form other stuff) (some form some thing other stuff)) |#
1:17:30
CptJimKirk
https://codeberg.org/CptJimKirk/adventofcode/src/commit/47e343b966c319b166c9fda34b56a7783749e590/cl/aoc-15.lisp#L44
1:17:58
CptJimKirk
saturn2 how is the lisp readtable to work at all when you are expected to set the read table before the invocation of the macro?
1:20:37
CptJimKirk
https://codeberg.org/CptJimKirk/adventofcode/src/commit/1a7491c2636c2fd9e49c039a01ceb3311492a7f2/cl/aoc-15.lisp#L36
1:22:29
CptJimKirk
so your'e saying that I would have to define everything that uses this and needs case insensitive symbosl would need to be done inside that let block
1:24:13
CptJimKirk
is there any way that on the other side of the macro, I can get case insensitivity?
1:24:36
CptJimKirk
something like that, or some other thing... that would achieve the case sensitivity I need?
1:26:32
pjb
CptJimKirk: april-load is a function-like macro: it has no compilation-time side effect. Therefore there's no point in using it in the topleve of your source file.
1:26:47
CptJimKirk
I don't want the user to need to know that they should (defapl |fnName| (args) ...)
1:28:54
CptJimKirk
but the main thing I'm struggling with the case insensitivy of symbols. Is there any way to achieve the behavior of (defmymacro |caseSensitive| (arg) (etc))
1:29:39
CptJimKirk
I basically want exactly a `defun` form but case sensitive and to wrap around April calls
1:31:15
CptJimKirk
... I'm asking for an alternative, not a restatement of the only solution I've found so far
1:31:55
pjb
You can put this on the first line of your source file: (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE) (SETF *READTABLE* (COPY-READTABLE NIL) (READTABLE-CASE *READTABLE*) :PRESERVE))
1:32:31
pjb
An alternative, but which is less pretty IMO, is to put this: (eval-when (:compile-toplevel :load-toplevel :execute) (setf *readtable* (copy-readtable nil) (readtable-case *readtable*) :invert))
1:33:05
pjb
In the first case you could write: (DEFMACRO caseSensitive (arg) (IF arg (etc) (whatever)))
1:33:19
pjb
In the second case, you would write: (defmacro caseSensitive (arg) (if arg (etc) (whatever)))
1:34:27
pjb
But in the second case, (defmacro notlower (arg) (if arg (etc) (whatever))) would define a macro named NOTLOWER, while in the first case, (DEFMACRO yeslower (arg) (IF arg (etc) (whatever))) would define a macro named |yeslower|.
1:35:32
pjb
CptJimKirk: it is a dynamic binding = it is during some time that it will have its effect. And the time the *readtable* is used, is WHEN you READ stuff. Eg. when you load a file, or when you compile a file. (or when you explicitely call READ or READ-FROM-STRING).