<thmprover>
Evaluating it throws errors, but (equal? (var 'x) (var 'x)) returns T, so I'm thinking something is amiss with my '(every equal? (fn-args lhs) (fn-args rhs))' code.
<Bike>
yes, that should be (every #'equal? ...)
<Bike>
there ar eseparate variable and function namespaces.
cosimone has quit [Ping timeout: 260 seconds]
<thmprover>
Egads, I completely messed that up, thanks, that fixes everything.
<Josh_2>
Well I don't think asdf:perform is even being called ¯\_(ツ)_/¯
asarch has quit [Quit: Leaving]
orivej has quit [Ping timeout: 240 seconds]
<thmprover>
Awesome, that works, thanks.
shifty has quit [Ping timeout: 240 seconds]
leo_song has joined #lisp
madage has quit [Remote host closed the connection]
madage has joined #lisp
galex-713 has quit [Read error: Connection reset by peer]
EvW has quit [Ping timeout: 244 seconds]
Blukunfando has joined #lisp
karlosz has quit [Ping timeout: 260 seconds]
daphnis has quit [Ping timeout: 260 seconds]
rgherdt has quit [Ping timeout: 272 seconds]
EvW has joined #lisp
akoana has joined #lisp
Inline has quit [Ping timeout: 272 seconds]
galex-713 has joined #lisp
lucasb has quit [Quit: Connection closed for inactivity]
bitmapper has joined #lisp
abhixec has joined #lisp
johnjay has quit [Ping timeout: 264 seconds]
froggey has quit [Ping timeout: 272 seconds]
froggey has joined #lisp
johnjay has joined #lisp
semz has quit [Quit: Leaving]
dhil has quit [Ping timeout: 260 seconds]
<srandon111>
hello beach
catchme has quit [Quit: Connection closed for inactivity]
dim has joined #lisp
EvW has quit [Ping timeout: 260 seconds]
Lord_of_Life_ has joined #lisp
<Kabriel>
Xach: I figured. Do you have a way you look through packages, or do you have them all 1500 memorized!
wxie has joined #lisp
Lord_of_Life has quit [Ping timeout: 256 seconds]
shifty has joined #lisp
rumbler31 has quit [Read error: Connection reset by peer]
rumbler31 has joined #lisp
<srandon111>
guys what is a good comparison between common lisp and clojure ? i know about lisp-1 and lisp-2 difference but i mean with respect to other things... like from what i understood clojure has a lot of 3rd party libraries, but still relies on the JVM and has big startup times... it's a modern lisp... while common lisp is more ancient but compiles standalone binaries hence we should have a gain in performance... what are other differences?
<srandon111>
i saw that clojure is more functional oriented while lisp does not enforce a style
Alfr_ is now known as D_x
<Josh_2>
more ancient?
<Josh_2>
:think:
D_x is now known as Alfr
<no-defun-allowed>
What is modern?
<moon-child>
srandon111: performance is a complicated topic, and I don't think that it makes sense to say that cl's is *better*. Their performance profiles are different
<no-defun-allowed>
As far as I can tell (welcome to #lispcafe philosophy club), the concept of progress is maximising agency. So Common Lisp is much more modern in that regard.
<no-defun-allowed>
...and most "modern" languages are thus anything but.
<Josh_2>
well It's not #lispcafe so lets not get into that
<no-defun-allowed>
Okay, there are some places where mutable data structures are faster than their immutable counterparts.
<no-defun-allowed>
You also have a very good numeric tower in Common Lisp, including bignums, ratios and complex numbers.
<Josh_2>
the difference is simple, CL = based, Clojure = cringe
<Josh_2>
I can't make it anymore clear
<no-defun-allowed>
(On the other hand, immutable data structures are a bit easier to reason about concurrently, but e.g concurrent hash tables kick butt, and are a bit "transactional" in that you can replace a mapping assuming the value of the previous mapping, so reasoning about them is still very doable.)
<no-defun-allowed>
srandon111: It isn't too wrong to assume that when someone mentions a "modern" programming language, they have no idea what they are talking about.
<srandon111>
no-defun-allowed, what does it mean to maximise agency???
<lotuseater>
Josh_2: i think timeless is a better adjective
<srandon111>
no-defun-allowed, also what is the last update to sbcl ?
<no-defun-allowed>
srandon111: SBCL is updated monthly, but the updates theoretically shouldn't matter. Any Common Lisp implementation implements the same language, and several agreed upon extensions.
<no-defun-allowed>
srandon111: What I mean by "agency" is that you're capable of doing more things in the language, and to some extent that such things are actually feasible.
kaftejiman has quit [Remote host closed the connection]
<srandon111>
no-defun-allowed, does common lisp has modules/libraries for machine learning or developing neural nets ?
<srandon111>
also what books would you suggest to start ?
<no-defun-allowed>
CLML has quite a few machine learning algorithms.
<no-defun-allowed>
minion: tell srandon111 about Practical Common Lisp
<minion>
srandon111: look at Practical Common Lisp: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<srandon111>
no-defun-allowed, so should i start with practical common lisp? are there other resources i should be aware before starting ?
<no-defun-allowed>
I think that is usually a good recommendation. But if that becomes difficult, then A Gentle Introduction to Symbolic Computation is also handy.
<lotuseater>
yeah there's a new edition from 2014
judson_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
johnjay has quit [Ping timeout: 240 seconds]
johnjay has joined #lisp
johnjay has quit [Read error: Connection reset by peer]
<srandon111>
is it hard to do graphic shit with cl ?
<lotuseater>
srandon111: i think there are several possibilities. what exactly do you mean?
<srandon111>
land of lisp does something graphical
<srandon111>
?
<srandon111>
lotuseater,
<srandon111>
lotuseater, what is CEPL ?
<lotuseater>
CEPL is a library that generates opengl code
<lotuseater>
and yes, land of lisp is wonderful, the graphical stuff is in the terminal
<lotuseater>
the youtube link i gave above is the first video about CEPL from its creator
Ekho has joined #lisp
<srandon111>
lotuseater, i see he has a lot of playlists they seem very useful
<srandon111>
like pushing pixels with lisp
<srandon111>
lotuseater, what do you mean the graphics is in the terminal ? like ascii ?
<srandon111>
just using ascii chars in the terminal ?
<lotuseater>
yes
<lotuseater>
in land of lisp you have text adventures, ascii in terminal, and generating svgs
<lotuseater>
if you want to make somethin ncurses like there is the croatoan lib :)
galex-713 has quit [Quit: No Ping reply in 180 seconds.]
<srandon111>
lotuseater, i don't know what croatoan is
<srandon111>
is there any good example of cli app made in lisp on github?
<lotuseater>
okay then i was not explicit enough. it is the CL lib for doing stuff like with ncurses
<srandon111>
okok
<srandon111>
lotuseater, thanks
<lotuseater>
yes maybe some other people have in mind other stuff
galex-713 has joined #lisp
<Josh_2>
lotuseater: based is often a synonym for timeless
karayan has quit [Read error: Connection reset by peer]
karayan has joined #lisp
<lotuseater>
Yes, it should not contradict you either. :)
austincummings[m has quit [*.net *.split]
MrtnDk[m] has quit [*.net *.split]
h11 has quit [*.net *.split]
no-defun-allowed has quit [*.net *.split]
gjnoonan has quit [*.net *.split]
abbe_ has quit [*.net *.split]
jlpeters has quit [*.net *.split]
penguwin has quit [*.net *.split]
chewbranca has quit [*.net *.split]
mgsk has quit [*.net *.split]
ffwacom has quit [*.net *.split]
heredoc has quit [*.net *.split]
gingerale has quit [*.net *.split]
thonkpod has quit [*.net *.split]
larme has quit [*.net *.split]
russell-- has quit [*.net *.split]
<mister_m>
is redefining a struct considered undefined behavior? I know that inside of CLOS there are mechanisms to update object instances, but no such mechanisms exist for struct instances, is that correct?
heredoc has joined #lisp
<lotuseater>
yes normally i get an error if trying that
h11 has joined #lisp
mgsk has joined #lisp
austincummings[m has joined #lisp
abbe_ has joined #lisp
jlpeters has joined #lisp
chewbranca has joined #lisp
penguwin has joined #lisp
ffwacom has joined #lisp
MrtnDk[m] has joined #lisp
gingerale has joined #lisp
thonkpod has joined #lisp
no-defun-allowed has joined #lisp
gjnoonan has joined #lisp
russell-- has joined #lisp
larme has joined #lisp
<Bike>
"The consequences of redefining a defstruct structure are undefined. " on clhs defstruct
<mister_m>
that's pretty definitive :)
<lotuseater>
ah okay then specific implementation dependent :) on SBCL it's a SIMPLE-ERROR "incompatible with the current definition"
<mister_m>
if I want to - for example - add a field to the struct when at the repl, how do I do this without making things all wonky
<Bike>
use defclass instead.
<mister_m>
let's say that is not an option
<Bike>
like, for real. defstruct is the fast one with packed storage, and to do that it can't be redefinable.
<lotuseater>
you can have simple inheritance on your current struct and add the new slots
<Bike>
it might work if you also redefine every function or other thing that refers to the structure definition.
igemnace has quit [Remote host closed the connection]
<lotuseater>
from experimenting it worked to make (makunbound 'struct-name) and initializing the new
<Bike>
makunbound has nothing to do with struct definitions
<Bike>
i just did (defstruct foo) (makunbound 'foo) (defstruct foo bar) in sbcl and yep, error.
<lotuseater>
i didn't say so
wxie has quit [Ping timeout: 240 seconds]
<lotuseater>
hm okay wait, how did i do it then ...
penguwin has quit [Max SendQ exceeded]
<mister_m>
for some context I am working on steve losh's chip-8 tutorial where they posit that struct accessors make a big difference in performance -- I don't know to what degree this is true but it uses a struct as the basis of the eumlator
penguwin has joined #lisp
<lotuseater>
oh I like that blog post! learned much from it :3
<Bike>
yes, structs can actually be more performant, but they do that by sacrificing redefinability.
abhixec has quit [Ping timeout: 260 seconds]
<Bike>
if you're prototyping something you can use an equivalent defclass temporarily, and then when you've figured everything out make it a defstruct.
<mister_m>
that was my exact next question
<lotuseater>
good advise Bike
<mister_m>
that seems like a reasonable thing to do while I am in the more interactive phase
perrier-jouet has quit [Quit: WeeChat 2.9]
arbv has quit [Ping timeout: 240 seconds]
dim has quit [Ping timeout: 240 seconds]
urek has quit [Ping timeout: 272 seconds]
karayan has quit [Ping timeout: 265 seconds]
karayan has joined #lisp
arbv has joined #lisp
<beach>
Good morning everyone!
Alfr_ has joined #lisp
MichaelRaskin has quit [Ping timeout: 240 seconds]
Alfr has quit [Ping timeout: 244 seconds]
dim has joined #lisp
wxie has joined #lisp
yonkunas has quit [Quit: Connection closed for inactivity]
enrioog has quit [Remote host closed the connection]
enrioog has joined #lisp
<jackdaniel>
mister_m: make a macro define-class that expands to defstruct when :foolhardy is in the *features*, and to defclass otherwise
<jackdaniel>
you may also have an "extension slot" where you put your afterthought data on a plist
<jackdaniel>
(defstruct foo a b c extension-plist)
<no-defun-allowed>
pyc: I think that is referring to the main SLIME REPL
<pyc>
no-defun-allowed: Why does it then say, "To load the REPL use (add-to-list 'slime-contribs 'slime-repl) in your .emacs." I did add that line to my ~/.emacs.d/init.el and yet I got the exact same REPL that I would get without that line.
<beach>
My guess is that the repl didn't use to be enabled by default, so that then you had to enable it explicitly, but now it is enabled by default.
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
shka_ has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
hendursa1 has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
amb007 has quit [Read error: Connection reset by peer]
hendursaga has quit [Ping timeout: 240 seconds]
amb007 has joined #lisp
narimiran has quit [Ping timeout: 240 seconds]
nij has joined #lisp
<nij>
Hello! While working with elisp in emacs, it's easy to get to the docstring and definition of any symbol. Is there something similar in common lisp?
<phoe>
but to be honest, I use DESCRIBE much more often than I use DOCUMENTATION
<ck_>
also in slime, there's C-c C-d d (and C-c C-d h to look up the hyperspec entry)
<phoe>
there's also lambda list and other information printed in the symbol description
<nij>
hmm I haven't had slime set up yet. Lemme try in my terminal.
<phoe>
do set it up
<phoe>
having a toolkit like slime or sly is essential to programming interactively in Common Lisp
<phoe>
without it you have no easy way to send forms or whole files for compilation/definition/redefinition and you have no independent debugger/inspector or source tracking
karayan has quit [Ping timeout: 246 seconds]
dim has quit [Ping timeout: 240 seconds]
karayan has joined #lisp
<nij>
I see
<nij>
I ran (documentation 'setf) in sbcl and got error
<nij>
Wait.. any working minimal example for 'documentation?
<phoe>
so you can interpret LOOP as being defined via standard CL:DEFMACRO.
<nij`>
I see. (I don't know cl:xyz either.)
<nij`>
so 'cl:defmacro and 'defmacro are different?
<phoe>
as for the second problem, I usually solve it slightly differently
rgherdt has joined #lisp
<phoe>
I start typing the symbol I want into the REPL, and then I use company-mode to find me the match I am looking for
<phoe>
then I M-. on it
<ck_>
you can set slime-complete-symbol-function to 'slime-fuzzy-complete-symbol, and that'll give you a probably similar type of tab-completion, you need to put slime-fuzzy into the setup for that too
<phoe>
nij`: are you aware of how CL packages work?
<phoe>
forgive the unfortunate document name, but the contents are very good
<nij`>
Seems a good fit to me!
<nij`>
I'm the complete idiot xD
<phoe>
basically, symbols in CL are organized in packages, *UNLIKE* in elisp
<phoe>
summing up a real lot, a package is a named collection of symbols.
<phoe>
and when symbols are created, they are usually interned into packages.
<nij`>
What does this have to do with cl:defmacro?
<nij`>
s/cl/'cl
<phoe>
usually, when you write DEFMACRO, you usually want to refer to the symbol named DEFMACRO from the CL package
<phoe>
this is done because a package can use other packages, inheriting its exported symbols into itself.
<nij`>
OH.
<phoe>
so when you are in package CL-USER, writing DEFMACRO refers to the symbol DEFMACRO inherited from CL
<nij`>
So writing defmacro is sometimes ok, but not specific enough?
<phoe>
most of the time it's OK
<nij`>
Nice!
<phoe>
but it's also context-dependent
<phoe>
because your package doesn't need to use the CL package
vegansbane has joined #lisp
<phoe>
so DEFMACRO does not need to refer to CL:DEFMACRO all the tiem.
<phoe>
time.*
<nij`>
But that shouldn't prevent M-. teaching me what and where 'sb-xc:defmacro is..
<nij`>
It should lead me to the the code block where 'defmacro is defined in the sb-xc package
<phoe>
DEFMACRO is the macro for defining macros
<phoe>
and you're already diving into the implementation bootstrapping territory
<phoe>
notice that you have a circularity there
<phoe>
most of the time you cannot really (DEFMACRO DEFMACRO ...) because if you write such code, you don't have DEFMACRO that is required to define DEFMACRO
<nij`>
lemme try another one prefixed by sb-xc..
<phoe>
maybe try (mapcar #'1+ '(1 2 3 4 5))!
<nij`>
Yep it works.
<phoe>
that's going to give you something that doesn't require sb-xc
<phoe>
but is still crunchy to understand
<phoe>
that's because it's implementation internals, symbols from the CL package are allowed to be complicated
<phoe>
here's defmacro which is a less complicated beast. but some people claim it's fun to use once you get used to it.
<_death>
or not just newbies, but non sbcl developers
<phoe>
^
<nij`>
<3
<nij`>
Why does M-. defun take me to defun-expander
<phoe>
because this is how defun is implemented inside SBCL
<nij`>
(M-. defun <RET>)
<phoe>
note that a little bit below you have sb-xc:defmacro defun
<nij`>
Oh.... this one is new to me. But I don't mind the details now. :)
<no-defun-allowed>
defun-expander increases the volume of de fun.
<ck_>
are you looking for details on your compiler though, or do you want to look at the language specification?
<nij`>
phoe: indeed. Why didn't M-. defun bring me to sb-xc:defmacro defun then?
<phoe>
it's a common trick to use separate functions while defining macros, because those help with readability in case of large macros.
<nij`>
ck_: I'm just fiddling around :D
<nij`>
I see @@
<phoe>
nij`: I guess that's because DEFMACRO DEFUN just directly calls DEFUN-EXPANDER
<phoe>
so SBCL just saved you another M-. this way.
<nij`>
Not really a fan of this auto feature..
<phoe>
as I said, it is most useful when writing Lisp code written by people
<nij`>
But fine :)
<ck_>
nij`: I see. For looking at the spec, you can use C-c C-d h (if you have a browser set up in emacs) on common lisp symbols which will take you to the corresponding page. Which will help for notes on how to use loop, for example, more than looking at the source
<phoe>
not the subset-of-Lisp-code that is used in implementation making
<phoe>
because, as _death noticed, the latter is going to look obfuscated pretty often
dim has joined #lisp
<nij`>
C-c C-d h is nice trick
<nij`>
Fine. I think I can start messying around :)
<nij`>
Thanks folks!
<phoe>
good luck! and feel free to visit here or #clschool for answers to your questions
<nij`>
:) :)
nij` has left #lisp ["ERC (IRC client for Emacs 27.1)"]
<phoe>
yes, that's because SICL attempts to write Common Lisp in Common Lisp
<phoe>
but it's a work-in-progress, still.
<moon-child>
implementing mapcar with loop...interesting choice
<beach>
Thanks. :)
<_death>
phoe: that's an opportunity for a newbie :)
<moon-child>
it seems to me that it would be easy enough to implement mapcar without loop; but that loop, being more complex, would benefit more from a preexisting implementation of mapcar
<moon-child>
beach: :)
<beach>
LOOP expands to TAGBODY, so it is really simple.
<flip214>
MAPCAR should be implemented via TAGBODY, as any old BASIC specialist (or low-level assembler) would tell you
<beach>
moon-child: You can't really implement LOOP with mapcar, unless you do it only for the special case where it applies.
<phoe>
tagbody should be implemented with delimited continuations since that's the best existing scheme for it
* phoe
hides
<moon-child>
phoe: a beguiling thought
random-nick has joined #lisp
andreyorst has joined #lisp
bilegeek has quit [Quit: Leaving]
Lord_of_Life_ is now known as Lord_of_Life
nowhere_man has joined #lisp
rumbler31 has quit [Read error: Connection reset by peer]
rumbler31 has joined #lisp
skapata has quit [Remote host closed the connection]
shifty has joined #lisp
srji has quit [Quit: leaving]
mbomba has quit [Quit: WeeChat 3.0]
srji has joined #lisp
aartaka_d has joined #lisp
saganman has quit [Ping timeout: 246 seconds]
aartaka has quit [Ping timeout: 264 seconds]
waleee-cl has joined #lisp
yang has quit [Quit: ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן ǝɥʇ sı sıɥʇ]
Blkt has quit [Read error: Connection reset by peer]
travv0 has joined #lisp
euandreh has joined #lisp
fe[nl]ix has joined #lisp
devrtz has joined #lisp
galex-713 has joined #lisp
Blkt has joined #lisp
euandreh has quit [Read error: Connection reset by peer]
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
heredoc has joined #lisp
dim has quit [Ping timeout: 240 seconds]
scymtym has joined #lisp
saganman has joined #lisp
euandreh has joined #lisp
oni-on-ion has quit [Read error: Connection reset by peer]
nowhere_man has quit [Remote host closed the connection]
vegansbane has joined #lisp
nowhere_man has joined #lisp
jonatack has quit [Ping timeout: 264 seconds]
shifty has quit [Ping timeout: 256 seconds]
shifty has joined #lisp
urek has joined #lisp
jonatack has joined #lisp
urek__ has quit [Ping timeout: 240 seconds]
aartaka has joined #lisp
dim has joined #lisp
toorevitimirp has joined #lisp
dhil has joined #lisp
cosimone has joined #lisp
shifty has quit [Ping timeout: 240 seconds]
jonatack has quit [Ping timeout: 256 seconds]
jonatack has joined #lisp
theBlackDragon has joined #lisp
hhdave has quit [Ping timeout: 256 seconds]
hhdave has joined #lisp
andreyorst has quit [Ping timeout: 240 seconds]
cosimone has quit [Quit: cosimone]
mange has quit [Ping timeout: 240 seconds]
epony has joined #lisp
nowhere_man has quit [Ping timeout: 272 seconds]
nij has joined #lisp
<nij>
Hello! I have a list to traverse through it. I want to point out the entries that satisfy certain predicate out.
<nij>
However, it's not a point-wise check. It's more like a local check.
<nij>
So while examine at 8 in '(1 2 3 .. 10), I want the predicate actually look at numbers near 8. Eg. '(7 8 9)
daphnis has quit [Quit: leaving]
<nij>
How is such list traversal carried out in common lisp?
<nij>
(Sometimes I might also want to look at the neighborhood of 8 with width being "n".)
<aeth>
nij: check the CADR or in general the NTH car of the sublist
<aeth>
although that's just naive, you could optimize that by having two iterations, the first testing the CAR and the second being the start of the range
<nij>
oh ok, so by repeating 'cadr I can get the neighbors on the right.
<nij>
How about those on the left?
<nij>
Perhaps I shouldn't use lists? As they are just chained cons cells.
<aeth>
(loop :with l := (loop :for i :below 10 :collect (1+ i)) :for x :on l :do (print x))
<aeth>
that will go through the sublist until (10)
<aeth>
nij: but instead you can do (loop :with l := (loop :for i :below 10 :collect (1+ i)) :for x :on l :for y :on (cddr l) :do (format t "x = ~S~%y = ~S~%~%" x y))
karayan has quit [Ping timeout: 264 seconds]
karayan has joined #lisp
<aeth>
You could probably also do "y :in" instead of "y :on"
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #lisp
<_death>
if the list doesn't contain NILs you can just (loop for (a b c) on list while c collect (list a b c)) .. if it does, you can move the destructuring around and check for nthcdr
catchme has joined #lisp
<nij>
oh that would work
<phoe>
nij: (loop for (a b c . rest) on '(1 2 3 4 5 6 7) do (print (list a b c)) when (null rest) do (loop-finish))
<aeth>
I don't like LOOP's destructuring because it's unreliable. Contrast with DESTRUCTURING-BIND, which errors when it doesn't match expectations.
<aeth>
I suppose here it can work because there isn't a complicated shape, but even for something as simple as a plist, LOOP's built-in destructuring doesn't do what you want.
<nij>
aeth: I will keep that in mind.
<nij>
I dunno if this is too much to hope.
<aeth>
ahah
<_death>
are you doing advent of code?
<nij>
But I was thinking of writing a dynamical predicate, in the sense that it would first examine at a point
<nij>
And if it doesn't satisfy, it checks its neighborhood, larger and larger.
<nij>
_death: What is that?
<aeth>
It's still too unreliable in phoe's example because it will do the unexpected when the list is too short, e.g. (1 NIL NIL) for '(1) as the input
EvW has joined #lisp
<aeth>
Literally 100% of the time, when I start with LOOP's destructuring, I replace it.
<nij>
I have a feeling that list is the wrong data structure to use.
<beach>
aeth: In what way is it "unreliable"?
<beach>
aeth: I thought it was perfectly predictable and deterministic.
<_death>
nij: some coding exercise.. today's problem could be solved using something like what you described
<nij>
Should I use an array or something instead?
<aeth>
beach: Because if you were to use <, >, <=, >=, =, etc., you will get an error because a random NIL will pop up, but only on an unexpected edge case (in this case, short lists), and when a random NIL pops up in a large program, it's really annoying to track down
<nij>
_death: Oh@@ No I was solving my own issue.
<nij>
It's a little exercise on analyzing stocks.
<phoe>
might be worth using an array, yes
<beach>
aeth: NILs will not pop up randomly.
<nij>
But I have a vision to analyze a graph.. locally and spreading out.
<phoe>
if you want fast random access to arbitrary elements of your data, then vectors or arrays sound good
<nij>
Hopefully it can be applied on topological spaces.
<nij>
phoe: what's the down side of vectors comparing to lists?
<aeth>
beach: DESTRUCTURING-BIND will fail immediately when the shape of the list fails to meet what you think it is going to be, which will be instant debugging at the source of the issue instead of sending you down wild goose chases, like when a NIL pops up several files later in a program that consists of several thousand LoC or more.
saganman has left #lisp ["WeeChat 1.6"]
<aeth>
beach: From experience, I have tried to eliminate all sources of unexpected NILs in my code.
<nij>
OK! I have made up my mind that I want this to be general.
cosimone has joined #lisp
<aeth>
beach: Here, the = will probably be inside of the loop, but in a large program, you might just assume it's still a list of numbers and it could show up much later on.
<nij>
Don't want to write it again for general case later.
<phoe>
nij: inability to insert new elements in cosntant time.
<nij>
So I'm looking for an implementation of directed graphs.
<nij>
phoe: Oh! That's right. Interesting.
<phoe>
you can work around it by using adjustable vectors, but even then reallocations must happen at some point.
<phoe>
and even then you can only add at the end
<aeth>
beach: It could even be the difference of catching it at compile time (in the macro, since destructuring lists generally are in macros ime, at least in my code) vs at run time.
<nij>
phoe: How about a list where the cdr remembers where its car is?
<nij>
Is it called a dynamical array or something?
<nij>
I just want a node to remember who its neighbors are!
<_death>
(defstruct node parents children)
* nij
<phoe>
nij: that's not really a dynamical array; just a linked list or a graph node of sorts.
* nij
wonders if he should talk to his neighbors more.
<nij>
phoe: Oh ok I will do the homework myself then :D
<nij>
I'm sure there are implemented structures like this already!
<aeth>
beach: But you're correct that it's not technically random, it's just that it seems random to the programmer who is debugging the issue of "random" NILs because it's inserted in an unexpected place.
<aeth>
nij: in general, you can make graph nodes out of cons, but you probably shouldn't because cons cells aren't going to enforce any constraints that you might have
<pve>
Hi, is there an "closer:add-superclass" function with a different name that I'm missing? Or am I supposed to go through closer:ensure-class to change the superclass of a class?
<aeth>
nij: and working with conses, you'll probably be too tempted to work with CDDADRs instead of naming your concepts
<nij>
aeth: Right. Just curious about another general question.
<nij>
In common lisp, while defining a structure, is there anyway to force auto-checking if an instance satisfies the assumption?
nij` has joined #lisp
<nij`>
For example, in some structure, I want the slot "year" to pass the regex test ([0-9][0-9][0-9][0-9]).
<nij`>
Can it be checked automatically?
nij has quit [Remote host closed the connection]
random-nick has quit [Quit: quit]
<aeth>
For structs? If it can be expressed as a type, you can use :type for a slot to test it, although SATISFIES types (like that) are generally not very popular. For DEFCLASS classes? You can use the metaobject protocol to enforce it on setting (which will cover both the initial set of the slot and any later setting), including as a type
<phoe>
that's generally to be done by the constructor function
<phoe>
input validation and such
<_death>
if you define a class instead you can provide your own accessors (or before/around methods for them) and check
<aeth>
But, unfortunately, you can't rely on :type in slots in DEFCLASS because the most popular implementation (SBCL) at default optimization levels doesn't do typechecks...
<phoe>
also, why would your year be a string and not a number
<nij`>
_death: oh I see! Check while accessing.
<aeth>
and, yeah, you'd probably want a number instead of a string, in which case it's a simple (integer 0 9999) or whatever
<nij`>
Oh yeah. I should be able to write any predicates I want.
<aeth>
(deftype year () '(integer 0 9999) (typep 2020 'year) => T
<aeth>
oops, left out a )
<beach>
pve: You can use (SETF DIRECT-SUPERCLASSES), so you can use PUSH
<aeth>
(deftype year () '(integer 0 9999)) (typep 2020 'year) => T
<aeth>
0's only natural when you use a digit-based system, like we now do, but years were traditionally Roman numerals (and in copyright years, the transition was usually around the year 2000, although some still use Roman numerals)
<nij`>
It seems that the third argument for 'deftype should be a boolean function.
<nij`>
In your case, it's '(integer 0 9999)
toorevitimirp has quit [Remote host closed the connection]
epony has quit [Ping timeout: 240 seconds]
toorevitimirp has joined #lisp
<nij`>
So what's going on @@ Did I miss anything
<pve>
beach: ok, it seems I don't have a (setf class-direct-superclasses)
<aeth>
nij`: deftype is used to construct new types from old types... where a predicate is only used if you're using SATISFIES (which you should avoid if you can, because it's inefficient)... and integer is a special kind of type
jprajzne has joined #lisp
<nij`>
@@ Oh.. ok
<aeth>
numbers support ranges, specifically for this sort of use case
<beach>
pve: Then just use (REINITIALIZE-INSTANCED :DIRECT-SUPERCLASSES ...)
<beach>
pve: Er, you figure it out.
dim has quit [Ping timeout: 256 seconds]
<beach>
I am not terribly smart today apparently.
<aeth>
nij`: in numbers, (foo x y) is the range including x and y, while (foo (x) y) excludes x, and so on for the other 2 combinations, but for integers, that's not particularly important.
akoana has joined #lisp
<pve>
beach: yeah, I understand, thanks
hal99999 has joined #lisp
dim has joined #lisp
<aeth>
e.g. (typep 42.3 '(single-float (42.3) 43.0)) => NIL (but don't rely on that because floats are weird when using = for tests)
<nij`>
It feels very different from elips. Or maybe I never had to deal with that back then.
<nij`>
Perhaps need to build up some muscles first.
<aeth>
it's all about domains.
<aeth>
Elisp has richer built-ins for dealing with text, Common Lisp has richer built-ins for dealing with numbers and arrays.
<aeth>
There's at least one Computer Algebra System in Common Lisp, which actually predates Common Lisp, which is probably one of the reasons why Common Lisp supports this sort of thing. https://en.wikipedia.org/wiki/Macsyma
frost-lab has quit [Quit: Connection closed]
<nij`>
So while defining a new structure, can one force type checking?
<nij`>
(given that a type has been defined.)
<aeth>
yes
<phoe>
on high safety settings, yes
<aeth>
nij`: In general, though, to build up an intuition for DEFTYPE, just be aware that your primitives are types (including structs/classes you define), SATISFIES (avoid if possible), EQL, and MEMBER, which you compose with OR and AND and NOT
<aeth>
And numbers and arrays have special extensions to allow for very sophisticated things.
<nij`>
excited :D
andreyorst has joined #lisp
random-nick has joined #lisp
<aeth>
You can use them in TYPEP, TYPECASE/ETYPECASE/CTYPECASE, and CHECK-TYPE. You can use them in arrays, but only extremely simple types of numbers/characters; you can test to see what it does in an implementation with upgraded-array-element-type, where T means it does nothing.
<nij`>
Upon accessing? Or defining?
<aeth>
And you can use them in :type in slots in DEFSTRUCT and they'll probably be checked, but if you use them in :type in slots in DEFCLASS, they probably won't be checked, so you'd have to use some library (or directly manipulate the meta-object protocol) to force a check there.
<nij`>
I hope for it to be checked upon defining..
<nij`>
Interesting. 'defstruct replicate in elisp does not support type checking afaik.
<nij`>
That's nice.
<aeth>
The thing about "they'll probably be checked" is that there are 4 outcomes for the possible combinations of checked accessor & checked constructor.
<aeth>
It depends on the implementation.
<_death>
type declarations are promises, not assertions, although some implementations do treat them as the latter.. so you need check-type etc.
<nij`>
OH@@ I'm using sbcl does it check type?
<aeth>
Hopefully, implementations will add assert/check-type style type checking to typed slots in DEFSTRUCT where they don't already have such checking because that's one of the few uses of DEFSTRUCT in modern Lisp
<nij`>
hmm..
<aeth>
In general, SBCL checks types in pretty much any optional place where type checking is permitted (except at (safety 0)) with the sole exception of :type in slots in DEFCLASS, where it only checks at high safety levels
<aeth>
However... SBCL's manual says that it might simplify the check (at low safety levels?) for certain complicated types, e.g. it might simplify (or (integer -4 -1) (integer 1 4)) to just check (or (integer -4 4))
<aeth>
iirc
<nij`>
Got it. Thx :D
pfdietz has quit [Ping timeout: 245 seconds]
<aeth>
If you *must* rely on a type check, then using CHECK-TYPE (or ASSERT with a TYPEP if the type isn't known at compile time) will force it everywhere, to full reliability, because it's one of the few musts.
<nij`>
Wow 'deftype is just a macro..
<aeth>
In general, I use CHECK-TYPE at the interface parts where the user might insert the wrong type, and I use less-reliable type checking elsewhere.
<nij`>
I thought one needs to implement that from lower level.
epony has joined #lisp
<aeth>
In case I was unclear, directly using types in code (rather than :type arguments or DECLARE/DECLAIM/etc. declarations) such as TYPEP, TYPECASE, and CHECK-TYPE will reliably check types. The others are optional, and so could be ignored (or, more rarely, such as with DECLARE, assumed!)
enrio has quit [Ping timeout: 240 seconds]
<aeth>
If an implementation assumes DECLAREd types above (safety 0) then I personally consider that implementation broken although it's technically conforming. If user code (or, worse, library code!) uses the optimization level of (safety 0) then I personally consider the code to be broken.
<aeth>
You can't really talk about types without at least mentioning optimization levels because it's not just an issue of implementations differing, it's also an issue of one implementation behaving differently based on optimization levels.
<nij`>
@@
<aeth>
For the most part, the only things you need to know are that you sometimes need (debug 3) to make full use of the debugger and you should never use (safety 0) ever, ever, ever. (OK, there are a handful of cases, but they can be wrapped in LOCALLY to contain the lack of safety to the smallest possible scope)
<nij`>
Can I just ignore this declaration in my first few projects? Or I should always include a (declare (optimization n))?
<_death>
also best steak is (steak 1)
<aeth>
nij`: you probably don't need it, it's just a caveat with typechecking.
<nij`>
I see :)
<aeth>
That is, you want types to check certain constraints, but sometimes some implementations in some cases will stop checking and start assuming if (safety 0) so the important thing is to never do that.
<Josh_2>
Ello
aartaka has quit [Read error: Connection reset by peer]
aartaka_d has joined #lisp
jprajzne has quit [Quit: jprajzne]
nij` has quit [Ping timeout: 260 seconds]
jprajzne has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
cosimone has quit [Quit: cosimone]
hal99999 has quit [Ping timeout: 272 seconds]
hal99999 has joined #lisp
toorevitimirp has quit [Remote host closed the connection]
galex-713 has quit [Ping timeout: 272 seconds]
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
enrio has joined #lisp
galex-713 has joined #lisp
jprajzne has quit [Quit: jprajzne]
jprajzne has joined #lisp
harlchen has joined #lisp
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
enrio has quit [Ping timeout: 240 seconds]
Lycurgus has joined #lisp
enrio has joined #lisp
thmprover has joined #lisp
<thmprover>
What are some good 'desert island' books for Common Lisp?
<beach>
Depends on your current level of knowledge.
dim has quit [Ping timeout: 272 seconds]
<phoe>
AMOP is definitely amazing
<beach>
Definitely, but it requires a good existing level.
<thmprover>
I'm coming from a Scheme/Clojure background (Scheme was the second language I learned, and Clojure I work with daily)
<phoe>
L/L is sorta good, too, though many techniques that are described there are mostly useful as brain-bending exercises and not in practical code
<thmprover>
L/L I have, and I feel it is more of a polemic (in the best sense of the word)
<phoe>
oh! then you should read PCL and possibly CLR to ensure that you know enough of the multi-paradigm aspect of Common Lisp
<thmprover>
I did learn a lot about macros from it
<thmprover>
CLR?
<phoe>
Common Lisp Recipes
<phoe>
possibly (shameless plug) TCLCS to learn about the CL condition system and how it differs from a lot of exception handling systems out there
<beach>
Also PAIP.
<thmprover>
Ah, yeah, I have read some of CLR; I have browsed various chapters of PCL.
<thmprover>
I am half-way through PAIP.
<beach>
Ah, OK.
<thmprover>
I have just started reading CLTL, one section a day.
orivej has quit [Ping timeout: 240 seconds]
uniminin has joined #lisp
uniminin has quit [Max SendQ exceeded]
uniminin has joined #lisp
ebrasca has joined #lisp
<thmprover>
Touretzky's "Common Lisp: A Gentle intro to symbolic computation" was too gentle, I felt (probably because of my background in Scheme/Clojure)
uniminin has quit [Max SendQ exceeded]
<pyc>
Does Emacs paredit not do electric return by default? Is there any other mode that does electric return by default?
uniminin has joined #lisp
<phoe>
pyc: aggressive-indent maybe?
uniminin has quit [Max SendQ exceeded]
uniminin has joined #lisp
judson_ has joined #lisp
uniminin has quit [Max SendQ exceeded]
uniminin has joined #lisp
uniminin has quit [Max SendQ exceeded]
uniminin has joined #lisp
<pyc>
thanks phoe
uniminin has quit [Max SendQ exceeded]
<pyc>
What does paredit mode provide extra in comparison to electric-pair-mode?
Lycurgus has quit [Quit: Exeunt]
dim has joined #lisp
andreyorst has quit [Ping timeout: 260 seconds]
Bike has joined #lisp
<ck_>
structural editing
<treflip>
pyc: It prevents you from accidentally deleting closing or opening paren and making invalid sexps
rumbler31 has quit [Read error: Connection reset by peer]
rumbler31 has joined #lisp
cosimone has joined #lisp
<Josh_2>
What do people think of lispy?
judson_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
<Gnuxie[m]>
is that a way of calling something 'lispy' or some cursed python thing?
renzhi has joined #lisp
<pyc>
Gnuxie[m]: I believe lispy is another alternative for paredit?
<Josh_2>
no no, It's an alternative to paredit
<Gnuxie[m]>
oh ok, interesting
<pyc>
Gnuxie[m]: do you use paredit or anything similar?
<Gnuxie[m]>
I use paredit
<Josh_2>
I wish I had started my lisp journey with paredit
<Josh_2>
because then I would be using it right now :P
<pyc>
Gnuxie[m]: Do you also configure it to do electric return? Or do you just paredit in its vanilla mode?
<pyc>
Josh_2: Why? What's wrong with lispy? Lispy also gets the job done, right?
<pyc>
Gnuxie[m]: it does gather all the parentheses and put them in the same line as you start closing the parentheses. So the end result looks the way you want. but yes, the interim results may be disconcerting if one does not like to see parentheses on their own lines even temporarily.
<Gnuxie[m]>
oh ok, not sure I'd like that
judson_ has joined #lisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
EvW has joined #lisp
zcheng3 has quit [Ping timeout: 256 seconds]
nowhere_man has joined #lisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
bcasiello has joined #lisp
nij has joined #lisp
<nij>
Hello! Suppose I have a graph.. and I like to plot it out. It will look like a network, with nodes and edges. Is there a nice network plotting package in common lisp?
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
<jackdaniel>
nice is an overstatement, but cl-dot allows you to produce graphviz dot files and mcclim lets you render in lisp directly
<phoe>
seconded for cl-dot
<jackdaniel>
thirded for mcclim
<jackdaniel>
:>
<nij>
Oh wow cl-dot seems nice. Thank you :D
nij has left #lisp ["ERC (IRC client for Emacs 27.1)"]
shifty has joined #lisp
liberliver has joined #lisp
liberliver1 has joined #lisp
liberliver has quit [Ping timeout: 256 seconds]
liberliver1 is now known as liberliver
judson_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
karayan has quit [Ping timeout: 260 seconds]
karayan has joined #lisp
orivej has joined #lisp
judson_ has joined #lisp
karayan has quit [Ping timeout: 260 seconds]
karayan has joined #lisp
cosimone has quit [Remote host closed the connection]
cosimone has joined #lisp
cosimone has quit [Remote host closed the connection]
Jeanne-Kamikaze has joined #lisp
ebrasca has quit [Remote host closed the connection]
rgherdt has quit [Ping timeout: 260 seconds]
iskander- has joined #lisp
iskander has quit [Ping timeout: 265 seconds]
urek__ has joined #lisp
<White_Flame>
the one main issue I have with paredit, which lispy also has, is that I have prolog-style "foo(bar)" syntax in some of my reader macros, and those helpers always inject a space before the open paren
<White_Flame>
I haven't poked into how much it would take to disable that
<aeth>
I just have to grep my code for "fuck" and I find it because it's the only thing that's commented with profanity in all of my code. :-)
<aeth>
It breaks #foo( syntax in general, i.e. any well-formed reader macro or syntactic extension.
<mister_m>
Does the loop macro support executing a block of statements every nth iteration? I think that would be analagous to an infinite DO loop where every nth step I reset the counter.
<White_Flame>
aeth: thanks
<White_Flame>
mister_m: I don't think so
<White_Flame>
not as a builtin at least
<White_Flame>
obviously it "supports executing" code that does that accumulation & check ;)
bcasiello has quit [Quit: Leaving]
pi123 has joined #lisp
johnjay has quit [Read error: Connection reset by peer]
shifty has quit [Ping timeout: 256 seconds]
enrio has quit [Quit: Leaving]
cosimone has joined #lisp
<Bike>
mister_m: yeah, no, you'd have do (loop for i = 0 then (mod (1+ i) n) when (zerop i) do ...) or the like i guess.
enrio has joined #lisp
shifty has joined #lisp
cosimone has quit [Client Quit]
cosimone has joined #lisp
andreyorst has joined #lisp
karlosz has joined #lisp
cosimone has quit [Remote host closed the connection]
<mister_m>
thanks
<aeth>
You could also do something similar with two loops
iskander- has quit [Ping timeout: 246 seconds]
thmprover has quit [Quit: [Exit, pursued by bear]]
pi123 has quit [Quit: WeeChat 2.3]
<White_Flame>
or 1 loop with an additional FOR in it to run the every-n counter
<aeth>
Every nth iteration, if constant, is basically the same as doing (loop ... :do (progn (do-whatever) (loop ...))
iskander has joined #lisp
<aeth>
There are actually a lot of creative ways to do it
catchme has quit [Quit: Connection closed for inactivity]
johnjay has joined #lisp
<johnjay>
so as i understand it you can make system calls from c programs
<johnjay>
is there a way to do this in sbcl/CL or is that impossible?
<White_Flame>
sbcl has extra packages that expose things, or you use FFI to call C-interface stuff directly
rgherdt has joined #lisp
<White_Flame>
for instance with the former, sb-posix: has a bunch of stuff
<White_Flame>
(depending on how low level of "system call" you mean)
<Xach>
I asked Doug for it when I thought I needed it - I never needed it, normal FFI interfaces sufficed for me.
<Xach>
johnjay: is there a particular syscall you want to access that is not otherwise available?
<mister_m>
aeth: I ended up doing two DO loops
<johnjay>
no i'm just asking on a general level
<johnjay>
it seems like something one should be able to do through the FFI but i wasn't sure
rogersm has joined #lisp
hal99999 has quit [Ping timeout: 272 seconds]
frgo_ has joined #lisp
frgo_ has quit [Remote host closed the connection]
frgo_ has joined #lisp
rogersm has quit [Quit: Leaving...]
frgo has quit [Ping timeout: 244 seconds]
trafaret1 has left #lisp ["ERC (IRC client for Emacs 26.3)"]
hal99999 has joined #lisp
EvW has quit [Ping timeout: 260 seconds]
ggole has quit [Quit: Leaving]
treflip has quit [Quit: WeeChat 2.6]
karayan has quit [Remote host closed the connection]
karayan has joined #lisp
EvW has joined #lisp
rogersm has joined #lisp
choegusung has joined #lisp
iskander- has joined #lisp
aartaka has joined #lisp
iskander has quit [Ping timeout: 272 seconds]
aartaka_d has quit [Ping timeout: 240 seconds]
<Josh_2>
I have found it quite humbling to do the Advent of Code and then compare my solution to Harlequins on github... needless to say I don't tend to find the optimal solution, especially today
<Josh_2>
(obv doing it in CL)
choegusung has quit [Quit: leaving]
iskander has joined #lisp
iskander- has quit [Ping timeout: 260 seconds]
<rogersm>
Do you have the link? I cannot find the repo
<jrm>
Is there a way to unconditionally build everything?
<phoe>
jrm: try adding :force :t to the ASDF:OOS call
<phoe>
that tells ASDF to recompile all files unconditionally
rumbler31 has quit [Read error: Connection reset by peer]
nowhere_man has joined #lisp
rumbler31 has joined #lisp
<jrm>
phoe: Thanks. I updated the line in question to -eval "(asdf:oos :force :t 'asdf:compile-op :${PORTNAME})" \ but the result was the same.
<jrm>
If stumpwm is already installed it errors out with...
<jrm>
install: /wrkdirs/usr/ports/x11-wm/stumpwm/work/stumpwm-20.11/*.fasl: No such file or directory
<jrm>
Oh, one moment. I think edited the wrong file.
<jrm>
That gives a new error:
<jrm>
Can't coerce :FORCE to a subclass of ASDF/OPERATION:OPERATION
rumbler31 has quit [Read error: Connection reset by peer]
<phoe>
uhhh, wait a second...
rumbler31 has joined #lisp
<phoe>
this should look like (asdf:oos 'asdf:compile-op :phoe-toolbox :force t)
<phoe>
so in your case, (asdf:oos 'asdf:compile-op :${PORTNAME} :force t)
amb007 has quit [Ping timeout: 272 seconds]
<jrm>
That looks good. Before when stumpwm was already installed the compilation returned almost immediately. Now it produces lots of output like when it's not installed, e.g., "; processing (DEFUN ENTER-INTERACTIVE-KEYMAP ...)", but the fasl files are still not generated.
<Xach>
joe "jrm" r. marshall??
<jrm>
No, different jrm. If I were Joe Marshall I would probably know what I was doing. ;-)
<mfiano>
Hmm, I wonder if lparallel does work-stealing
<jrm>
On FreeBSD, we have ${PREFIX}/lib/common-lisp/system-registry. If I remove stumpwm.asd from this system-registry before building the second time it builds successfully, including all the fasl files.
<jrm>
I wonder if I can somehow skip this registry when invoking sbcl for the build?
frgo_ has quit [Remote host closed the connection]