diip has quit [Quit: ERC (IRC client for Emacs 26.1)]
dbotton has joined #lisp
mmohammadi9812 has joined #lisp
refpga has joined #lisp
tamarindo has quit [Quit: Leaving]
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 265 seconds]
dbotton_ has joined #lisp
Oladon has joined #lisp
dbotton has quit [Ping timeout: 240 seconds]
dbotton has joined #lisp
dbotton_ has quit [Ping timeout: 260 seconds]
akoana has left #lisp ["Leaving"]
EvW has quit [Ping timeout: 260 seconds]
Lord_of_Life_ has quit [Ping timeout: 240 seconds]
Lord_of_Life has joined #lisp
aartaka has joined #lisp
galex-713_ has joined #lisp
galex-713 has quit [Ping timeout: 272 seconds]
aartaka_d has quit [Ping timeout: 260 seconds]
cer0 has quit [Quit: cer0]
Oladon has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
Kaisyu has joined #lisp
refpga has left #lisp ["ERC (IRC client for Emacs 27.1)"]
ex_nihilo has joined #lisp
OlCe` has quit [Ping timeout: 240 seconds]
jesse1010 has quit [Ping timeout: 260 seconds]
g0d_shatter has joined #lisp
<g0d_shatter>
does anyone know if there are any bindings somewhere for manipulating GDB, with common lisp? not debugging common lisp WITH gdb, but manipulating GDB debugging something else, specifcally the debugger state, the information about the program being debugged, as there is with Guile Scheme
g0d_shatter has quit [Quit: Leaving]
cer0 has joined #lisp
sts-q has quit [Remote host closed the connection]
semz has quit [Ping timeout: 260 seconds]
charlie770 has joined #lisp
charlie770 has quit [Remote host closed the connection]
toorevitimirp has joined #lisp
semz has joined #lisp
semz has joined #lisp
semz has quit [Changing host]
Stanley00 has joined #lisp
Stanley00 has quit [Remote host closed the connection]
Stanley00 has joined #lisp
borei has joined #lisp
borei has left #lisp [#lisp]
Oladon has quit [Quit: Leaving.]
iissaacc has quit [Ping timeout: 256 seconds]
torbo has quit [Remote host closed the connection]
space_otter has joined #lisp
hineios has quit [Read error: Connection reset by peer]
ech has quit [Ping timeout: 240 seconds]
alanz has quit [Ping timeout: 240 seconds]
tfb has quit [Read error: Connection reset by peer]
banjiewen_ has quit [Read error: Connection reset by peer]
buoy49 has quit [Read error: Connection reset by peer]
jerme_ has quit [Write error: Connection reset by peer]
jerme_ has joined #lisp
alanz has joined #lisp
buoy49 has joined #lisp
tfb has joined #lisp
Bike has quit [Quit: Lost terminal]
banjiewen_ has joined #lisp
hineios has joined #lisp
Oladon has joined #lisp
wxie1 has joined #lisp
space_otter has quit [Ping timeout: 240 seconds]
Kaisyu7 has left #lisp ["ERC (IRC client for Emacs 27.1)"]
iissaacc has joined #lisp
lucasb has quit [Quit: Connection closed for inactivity]
Alloc has quit [Ping timeout: 240 seconds]
Alloc has joined #lisp
<beach>
Good morning everyone!
mmohammadi9812 has quit [Quit: Quit]
mmohammadi9812 has joined #lisp
blackadder has quit [Quit: WeeChat 1.6]
Alfr has joined #lisp
<cer0>
o/
Alloc has quit [Ping timeout: 240 seconds]
Alfr_ has quit [Ping timeout: 260 seconds]
iissaacc has quit [Ping timeout: 240 seconds]
tamarindo has joined #lisp
jibanes has quit [Ping timeout: 265 seconds]
jibanes has joined #lisp
Stanley00 has quit [Read error: Connection reset by peer]
Stanley00 has joined #lisp
pillton has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
space_otter has joined #lisp
galex-713_ has quit [Ping timeout: 272 seconds]
galex-713 has joined #lisp
FreeBird_ has quit [Remote host closed the connection]
orivej has joined #lisp
charlie770 has joined #lisp
Oladon has quit [Quit: Leaving.]
Fare has joined #lisp
mmohammadi9812 has quit [Ping timeout: 256 seconds]
wxie1 has quit [Ping timeout: 272 seconds]
mmohammadi9812 has joined #lisp
Alloc has joined #lisp
saganman has joined #lisp
notzmv has quit [Ping timeout: 240 seconds]
frost-lab has joined #lisp
notzmv has joined #lisp
bocaneri has joined #lisp
galex-713 has quit [Ping timeout: 272 seconds]
galex-713_ has joined #lisp
cer0 has quit [Quit: shutdown now]
space_otter has quit [Remote host closed the connection]
<jasom>
I predict that I will not like that code in the morning.
<beach>
Sounds plausible.
<no-defun-allowed>
You made parser combinators again?
<jasom>
trivial-rfc-1123 could probably do it if I stripped comments first; I don't think any non-comment parts of the string contain parenthesis
<jasom>
no-defun-allowed: nope, it's not even remotely functional; just classic unstructured recursive-descent
<no-defun-allowed>
That is true.
<jasom>
still more readable than a regex though
<no-defun-allowed>
I thought it looked like something I would write with esrap, which in turn looks like combinators, but it is in fact a packrat parser.
<Nilby>
jasom: I don't think it's too bad this way. It's not much different than if you made an esrap parser, and performance is probably not a problem.
<jasom>
Nilby: if I changed the parse-error to returning a known value it would probably be faster than esrap; languages with limited backtracking are ususally slower in packrat
<jasom>
because packrat parsers memoize everything just in case backtracking might happen (which is a worst-case performance win in highly backtracking grammars, but a constant-factor loss in grammars with little (or no) backtracking)
charlie7` has joined #lisp
<Nilby>
I've done small parsers like this and they seem too work fine. This one looks fairly clear. With a little documentation it could be an instant classic.
charlie770 has quit [Ping timeout: 264 seconds]
charlie770 has joined #lisp
charlie7` has quit [Ping timeout: 260 seconds]
charlie770 has quit [Ping timeout: 240 seconds]
shifty has joined #lisp
shifty has quit [Client Quit]
shifty has joined #lisp
__jrjsmrtn__ has quit [Ping timeout: 240 seconds]
narimiran has joined #lisp
kir0ul has quit [Ping timeout: 260 seconds]
zaquest has quit [Quit: Leaving]
zaquest has joined #lisp
charlie770 has joined #lisp
aartaka_d has joined #lisp
Qudit314159 has quit [Remote host closed the connection]
aartaka has quit [Ping timeout: 240 seconds]
space_otter has quit [Remote host closed the connection]
<charlie770>
If I wanted to understand mezzano's source where would I start?
<beach>
charlie770: I am curious. What made you choose that particular project?
skapata has joined #lisp
<charlie770>
beach: I wanted to start reading common-lisp code and wanted to see how operating systems worked. By reading mezzano, I can do both.
<beach>
Got it.
_whitelogger has joined #lisp
<beach>
Nilby: Sure. Remind me what book that was?
<Nilby>
beach: Thinking, fast and slow
<beach>
Ah, yes. Excellent book.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
random-nick has joined #lisp
shka_ has quit [Ping timeout: 256 seconds]
Qudit314159 has quit [Read error: Connection reset by peer]
Qudit314159 has joined #lisp
Lord_of_Life has quit [Changing host]
Lord_of_Life has joined #lisp
gaqwas has joined #lisp
gaqwas has joined #lisp
gaqwas has quit [Changing host]
tiwEllien has joined #lisp
shifty has quit [Ping timeout: 240 seconds]
shka_ has joined #lisp
hendursa1 has joined #lisp
hendursaga has quit [Ping timeout: 240 seconds]
Cymew has joined #lisp
skapata has quit [Remote host closed the connection]
pve has joined #lisp
Fare has quit [Ping timeout: 260 seconds]
aaaaaa has quit [Quit: leaving]
arbv has quit [Ping timeout: 260 seconds]
Alloc has quit [Ping timeout: 240 seconds]
Alloc has joined #lisp
johnjay has quit [Ping timeout: 240 seconds]
arbv has joined #lisp
Alloc has quit [Ping timeout: 272 seconds]
johnjay has joined #lisp
dvdmuckle has quit [Ping timeout: 256 seconds]
Alloc has joined #lisp
FreeBirdLjj has joined #lisp
ljavorsk_ has joined #lisp
davepdotorg has joined #lisp
FreeBirdLjj has quit [Ping timeout: 265 seconds]
charlie770 has quit [Ping timeout: 240 seconds]
davepdotorg has quit [Remote host closed the connection]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
tekipeps[m] has quit [Quit: Idle for 30+ days]
anddam has left #lisp ["WeeChat 2.9"]
davepdotorg has joined #lisp
frgo_ has joined #lisp
dvdmuckle has joined #lisp
frgo has quit [Ping timeout: 240 seconds]
orivej has quit [Ping timeout: 265 seconds]
galex-713_ has quit [Ping timeout: 240 seconds]
galex-713 has joined #lisp
mmohammadi9812 has quit [Ping timeout: 246 seconds]
Alloc has quit [Read error: Connection reset by peer]
Alloc has joined #lisp
benjamin-l has joined #lisp
davepdotorg has quit [Remote host closed the connection]
mmohammadi9812 has joined #lisp
patchy has joined #lisp
jesse1010 has joined #lisp
davepdotorg has joined #lisp
gaqwas has quit [Remote host closed the connection]
davepdotorg has quit [Ping timeout: 256 seconds]
davepdotorg has joined #lisp
iissaacc has joined #lisp
Alloc has quit [Ping timeout: 265 seconds]
Alloc has joined #lisp
kaftejiman has joined #lisp
luckless has quit [Ping timeout: 240 seconds]
hendursa1 has quit [Ping timeout: 240 seconds]
luckless has joined #lisp
davepdotorg has quit [Remote host closed the connection]
davepdotorg has joined #lisp
OlCe has joined #lisp
gaqwas has joined #lisp
dvdmuckle has quit [Ping timeout: 240 seconds]
hendursa1 has joined #lisp
dvdmuckle has joined #lisp
luckless has quit [Ping timeout: 240 seconds]
iissaacc has quit [Ping timeout: 246 seconds]
saganman has quit [Quit: WeeChat 1.6]
luckless has joined #lisp
dbotton_ has joined #lisp
dbotton has quit [Ping timeout: 272 seconds]
oxum has joined #lisp
jw4 has quit [Read error: Connection reset by peer]
jw4 has joined #lisp
frost-lab has quit [Quit: Connection closed]
Bike has joined #lisp
ebrasca has joined #lisp
Nilby has quit [Read error: Connection reset by peer]
ljavorsk_ has quit [Remote host closed the connection]
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #lisp
oxum has quit [Remote host closed the connection]
oxum has joined #lisp
oxum has quit [Ping timeout: 258 seconds]
oxum has joined #lisp
oxum has quit [Remote host closed the connection]
oxum has joined #lisp
davepdotorg has quit [Remote host closed the connection]
EvW has joined #lisp
johnjay has quit [Ping timeout: 272 seconds]
Stanley00 has quit []
oxum has quit [Ping timeout: 272 seconds]
davepdotorg has joined #lisp
davepdotorg has quit [Ping timeout: 265 seconds]
jprajzne has joined #lisp
ech has joined #lisp
jonatack has quit [Ping timeout: 260 seconds]
davepdotorg has joined #lisp
davepdotorg has quit [Read error: Connection reset by peer]
davepdotorg has joined #lisp
wsinatra has joined #lisp
davepdot_ has joined #lisp
davepdotorg has quit [Ping timeout: 240 seconds]
oxum has joined #lisp
davepdot_ has quit [Read error: Connection reset by peer]
davepdotorg has joined #lisp
davepdotorg has quit [Read error: Connection reset by peer]
davepdot_ has joined #lisp
davepdot_ has quit [Ping timeout: 240 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
shenghi has quit [Quit: WeeChat 2.9]
amb007 has quit [Read error: Connection reset by peer]
shenghi has joined #lisp
amb007 has joined #lisp
mmohammadi9812 has quit [Quit: Quit]
mmohammadi9812 has joined #lisp
davepdotorg has joined #lisp
ex_nihilo has quit [Quit: Leaving]
patchy has quit [Ping timeout: 260 seconds]
aartaka has joined #lisp
aartaka_d has quit [Ping timeout: 256 seconds]
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #lisp
hendursaga has quit [Client Quit]
hendursaga has joined #lisp
shenghi has quit [Quit: WeeChat 2.9]
amb007 has quit [Read error: Connection reset by peer]
shenghi has joined #lisp
amb007 has joined #lisp
Fare has joined #lisp
bitmapper has quit [Quit: Connection closed for inactivity]
davepdotorg has quit [Remote host closed the connection]
__jrjsmrtn__ has joined #lisp
davepdotorg has joined #lisp
davepdotorg has quit [Ping timeout: 264 seconds]
FreeBirdLjj has joined #lisp
Kaisyu has quit [Quit: Connection closed for inactivity]
narimiran has quit [Ping timeout: 260 seconds]
jonatack has joined #lisp
davepdotorg has joined #lisp
cosimone has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Read error: Connection reset by peer]
jonatack has quit [Ping timeout: 260 seconds]
wsinatra_ has joined #lisp
wsinatra has quit [Read error: Connection reset by peer]
achilles has joined #lisp
achilles has quit [Client Quit]
dyelar has joined #lisp
<sm2n>
is there a way to get a compile warning when defining a function with a method call with an invalid method combination?
<sm2n>
for example (defmethod foo ((a float)) (print a)) (defun bar () (foo "something"))
<sm2n>
obviously this can't be an error, since you may define a valid method later, but it'd be nice to know if the method existed at the time of definition
<sm2n>
sbcl doesn't say anything
<beach>
sm2n: I see no mention of method combinations in your example.
<beach>
You probably means something else, like whether FOO has any applicable methods for the argument you are passing.
<beach>
sm2n: But that would require solving the halting problem. Consider (defun bar () (foo (ackermann 4 5)))
<sm2n>
beach, "applicable methods" is what I mean
<beach>
sm2n: Or, more direct (defun bar () (if <...> (foo 1.3) (foo "something")))
<sm2n>
in the ackermann case, you can still tell based on the type
<beach>
Not in general.
<beach>
You don't know what type the value returned by the function is unless you execute it, or solve the halting problem.
<sm2n>
yes, but it is possible on a best-effort basis
<sm2n>
sbcl already calculates return types to the best of its ability, I would just like it if that information was used here
<sm2n>
if your return type is T there's not a whole lot you can do
<sm2n>
but in every other case you should get some useful information
dyelar has quit [Quit: Leaving.]
davepdotorg has quit [Remote host closed the connection]
madage has quit [Ping timeout: 240 seconds]
<scymtym>
how would you define mutually recursive methods without getting a warning? as in (defmethod foo ((x string)) (if … (foo 1) …)) (defmethod foo ((x integer)) (if … (foo "") …))
dyelar has joined #lisp
<scymtym>
you could probably delay the warning until the end of the compilation unit, but it would be kind of hard to avoid unwarranted warnings in general
madage has joined #lisp
<sm2n>
if I were defining those interactively, I would consider the warning as desirable even in that case, and if you were working at the file level, the information necessary to suppress the warning should be available to the compiler
davepdotorg has joined #lisp
igemnace has joined #lisp
<sm2n>
sbcl already gives similar warnings for regular function calls
<scymtym>
for simple cases, sure. but it is really hard to know in advance which methods will be applicable when the call is executed
<_death>
with some styles, it's also quite common to compile calls to a generic function before any methods are added to it
shifty has joined #lisp
<sm2n>
I see
oxum has quit [Remote host closed the connection]
oxum has joined #lisp
igemnace has quit [Ping timeout: 240 seconds]
oxum has quit [Remote host closed the connection]
oxum has joined #lisp
shifty has quit [Ping timeout: 258 seconds]
shifty has joined #lisp
jonatack has joined #lisp
davepdotorg has quit [Remote host closed the connection]
davepdotorg has joined #lisp
rumbler31___ has joined #lisp
orivej has joined #lisp
patchy has joined #lisp
ebrasca has quit [Remote host closed the connection]
biglama has joined #lisp
<biglama>
Hi guys, I have a beginner question without answers on Google : how can a sort characters in a single string (Emacs lisp) ?
oxum has quit [Remote host closed the connection]
<biglama>
My closest attempt : (sort (vconcat "ba") #'string<)
<_death>
you can also see calling a generic function with no applicable methods as a normal thing, since by CLOS protocol, no-applicable-method gets called.. in many cases its default method is to signal an error, and there's nothing special going on
<Josh_2>
biglama this channel isn't for Elisp but Common Lisp
hineios has joined #lisp
<Josh_2>
but (sort <string> #'string<) works just fine in CL
<_death>
no, you need to compare characters.. and in elisp, characters are integers
toorevitimirp has quit [Remote host closed the connection]
EvW has quit [Ping timeout: 260 seconds]
aartaka has quit [Ping timeout: 246 seconds]
warweasle has joined #lisp
<warweasle>
How do I get cl-ppcre to match the beginning of a string?
<_death>
^?
ggole has joined #lisp
aartaka has joined #lisp
<warweasle>
"The symbols :START-ANCHOR, :END-ANCHOR, :MODELESS-START-ANCHOR, :MODELESS-END-ANCHOR, and :MODELESS-END-ANCHOR-NO-NEWLINE are equivalent to Perl's "^", "$", "\A", "\Z", and "\z" respectively."
hineios has joined #lisp
flazh has quit [Ping timeout: 260 seconds]
hineios has quit [Client Quit]
aartaka_d has quit [Ping timeout: 264 seconds]
davepdotorg has joined #lisp
<warweasle>
I think I figured it out...but it's weird.
<Bike>
what's weird about it
<Bike>
it's perl-compatible regexes, so the beginning of a string is ^, like perl
aartaka_d has joined #lisp
<dlowe>
(unless multi-line mode is enabled)
<dlowe>
(like perl)
<dlowe>
if you want to match the beginning of the string even with multiline mode, that's what \A is for
<warweasle>
^ didn't work.
<Bike>
how so?
<warweasle>
Ok. Maybe I'm just flustered but I swear it didn't match a few minutes ago."
aartaka has quit [Ping timeout: 264 seconds]
aartaka has joined #lisp
aartaka_d has quit [Ping timeout: 265 seconds]
<Josh_2>
warweasle: have you seen cl-str? it has a function called "starts-with"
aartaka_d has joined #lisp
<warweasle>
Josh_2: I'm trying to convert some filenames and directries into sql data...so I need regex power.
cosimone has joined #lisp
aartaka has quit [Ping timeout: 265 seconds]
hnOsmium0001 has joined #lisp
<Josh_2>
Okay cool, the library is very helpful for adding the trivial string manipulation you would find in other languages
rippa has joined #lisp
Cymew has quit [Ping timeout: 256 seconds]
Fare has quit [Ping timeout: 260 seconds]
Fare has joined #lisp
gareppa has joined #lisp
gareppa has quit [Remote host closed the connection]
dbotton has joined #lisp
dbotton_ has quit [Ping timeout: 240 seconds]
dbotton has quit [Ping timeout: 260 seconds]
dbotton has joined #lisp
davepdotorg has quit [Remote host closed the connection]
davepdotorg has joined #lisp
dbotton_ has joined #lisp
dbotton has quit [Read error: Connection reset by peer]
<semz>
On the topic of cl-ppcre, are there ways to add parse tree aliases with parameters? While I like the sexpr method, things like (:NON-GREEDY-REPETITION 0 1 "a") often make it less readable than the string version and define-parse-tree-synonym can apparently only create static parse trees and you can't seem to make shorthands like 'ngrep -> :non-greedy-repetition.
<semz>
Of course I could just calculate them at runtime, but that'd lock me out of the neat compiler macros.
<Bike>
doesn't look like it... it doesn't seem like it would be too difficult to extend the library with a more general macro system if one wanted
davepdotorg has quit [Remote host closed the connection]
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
IPmonger has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
Fare has quit [Ping timeout: 260 seconds]
biglama has quit [Ping timeout: 245 seconds]
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
flazh has joined #lisp
dbotton__ has joined #lisp
dbotton__ is now known as dbotton
Fare has joined #lisp
EvW has joined #lisp
davepdotorg has joined #lisp
rx_ has joined #lisp
cosimone has quit [Remote host closed the connection]
dbotton has quit [Ping timeout: 246 seconds]
narimiran has joined #lisp
rx_ has quit [Quit: Connection closed]
EvW has quit [Ping timeout: 240 seconds]
davepdotorg has quit [Ping timeout: 240 seconds]
dbotton has joined #lisp
space_otter has joined #lisp
<dbotton>
I noticed that I was able to change in place a constant list. SBCL through a warning which is nice. Is that techincaly a practice just fround upon or is it considered erroneous to do such a thing?
skapata has joined #lisp
<dbotton>
or maybe ok even to use?
<beach>
What practice is that?
<beach>
Changing anything in a constant list is undefined behavior.
<dbotton>
To change a memeber of a defconstant list
<dbotton>
ok
<beach>
It is not the DEFCONSTANT that matters. It has to do whether the list is literal data or not.
<beach>
Did you define it with '(...)?
<dbotton>
(defconstant c '(1 2 3 4))
<beach>
DEFCONSTANT is not behaving well when the value is something other than very simple objects.
<beach>
Then you are not allowed to modify it. And that is true even if it is assigned to a variable with DEFVAR or SETQ.
<dbotton>
(setf (nth 2 c) 5)
<beach>
Yes, you are not allowed to do that. But that is true even if you use DEFPARAMETER rather than DEFCONSTANT.
<dbotton>
I actually frist did a let then changed it and worked then tried out side of it
<dbotton>
what do you mean about defparameter?
<dbotton>
You can't change members?
<beach>
(defparameter c '(...)) would have the same restriction.
<beach>
It is not about DEFCONSTANT.
<beach>
It has to do with the fact that the list is literal.
<dbotton>
I got that, the data is the type, ie it is a constant list
<beach>
Using LET or SETQ to assign it first won't change that.
<dbotton>
because created with '
<beach>
Exactly.
<dbotton>
ok, so if I use (list 1 2 3) should be ok
<dbotton>
to change members?
<beach>
So if you do (defvar *l* '(a b c)) then (let ((l *l*)) (setf (car l) 234)) that is still undefined behavior.
<dbotton>
(if not bizarre that setf on nth would exist)
dbotton_ has quit [Ping timeout: 272 seconds]
<dbotton>
that is what I did first
<dbotton>
was part of another experiment I was working on
<beach>
You can do (defparameter *l* (list 'a 'b 'c))
<beach>
Then you can change the list, because it is not literal.
<beach>
So (SETF NTH) is still useful.
<dbotton>
ok and if it is a (defconstant c (list 1 2 3))
<beach>
Same.
<dbotton>
so can change then
<beach>
It has nothing to do with DEFCONSTANT or DEFPARAMETER. It has to do with whether the list is literal or not.
EvW has joined #lisp
<beach>
Here it isn't.
<beach>
But you really shouldn't use lists with DEFCONSTANT.
<dbotton>
got a warning
ggole has quit [Quit: Leaving]
<dbotton>
with defconstant on sbcl
<dbotton>
so sbcl is giving same warning in both cases
<dbotton>
I would think then should be different
<beach>
What is the warning and what are the two cases?
<dbotton>
; in: SETF (NTH 2 E)
<dbotton>
;
<dbotton>
; (SB-KERNEL:%RPLACA #:LIST #:NEW)
<dbotton>
; Destructive function SB-KERNEL:%RPLACA called on constant data: (3 4)\
<dbotton>
; caught WARNING:
<dbotton>
that is defconstant
<dbotton>
; in: SETF (NTH 2 *C*)
<dbotton>
;
<dbotton>
; (SB-KERNEL:%RPLACA #:LIST #:NEW)
<dbotton>
; caught WARNING:
<dbotton>
; Destructive function SB-KERNEL:%RPLACA called on constant data: (4 4)
<semz>
it's worth mentioning that there are implementations out there which misbehave silently if you modify a literal list, such as CCL
<semz>
try this on for size: (defun test () (let* ((n 10) (x `(,n 2 3)) (y `(,n 2 3))) (list (nconc x y) x y)))
<semz>
and call it twice
<dbotton>
that second one was from defconstant with literal
<dbotton>
first was with (list)
<beach>
SBCL is inconsistent as well because there is no warning on (SETF CAR), at least not in the version I am using.
eddof13 has joined #lisp
<dbotton>
the issue I a=have is that in both cases saying that I am modifiy constant data
<dbotton>
In one case yes in other no
<dbotton>
the non literal version is not constant data, just a constant reference
<dbotton>
(at least that is my thought as was trying to see if could do)
<beach>
What?
<beach>
What is a constant reference, and how is it not constant data?
<beach>
There is no such thing as "constant data". The term is "literal". When you construct a list with '(...) then the entire list is literal and you are not allowed to modify any part of it.
<dbotton>
the defconstant is saying that I am refering to a specific list - one list is itself constant, a literal the other version is built with (list) so not constant
<dbotton>
so those two messages are for the two versions 1 defconsant to literal and 2 defconstant to non-literal
<dbotton>
semz will try soon, thanks
<beach>
Maybe you should ask #sbcl why you observe this behavior. Either way, using DEFCONSTANT with a list is a very bad idea.
<Bike>
you know i don't actually see anything in the standard saying mutating a value bound to a constant is illegal
<dbotton>
that was the original question :) so thanks :)
<Bike>
i can see why you'd not want to do that, of course
dbotton_ has joined #lisp
<dbotton>
ie don't do it at all
<dbotton>
Bike, so far nothing I have seen says that either
<_death>
defconstant mean the binding is constant
<dbotton>
exactly
<dbotton>
not the data
<dbotton>
that was what I was trying to see
<Bike>
i mean, for real though, don't write programs relying on the ability to mutate constants, that's just a mess
<dbotton>
I was thiking that if I wanted a constant binding to non constant data maybe ok
warweasle has left #lisp ["Killed buffer"]
cl-arthur has quit [Read error: Connection reset by peer]
cl-arthu1 has joined #lisp
<_death>
dbotton: defconstant is not meant for complex data.. mostly for numbers/characters/symbols.. for more complex objects you should use defvar
<dbotton>
and rely on people respecting it as a constant
<dbotton>
lisp is very trusing of its developers :)
<_death>
yes, in lisp you trust the programmer
<_death>
and when your constant changes, as constants sometimes do, you won't have to recompile everything
<dbotton>
I guess could have a package and call it "constants" to make it harder or more obvious
<Alfr>
Defconstant is also useful when you need a place for some sentinel value.
<beach>
Or use DEFPARAMETER but give it a name like +mumble+.
<beach>
Maybe that would be too confusing.
<dbotton>
well the idea that one has to use myapp-const:something I like better then just a naming convention
<dbotton>
but point is same, just a name
<dbotton>
or :: rather as exported
amk has joined #lisp
amk has joined #lisp
amk has quit [Changing host]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
cl-arthu1 has quit [Remote host closed the connection]
cl-arthur has joined #lisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
dbotton__ has joined #lisp
dbotton has quit [Ping timeout: 240 seconds]
dbotton_ has quit [Ping timeout: 260 seconds]
dbotton has joined #lisp
dbotton__ has quit [Read error: Connection reset by peer]
q3d has joined #lisp
patchy has quit [Ping timeout: 272 seconds]
q3d has left #lisp [#lisp]
q3d has joined #lisp
q3d has quit [Remote host closed the connection]
dbotton__ has joined #lisp
amk has quit [Remote host closed the connection]
amk has joined #lisp
amk has quit [Changing host]
amk has joined #lisp
dbotton__ is now known as dbotton_
<dbotton_>
sorry ':' - sorry one : for the exported symbols
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
bocaneri has quit [Read error: Connection reset by peer]
ljavorsk has joined #lisp
liberliver has quit [Ping timeout: 256 seconds]
shifty has joined #lisp
Colleen has quit [Quit: Colleen]
oxum has quit [Remote host closed the connection]
Colleen has joined #lisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
rpg has joined #lisp
aartaka_d has quit [Ping timeout: 258 seconds]
Aurora_v_kosmose has quit [Quit: bbl]
dbotton_ has quit [Ping timeout: 240 seconds]
dbotton_ has joined #lisp
cer0 has quit [Quit: hungry...]
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #lisp
heisig has quit [Quit: Leaving]
EvW has quit [Ping timeout: 260 seconds]
<dlowe>
I pretty much always use defparameter over defconstant
<dlowe>
with plus-muffs
aartaka has joined #lisp
mmohammadi9812 has quit [Read error: Connection reset by peer]
mmohammadi9812 has joined #lisp
<dlowe>
veritas aeternum sed tempus est varationem
dbotton__ has joined #lisp
dbotton_ has quit [Ping timeout: 256 seconds]
EvW has joined #lisp
rogersm has joined #lisp
mmohammadi9812 has quit [Read error: Connection reset by peer]
mmohammadi9812 has joined #lisp
dbotton__ is now known as dbotton_
shifty has quit [Ping timeout: 240 seconds]
shifty has joined #lisp
<dbotton_>
semz, sbcl catches that with a warning that it modifies constant data even before running
Nilby has joined #lisp
<dbotton_>
but that would be expected, as playing with list literals
<dbotton_>
Is there a rationale for having literals or just about optimizations?
akoana has joined #lisp
arpunk has quit [Read error: Connection reset by peer]
luckless has quit [Remote host closed the connection]
luckless has joined #lisp
niceplace has quit [Ping timeout: 272 seconds]
dbotton_ has quit [Ping timeout: 272 seconds]
hiroaki has joined #lisp
dbotton_ has joined #lisp
<dbotton_>
what is even more interesing is that (constantp '(1 2 3)) is nil
<dbotton_>
what is that?
<dbotton_>
why is that? (sorry)
<semz>
dbotton_, well my point was that you can't rely on the warnings even in mature implementations
<semz>
constantp is for use in macros primarily
<semz>
so it's checking if (1 2 3) is a constant form (which it isn't)
<dbotton_>
it does return t for a number for example
<semz>
note that (constantp ''(1 2 3)) would be T
niceplace has joined #lisp
<Bike>
constantp checks if forms are constant
<Bike>
(1 2 3) as code signals an error since there's no 1 function
<Bike>
it does not check if data is literal
gaqwas has quit [Remote host closed the connection]
niceplace has quit [Read error: Connection reset by peer]
<dbotton_>
Bike but it does return 2 for #2A((A 2) (3 4))
<dbotton_>
So not sure I understand why it doesn't for '(1 2 3)
<Bike>
yes, because literals are self evaluating forms
<Bike>
you pass constantp a form. something to evalaute
narimiran has quit [Ping timeout: 246 seconds]
<Bike>
if you throw (1 2 3) in your repl it's an error. what you mean is probably (constantp ''(1 2 3)) like semz said
<dbotton_>
so what does the second quote do?
<Bike>
it quotes the quotation
<dbotton_>
I am not getting the difference then between '(1 2 3) and #2A((A 2) (3 4))
<Alfr>
dbotton_, the first gets eaten by the reader and then constantp gets to see (quote (1 2 3)).
<Bike>
try (eval '(1 2 3))
<Bike>
it's an error. you're passing it a form that's a call to the function "1" with arguments 2 and 3. that's invalid
wsinatra_ has quit [Quit: WeeChat 2.9]
<Alfr>
dbotton_, the first is a list abd the second gives you an array.
<Bike>
(eval #2a((a 2) (3 4))) is fine, because arrays evaluate to themselves
<Bike>
lists do not evaluate to themselves, since they represent code
<dbotton_>
ok, so it is not a literal object until the operator quote turns it in to one after and that is constant
<Bike>
no. ok, look, lisp code is evaluated, right? by the eval function, more or less
<Bike>
you pass eval an object and it runs the evaluation rules.
<dbotton_>
ok
<_death>
no, it is a literal object.. quote just returns it without evaluating
<Bike>
all quote means is that (eval (quote anything)) => anything.
<Bike>
Now if you evaluate, say, (eval '(+ 1 2)), you need that extra quote there because EVAL is a normal function and its arguments are evaluated before the function is called.
<Bike>
the quote means that the eval function receives the list of +, 1, 2.
<Bike>
If you just write (eval (+ 1 2)), that's the same as just (eval 3), eval gets a 3 rather than a list.
<Bike>
So if you write (eval '(1 2 3)), eval receives a list of 1, 2, 3 as an argument, and that's not valid lisp code.
<dbotton_>
got is so constantp is evaluating that '(1 2 3) to (1 2 3) and ''(1 2 3) to the literal '(1 2 3)
<dbotton_>
which is the contant form
<Bike>
constantp receives a form as its argument much like eval, so if you write (constantp '(1 2 3)), you're passing the form that's the list 1, 2, 3, which as with eval is invalid.
Josh_2 has quit [Ping timeout: 264 seconds]
<dbotton_>
ah so not even that it is not a constant is invalid
<dbotton_>
ie it is passing a code form not a data form
<_death>
CONSTANTP does not evaluate anything.. it tells you (maybe) if the form it got would always return the same object.. in fact it's a very tricky function and often misused
<Bike>
yeah, constantp analyzes forms. there's no guarantee that literal objects are distinguishable from other objects in any way at runtime anyway
shifty has quit [Ping timeout: 256 seconds]
<Alfr>
dbotton_, sorry, some lines above I meant gets eaten by eval, not the reader.
bitmapper has joined #lisp
niceplace has joined #lisp
niceplaces has joined #lisp
<_death>
for example if you have a constant (defconstant foo 42), at compile-time (constantp 'foo) will return true, but that does not mean you can get the value of foo.. lisp may know foo is a constant, but not yet know its value until later on.. then again, on another implementation it may know the value
luckless has quit [Remote host closed the connection]
luckless has joined #lisp
<sjl_>
I'm not sure I've ever figured out how to actually *use* constantp correctly... ever.
niceplace has quit [Ping timeout: 256 seconds]
Aurora_v_kosmose has joined #lisp
gaqwas has joined #lisp
gaqwas has joined #lisp
gaqwas has quit [Changing host]
<_death>
sjl: I guess it's useful if you want to know whether a symbol is a constant.. for example so that you don't generate something that binds it
<_death>
(instead you can signal an error at compile time)
<dbotton_>
Thanks I think finally got it, and the difference, and why
<dbotton_>
Still though don't know rational for having the literal forms other then optimization
<sjl_>
interesting
<_death>
dbotton: yes, it's for optimization
<dbotton_>
thanks appreciated
<_death>
for example why should (member foo '(yes no)) keep creating yes-no lists?
niceplace has joined #lisp
niceplaces has quit [Ping timeout: 240 seconds]
<sjl_>
I still don't really understand how to use it for non-symbol things then. E.g. in SBCL (constantp (list '+ 1 2)) is true, but if I were trying to do something like... unroll a looping form if N is small, I'd need to (eval ...) that thing first, right?
<sjl_>
And SBCL will also return T for constantp of something involving e.g. a symbol-macrolet'ed thing, so you need to sb-cltl2:macroexpand-all too... and I'm just not confident at all that I'd be doing all the necessary dances
<_death>
well, bad example because it doesn't have to do with multiple copies.. in fact that would've been broken.. it's optimization in the sense that these literals can be coalesced and otherwise share structure
<_death>
sjl: so this has the exact issue I mentioned.. the value may not be available at the time you EVAL
<sjl_>
right
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<sjl_>
So there's just no way to do something like this, right?
<_death>
sjl: I just go with stupid checks like INTEGERP
<sjl_>
I mean, obviously you can integerp in the macro
<sjl_>
Yeah
<sjl_>
That will catch some of the cases, not all though
niceplace has quit [Ping timeout: 240 seconds]
<_death>
if the value is unavailable, the macro can't do anything
niceplace has joined #lisp
<sjl_>
and there's no availablep so... welp
<_death>
there's boundp I guess
rogersm has quit [Remote host closed the connection]
rogersm has joined #lisp
rogersm has quit [Remote host closed the connection]
oxum has joined #lisp
rogersm has joined #lisp
<_death>
then constantp could be useful too, because if it's a boundp symbol and not a constant, you don't want to unroll
shka_ has quit [Ping timeout: 256 seconds]
rogersm has quit [Ping timeout: 240 seconds]
rogersm has joined #lisp
dbotton_ has quit [Quit: Leaving]
<Bike>
constantp needs a constant-form-value, like sbcl has internally
<phoe>
Bike: do other implementations have something like that?
rogersm has quit [Remote host closed the connection]
rogersm has joined #lisp
* phoe
hints for a possible portability library
<Bike>
i put one in clasp. other than that, dunno, probably not
rogersm has quit [Remote host closed the connection]
<Bike>
it should be pretty straightforward to implement, tho
rogersm has joined #lisp
rogersm has quit [Read error: Connection reset by peer]
rogersm has joined #lisp
madage has quit [Ping timeout: 240 seconds]
<_death>
sjl: btw, I see you're still going through rosalind.. learned about it (last year) from your plan file.. it was fun
<Nilby>
Wow. Thanks _death and sjl_ for shining some light into this dark corner, and digging up the quux quote. I've really never understood constantp, so I never used it.
<sjl_>
_death: Ah nice. Yeah our book club at work is going through the Bioinformatics textbook the Rosalind authors wrote
<sjl_>
So hopefully I'll have more motivation to finish all the exercises in the book this time, ,hah.
<_death>
sjl: cool.. I didn't read any text book.. but some tasks had me reading papers
<sjl_>
Part of me wants to sit down and write an efficient DNA/RNA seq representation in CL... but that's kind of a rabbit hole and Rosalind examples are all tiny, so I've just been using vanilla CL strings and sequence functions.
<Bike>
would it not just be an (unsigned-byte 2) vector
<_death>
rosalind.lisp 6310 lines
<sjl_>
That's one option, but it's not quite that simple.
<Bike>
phoe: i see an eval-constant in ccl, but it doesn't take an env argument.
<sjl_>
E.g. FASTQ files in the real world often have `N` as a base which means "don't know"
dbotton_ has joined #lisp
<sjl_>
So (vector (unsigned-byte 2)) can't handle those
<Bike>
oh, yeah that makes sense.
<_death>
sjl: there was no need to use a special representation
<sjl_>
I read somewhere about using (unsigned-byte 4) to represent a base, where each base has a bit
<Bike>
phoe: also it seems mildly out of wack iwth constantp, in that constantp... it looks like it tries to handle lexical constants or something?
<Bike>
sjl_: in general you'd have, what, like, probabilities? sounds tricky
<sjl_>
which lets you represent "this base could be any one of A, C, T" as 1101, and comparing bases with logand treats it as a wildcard
<_death>
of course some problems require special representations, but in general I just used strings
<sjl_>
well, quality scores are a whole other kettle of fish
dbotton has quit [Ping timeout: 240 seconds]
<sjl_>
_death: yeah Rosalind's test data is small enough that strings seem fine
<_death>
I think the toughtest problems (for me) were cntq, mult, and qrtd
<sjl_>
Yeah, I haven't done those yet. Some day!
<Nilby>
it feels weird to push around electrons so brutally, just to have superpowers over something they do naturally. If only one could elide the quantum and atomic levels.
oxum has quit [Ping timeout: 260 seconds]
kaftejiman has quit [Remote host closed the connection]
madage has joined #lisp
tankrim has joined #lisp
rogersm has quit [Remote host closed the connection]
rogersm has joined #lisp
dra has joined #lisp
shifty has joined #lisp
rogersm has quit [Ping timeout: 272 seconds]
dra has quit [Remote host closed the connection]
idxu has quit [*.net *.split]
glamas has quit [*.net *.split]
hdasch has quit [*.net *.split]
brass has quit [*.net *.split]
HiRE_ has quit [*.net *.split]
eagleflo has quit [*.net *.split]
eagleflo has joined #lisp
glamas has joined #lisp
idxu has joined #lisp
HiRE has joined #lisp
pve has quit [Quit: leaving]
brass has joined #lisp
hdasch has joined #lisp
rpg has quit [Ping timeout: 264 seconds]
nckx has quit [Ping timeout: 264 seconds]
nckx has joined #lisp
dbotton has joined #lisp
mmohammadi9812 has quit [Ping timeout: 240 seconds]
madage has quit [Remote host closed the connection]
madage has joined #lisp
dbotton_ has quit [Ping timeout: 258 seconds]
sjl_ has quit [Ping timeout: 240 seconds]
Bike has quit [Quit: leaving]
yottabyte has quit [Quit: Connection closed for inactivity]
remexre has quit [Read error: Connection reset by peer]