<lisp-newbie>
Bike: about the unsafe practice. How are the methods defined? as data for the slot? is doing |var| enough in terms of setting the data into the object, or is there a better practice? I was planning on using a validation package called sanity-clause for the data itself. Is there such a thing as lisp injection (like sql injection?)
<Bike>
you're presumably not evaluating forms, so it wouldn't really be like sql injection
<Bike>
nothing you've described would let users define methods, i'm just talking about them exploiting methods in your code
<pillton>
mfiano: I haven't been able to find BUNDLE either but I kind of think of it as a poor version of defclass.
<pillton>
I like the layering idea in the book though.
<mfiano>
Yes, I do too. I was kind of hoping to find a paper on the original idea for that, but nope
tankrim has quit [Remote host closed the connection]
Catie has quit [Quit: rcirc on GNU Emacs 27.2]
taiju has quit [Ping timeout: 258 seconds]
<raeda>
If I (defmacro my-macro ...), then what exactly is #'my-macro ? In SBCL, it's different from (macro-function 'my-macro)
<lotuseater>
raeda: this isn't a function
<lotuseater>
but you can call (macro-function 'my-macro)
taiju has joined #commonlisp
<raeda>
So I should just ignore it? The spec for defmacro doesn't say anything about binding a function value, so I was curious what it was
<mfiano>
clhs functional value
<mfiano>
check out that glossary term
<mfiano>
"It is an error to use function on a function name that does not denote a function in the lexical environment in which the function form appears. Specifically, it is an error to use function on a symbol that denotes a macro or special form. An implementation may choose not to signal this error for performance reasons, but implementations are forbidden from defining the failure to signal an
<mfiano>
error as a useful behavior."
<mfiano>
More relevant
<mfiano>
So there you go, (function my-macro) and thus #'my-macro is illegal for as long as there is not a function in the lexical environment (or a function in the toplevel/global environment)
<lisp-newbie>
Bike "i'm just talking about them exploiting methods in your code" how could they do that? and how can I protect myself from that?
<raeda>
mfiano: thanks, that's nice to know
<lisp-newbie>
If I do (intern string "KEYWORD") with string being some user input, wouldn't that store this variables on the environment and leave myself vulnerable to a stack/heap overflow type problem?
<lisp-newbie>
is there a way to check if the symbol exists and not create one if it doesn't, and return nil instead?
<mfiano>
Do you know what interning means?
<lisp-newbie>
mfiano this is what I got: intern v.t. 1. (a string in a package) to look up the string in the package, returning either a symbol with that name which was already accessible in the package or a newly created internal symbol of the package with that name. 2.
<lisp-newbie>
I have an alist, which I'm turning into a plist, but it fails becase it's not the actual symbol (I think it lacks the colon? )
<lisp-newbie>
thanks, will try that
<mfiano>
Which is basically equivalent to (intern (string-upcase "hello") :keyword)
<lisp-newbie>
what is the :keyword mafiano?
<lisp-newbie>
mfiano
<lisp-newbie>
sorry
<mfiano>
A package designator
<mfiano>
If you are unfamiliar with symbols and packages, I think you are getting ahead of yourself. That is important to understand first and foremost
<lisp-newbie>
ok, does that mean the name of the package where the symbol is supposed to be?
<lisp-newbie>
I've been using the packages, just I don't know the names of things... and yes, I am way ahead of myself, trying to learn what I can, but I feel there's a big gap between the lisp cookbook and general working knowledge for a project
<mfiano>
The Lisp Cookbook is not a good learning resource
<lisp-newbie>
what do you recommend?
<mfiano>
Start with gigamonkeys.com/book
<lisp-newbie>
I've used it a little bit, I will use it more bl"n
yitzi has joined #commonlisp
<mfiano>
That book is meant to be read linearly, doing all the practical chapters
<mfiano>
that means read it cover to cover
<lisp-newbie>
ah, I was skipping around
<mfiano>
Also, there is the more newbie-oriented #clschool channel if you don't want to be assumed to have the basics down
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
<lisp-newbie>
mfiano, thanks will ask over there :)
<mfiano>
No prob
<lisp-newbie>
mfiano but no one answers over there haha
<mfiano>
They sure do.
<mfiano>
IRC is asynchronous :)
<lotuseater>
lisp-newbie: it's IRC, so have patience :)
<lisp-newbie>
hahaha got it from the cookbook (map 'list (lambda (it) (* 10 it)) '(1 2 3 4 5))
kevingal has quit [Remote host closed the connection]
<lisp-newbie>
ok, finally Bike mfiano I have now made progress thanks to your help. This is what I got: (apply #'make-instance 'user :allow-other-keys t (alist-key-symbol (param-user-list))) and then I get this error: Evaluation aborted for #<SB-INT:SIMPLE-PROGRAM-ERROR "~@<keyword argument not a symbol: ~S.~@:>" {1004EEC193}>
<Bike>
what does (alist-key-symbol (param-user-list)) return?
<lisp-newbie>
where do I take it from here?
<Bike>
well, it sounds like alist-key-symbol is not returning what it should be returning
<Bike>
if it was returning a plist you obviously wouldn't be getting this error from make-instance
<mfiano>
see my solution in #clschool
<mfiano>
oh yes, needx to convert it to a plist as discussed earlier today
<lisp-newbie>
ok, will go to #clschool
lotuseater has left #commonlisp [ERC (IRC client for Emacs 27.2)]
<Bike>
if you did (make-instance 'user '(:list 1 2 3 4) '(:hello ("world" 26))), what would happen?
<lisp-newbie>
just realized I forgot to do this:(alexandria-2:alist-plist
<lisp-newbie>
oh, Bike! Thanks! you fixed it! here it is working! (apply #'make-instance 'user :allow-other-keys t (alexandria-2:alist-plist (alist-key-symbol (param-user-list))))
<lisp-newbie>
Bike for what you wrote I get the same error keyword not an argument, but now you fixed it... didn't realize after all the different problems I forgot to turn the alist into a plist
<Bike>
right
<lisp-newbie>
it's been a long day, writing this has taken me like 3 days for about 6 hours a day, probably should've taken 10 minutes if I knew what I was doing
<lisp-newbie>
but I've learned a lot in the process
<Bike>
that's good
<lisp-newbie>
Bike, how would I go about sanitizing this input? I imagine (dangerous assumption I know) that the sql packages are escaping for sql injections, is there something else I should worry about in this case?
<Bike>
my concern was just that you're exposing a _potentially_ large attack surface. For example if you had a (defmethod initialize-instance ((object user) &key destroy-the-world) (when destroy-the-world ...))
<Bike>
if you're not doing things like that i don't think it is especially dangerous, but it is something to keep in mind
<jasom>
lisp-newbie: FWIW sql libraries usually use parameterized queries rather than escaping; the famous XKCD was wrong about that; sanitizing inputs is not the typical solution.
<lisp-newbie>
jasom so is there anything I need to add on top of the sql library when dealing with input or is that it?
<lisp-newbie>
btw thanks for answering!
<jasom>
lisp-newbie: if you aren't doing something silly like using format to build sql strings then the library should take care of it
<lisp-newbie>
Bike thanks for answering as well
dsk has joined #commonlisp
<lisp-newbie>
jsom great, thanks
<Bike>
no problem
<hayley>
The teachers at my university happily showed us how to concatenate strings to make queries.
<lisp-newbie>
are these types of questions fair game for here? or are they still too basic?
<Bike>
i don't think we have any strict policy about when #lisp versus #clschool is appropriate, but you might get better answers on #clschool, i don't know
<jasom>
lisp-newbie: pretty much any question about how to use a lisp library is on-topic, even if it ends up not being specifically about lisp
<lisp-newbie>
hahaha ok, great, thanks
<jasom>
as far as I know, the only hazard of here vs #clschool is you may get overly pedantic answers and people will go off on tangents more
<hayley>
I was always reminded of a quote "Bad programming style can kill people." Better yet, they then sent me a government survey. Well, I wasn't reminded of that quote while filling out the survey.
* hayley
is demonstrating how people go off on tangents in #commonlisp.
jimka has quit [Ping timeout: 272 seconds]
prxq_ has joined #commonlisp
<jasom>
lisp-newbie: the bigger issue with malicious inputs is what you do with the data after you pull it back out of SQL. For example if there's a string going in a web page, you need to make sure that it can't inject arbitrary html. If you use some sort of html templating language, then that library should take care of that for you though.
<jasom>
hayley: yet another example of how universities are not trade schools...
<lisp-newbie>
hahaha hayley that's good. jasom yeah, I'm using react now, angular took care of it by default, learning react now and I have to look into it... maybe I'm learning too many new things with this project lisp and react
prxq has quit [Ping timeout: 268 seconds]
<hayley>
jasom: I'm not sure if a trade school would be any better, but I haven't gone to one.
<hayley>
Though another slightly immoderate statement would be that "a modern economic system demands mass production of students who are not educated and have been rendered incapable of thinking."
<hayley>
There are enough complaints that Lisp is bad because it doesn't make programmers fungible enough, so I would believe it though.
hafat has quit [Ping timeout: 256 seconds]
jimka has joined #commonlisp
<jasom>
hayley: I think the point was the classes I took at university were about teaching the theory rather than the practice, and for the theory it really doesn't matter if you are open to sql injection attacks.
Oladon has joined #commonlisp
<beach>
Good morning everyone!
char_ has joined #commonlisp
char has quit [Ping timeout: 240 seconds]
char_ is now known as char
char_ has joined #commonlisp
char has quit [Ping timeout: 272 seconds]
char_ is now known as char
jimka has quit [Ping timeout: 252 seconds]
<Oladon>
Morning beach!
djuber` has joined #commonlisp
nirnam has quit [Ping timeout: 250 seconds]
lisp-newbie has quit [Quit: This computer has gone to sleep]
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
rain3 has joined #commonlisp
<hayley>
jasom: Right. But I would struggle to call the class theoretical.
taiju has quit [Ping timeout: 258 seconds]
taiju has joined #commonlisp
Bike has quit [Quit: Lost terminal]
<kakuhen>
if i create a mixin of a funcallable standard object, would i be able to funcall this mixin?
<pillton>
mfiano: Thanks!
<beach>
kakuhen: I don't see why not.
<beach>
kakuhen: There is nothing special about mixins.
<kakuhen>
in retrospect my question was kinda dumb, sorry
retropikzel has joined #commonlisp
santiagopim has quit [Remote host closed the connection]
^[ has quit [Ping timeout: 272 seconds]
^[ has joined #commonlisp
taiju has quit [Ping timeout: 240 seconds]
taiju has joined #commonlisp
santiagopim has joined #commonlisp
char has quit [Ping timeout: 272 seconds]
jimka has joined #commonlisp
shka has joined #commonlisp
jimka has quit [Ping timeout: 256 seconds]
dave_ has quit [Ping timeout: 272 seconds]
jeosol has quit [Ping timeout: 265 seconds]
akoana has left #commonlisp [Leaving]
gaqwas has joined #commonlisp
jimka has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 250 seconds]
Lord_of_Life_ is now known as Lord_of_Life
shka has quit [Quit: Konversation terminated!]
vats has quit [Ping timeout: 268 seconds]
Oladon has quit [Quit: Leaving.]
<phoe>
etimmons: thanks!
aleamb has quit [Quit: bye]
nirnam has joined #commonlisp
victor has quit [Changing host]
victor has joined #commonlisp
gaqwas has quit [Ping timeout: 252 seconds]
pve has joined #commonlisp
djuber` has quit [Ping timeout: 245 seconds]
rgherdt_ has joined #commonlisp
taiju has quit [Remote host closed the connection]
taiju has joined #commonlisp
jimka has quit [Ping timeout: 252 seconds]
noa has joined #commonlisp
jimka has joined #commonlisp
noa has quit [Ping timeout: 256 seconds]
dsk has quit [Ping timeout: 272 seconds]
jimka has quit [Ping timeout: 256 seconds]
jimka has joined #commonlisp
hendursa1 has joined #commonlisp
hendursaga has quit [Ping timeout: 244 seconds]
nij- has joined #commonlisp
<nij->
Good morning :)
<beach>
Hello nij-.
tfeb has joined #commonlisp
tfeb has quit [Read error: Connection reset by peer]
tfeb_ has joined #commonlisp
tfeb_ has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 245 seconds]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
vats has joined #commonlisp
lisp123 has joined #commonlisp
<lisp123>
mfiano: let me know your review of building problem solvers once done, looks interesting, I will likely get it at some point
<mfiano>
Well do, but it'll probably be a while. I buy/read too many books and got a few ahead of that one, in between actually writing code :)
jimka has quit [Ping timeout: 272 seconds]
pillton has quit [Quit: ERC (IRC client for Emacs 27.2)]
retropikzel has quit [Ping timeout: 258 seconds]
<lisp123>
mfiano: I am the same, plus I read the description of the book - that isn't one to finish in a few days :) I've added it to my bookmarks so will purchase once I clear my current backlog
jimka has joined #commonlisp
jimka has quit [Ping timeout: 250 seconds]
selwyn has joined #commonlisp
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
<jackdaniel>
booklog? :)
<flip214>
no, blog
flip214 has joined #commonlisp
flip214 has quit [Changing host]
<nij->
curious what you folks are reading
<scymtym>
booklog too large? organize it into a kanban cupboard!
<nij->
lisp related @@?
amb007 has quit [Ping timeout: 240 seconds]
random-nick has joined #commonlisp
amb007 has joined #commonlisp
<kakuhen>
i've been telling myself to go through some algorithms in common lisp book, but i can't get myself to read any textbook that's not a math textbook
<kakuhen>
but programming textbooks are nothing like mathematics textbooks
<kakuhen>
i'm used to "definition - theorem - proof - exercise" and repeat until the course is over
<nij->
Name one math textbook in mind :)
<nij->
oh
<kakuhen>
>one math textbook in mind
<kakuhen>
Sure. Topoi, theory, and triples
<kakuhen>
im asking one of my favorite prof's to host reading course with it fall
<kakuhen>
with it this fall*
jimka has joined #commonlisp
<nij->
kakuhen: lets join #lispcafe ?
peterhil has joined #commonlisp
<kakuhen>
sure.
<lisp123>
jackdaniel: 'booklog' - nice one :)
elf_fortrez has joined #commonlisp
derelict has joined #commonlisp
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
jimka has quit [Ping timeout: 258 seconds]
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
kevingal has joined #commonlisp
<jackdaniel>
thanks
lisp123 has quit [Ping timeout: 258 seconds]
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
igemnace has quit [Quit: WeeChat 3.2]
selwyn has quit [Read error: Connection reset by peer]
selwyn has joined #commonlisp
CrashTestDummy has quit [Quit: Leaving]
lotuseater has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
retropikzel has joined #commonlisp
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
kakuhen has quit [Quit: Leaving...]
jasom has quit [Ping timeout: 240 seconds]
lisp123 has joined #commonlisp
nij- has quit [Remote host closed the connection]
Oladon has joined #commonlisp
lisp123 has quit [Ping timeout: 258 seconds]
jasom has joined #commonlisp
selwyn has joined #commonlisp
nij- has joined #commonlisp
jeosol has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
fengshaun has quit [Quit: bibi!]
fengshaun has joined #commonlisp
amb007 has joined #commonlisp
nij- has quit [Remote host closed the connection]
nij- has joined #commonlisp
tyson2 has joined #commonlisp
andreyorst has quit [Ping timeout: 268 seconds]
lisp123 has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
lisp123 has quit [Ping timeout: 268 seconds]
selwyn has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
andreyorst has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Client Quit]
cage has joined #commonlisp
Oladon has quit [Quit: Leaving.]
jimka has joined #commonlisp
tfeb has joined #commonlisp
jimka has quit [Ping timeout: 240 seconds]
nij- has quit [Quit: Using Circe, the loveliest of all IRC clients]
tfeb has quit [Quit: died]
z3t0 has joined #commonlisp
Inline has joined #commonlisp
nij- has joined #commonlisp
<nij->
Hi! For a list (x y z), how do I loop over it and collect so that I get
<nij->
((0 . x) (1 . y) (2 . z)) at the end?
<jackdaniel>
(loop for i from 0 for e in '(x y z) collect (cons i e))
djuber` has joined #commonlisp
<nij->
Neat!
noa has joined #commonlisp
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #commonlisp
amb007 has quit [Ping timeout: 258 seconds]
jimka has joined #commonlisp
amb007 has joined #commonlisp
Bike has joined #commonlisp
noa is now known as noa```
<jasom>
question: how hairy should a destructuring lambda-list get before one decides to use multiple destructuring binds?
<jasom>
I've got (hours _ (&optional minutes ((&optional seconds ((&optional nanoseconds))))) offset) for destructuring a parse tree for a timestamp. The extra braces needed around the destructured optional parameters makes this feel a bit "write only" to me
<hayley>
Can you influence the structure generated by the parser?
<jasom>
not trivially; this is the natural layout since hours must always be specified, and each more specific item is optional, but requires the more specific one to be present
<jasom>
e.g. 12 <-- just the hour 12:34 <-- hours and minutes 12:35:56 <-- hours minutes seconds 12:34:56.78 <-- hours minutes seconds nanoseconds
<hayley>
Okay. Just a random thought.
<jasom>
And I can't just flatten it because that confuses the offset that may be on the end: 12+03:00 < hour plus offset from UTC
<jasom>
I suppose I could force the offset to be there, but be nil, then do a butlast, then flatten
<hayley>
Though having double nesting around seconds and nanoseconds (so, nine digits?) feels strange, but it could be due to the grammar.
<scymtym>
if the minutes, seconds, nanoseconds part is a self-contained sub-structure in the result, you could make a separate rule
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
<jasom>
hayley: here's a sample parse tree with everything but the offset specified: (12 NIL (34 (56 (780000000))) NIL)
<hayley>
Right. But I don't see why e.g. ((&optional nanoseconds)) is used when it would match a list of a list with either zero or one arguments.
amb007 has quit [Ping timeout: 258 seconds]
<jasom>
because without the ns in the input, the parse tree looks like (12 NIL (34 (56 nil))
amb007 has joined #commonlisp
<hayley>
Okay. I must be too tired to read the destructuring lambda list then.
lisp-newbie has joined #commonlisp
<jasom>
hayley: if you do ... &optional a (&optional b) that means: Optional argument named "a" and an optional argument named "&optional" with a default value of "b"
<jasom>
the double-braces are needed to disambiguate from that case
lisp-newbie has quit [Client Quit]
<hayley>
Naming it wouldn't hurt though; perhaps make a macro which is used like (with-timestamp-parse ((:seconds s :minutes m :hours h) parse-tree) ...)?
lisp-newbie has joined #commonlisp
<hayley>
Oh, right, now it makes sense. Today I can't seem to reason about lambda lists at all.
nij- has quit [Quit: Using Circe, the loveliest of all IRC clients]
dlowe has joined #commonlisp
<jmercouris>
anyone know of a handy little macro for (unless x (setf x y))
<jmercouris>
to only set x if it is unset basically
<jasom>
jmercouris: unset or nil? those are two different things...
<jmercouris>
OK sure, I meant to say if NIL
<jmercouris>
the code reads quite clearly my intention
<jmercouris>
(unless x (setf x 1))
<lisp123>
Should I define packages (defpackage ...) in my packages.lisp or in the package file itself?
<beach>
jmercouris: Shocking!
<jmercouris>
not looking for (symbol-value 'x)
<jmercouris>
beach: what is so shocking?
<hayley>
The CLHS is a bit unclear on if I can use OR though. The argument is called "function" but the equivalent expansion suggests it is fine to use a macro name.
<Bike>
jmercouris: i don't think i know of any library with that
<dlowe>
lisp123: do you mean the system file?
<Bike>
lisp123: is "the package file itself" not packages.lisp?
<lisp123>
dlowe: no I avoid ASDF :)
<jasom>
jmercouris: I would probably do (setf x (or x 1))
<beach>
jmercouris: The UNLESS suggests that X is a Boolean, but then you assign a number to it.
<jmercouris>
jasom: hm, that is one way
<dlowe>
lisp123: you're already outside convention, then, so do whatever you please
<lisp123>
bike: I have been putting (defpackage my-package) in packages.lisp then in my-package.lisp I put (in-package my-package)
<jmercouris>
beach: :-O
<jmercouris>
indeed
<hayley>
jasom: see my definition of you-posted-LUV-presentation-violation-prepare-to-lose-subscriber
<Bike>
you should do (defpackage my-package ...) in one file, and put (in-package my-package) at the top of each of your other files
<jmercouris>
Unless you want to do package per file style....
<jmercouris>
ASDF has provisions for that as well...
<Bike>
or that
<jmercouris>
that said, do what Bike said
<jmercouris>
package per file is frustrating
<lisp123>
Bike: That's what I have been doing till now (and I assume there was some good reason but I forgot). But now I am trying to do more literate programming, so it feels more natural to put it in one file?
amb007 has quit [Ping timeout: 258 seconds]
vats has quit [Ping timeout: 258 seconds]
<phoe>
you can put that in one file
<Bike>
lisp123: i don't know why that would be more natural. putting in-package on top of each file lets the reader orient themselves.
<phoe>
(defpackage #:foo ...) (in-package #:foo) (defun ...) (defvar ...) ;; normal application code goes here
<jasom>
what about two-packages-per-file style? Each file must define exactly two packages ;)
amb007 has joined #commonlisp
<jmercouris>
jasom: I hope you don't publish your name on your source code!
<phoe>
I think only Genera of all Common Lisp implementations used today chokes on this
<hayley>
zero-packages-per-file, program like it's 1960 (or elisp)
<jmercouris>
even if you don't include a package there will be a package for the context...
<jmercouris>
well anyways
<jmercouris>
Elisp is stuck in the 1960s
<beach>
lisp123: I tend to divide my code into "modules", where each "module" is contained in a directory, has one .asd file, and a single package defined in a separate file.
<lisp123>
Bike: Is the main reason to seperate it into another file to make working with packages across multiple files easier?
<Bike>
the main reason to separate defpackage into another file? i mean, yeah
<lisp123>
Ok thanks, I will ponder over it
<lisp123>
I am experimenting with writing all code in .org files and then extracting them into a .lisp file
<beach>
lisp123: The .asd file starts with (cl:in-package #:asdf-user). The package file starts with (cl:in-package #:common-lisp-user), and every other file in the module starts with (cl:in-package #:package-name-of-module).
Lord_Nightmare has quit [Remote host closed the connection]
Lord_Nightmare has joined #commonlisp
<lisp123>
beach: thanks. It all makes sense, I am just trying to reconcile it with a 1 .org file that fully explains a package approach
<lisp123>
Perhaps I will just put the defpackage code in comments and stick to using packages.lisp (and maybe later migrating to ASDF)
<lisp123>
How many lines of code should each file be? Maybe my issue is I am putting everything for a package into one file
<beach>
That is not very important. Put related code together in a file. What determines "related" depends on the programming technique used.
<lisp123>
makes sense
<beach>
Like if you do CLOS-style object-oriented programming, you may want to put methods on different generic functions, but specialized to the same class in one file.
<beach>
That way, one file contains everything that is needed for a single class.
<lisp123>
Thanks, yes that is how I am doing it right now
<beach>
A thing that often happens is you end up with a bunch of functions used everywhere, and then you can stick those in a file utilities.lisp.
makomo_ has joined #commonlisp
<lisp123>
My memory is so bad that I forget half of what I wrote after a few weeks, so I think literate programming will help me here
<dlowe>
that's not a bad memory, that's well within norm
<beach>
Yeah, come back when "after a few weeks" turns into "yesterday".
<dlowe>
otherwise we wouldn't need all these methods of naming and commenting and tracking
<lisp123>
That is true
<lisp123>
beach: it is getting closer and closer to that every day :O
<dlowe>
Every program has a "utilities" file but it's nice to review it occasionally and pull commonly themed functions out
<jasom>
My favorite is "What idiot wrote this code?" (svn blame: jasom)
<dlowe>
usually one called "strings"
<beach>
lisp123: See the quotation of Charles Simonyi on top of page 9 of the LUV slides.
<hayley>
I fail to remember when exactly I did things other than "some time last week". But I don't know if literate programming has advantages for large systems.
pjb has quit [Remote host closed the connection]
<hayley>
At least, I would have no idea how to present my code in a linear fashion.
<beach>
Yeah, the way "literate programming" was defined, it is not a good thing to aspire to.
<beach>
But if it means "explain what you are doing", that's fine of course.
<beach>
And the way it is usually presented looks to me like the implementation is set in stone way too early, so that changes are difficult later on.
<beach>
lisp123: I find that a good protocol definition in the form of protocol classes and generic functions is the best way to structure some module.
noa``` has left #commonlisp [Leaving]
<lisp123>
hayley: It hasn't really taken off, so one would assume its not appropriate for most situations. Where I think it helps is (a) once a package is more or less final (at least for now), then converting it to a literate style for future reference, (b) if the coder is predisposed to writing (some people like to read more words to learn // some prefer just reading code directly)
<scymtym>
jmercouris: elisp recently got native compilation, good pattern matching, proper generic functions (with extensions, even), a (supposedly) better design for SETF and probably other things i don't recall right now. also lexical scoping a long time before that. i don't think they are stuck in the 1960's at all
<hayley>
Eventually I might need to write an internals book for some of my code, as well as the specification book (which covers Lisp and wire protocols).
<beach>
scymtym: So they no longer have an excuse to write Emacs in Emacs Lisp rather than Common Lisp. :)
<hayley>
I don't think it is necessarily complicated, but there is some subtlety as an effect of, say, using atomics in places rather than coarse locking, so it would help to have the proofs that things will work written down.
<lisp123>
beach: yes I am doing that too, perhaps I have to keep refining it to make it clearer and clearer - one of the underlying issues is spaghetti code. As of now I have too big of a memory issue, so will resort to writing some more detailed notes
pjb has joined #commonlisp
<lisp123>
For example, I have written a parser, and that's always hard to remember how it works - but I think that's also an issue with certain types of code (parsers always seem to me a bit challenging to read)
<scymtym>
beach: doesn't a better Elisp language reduce the incentive to rewrite in a different language?
<hayley>
lisp123: Okay. It seems I am a terrible writer, as I got rejected by a university for flunking the English exam.
<beach>
scymtym: I guess so. What I really meant was that the original reason for writing Emacs in a simple Lisp dialect so that it would be very portable is no longer valid.
<lisp123>
hayley: Perhaps it means you are more predisposed to writing & reading code (and maybe most good programmers are that way). I rather write an essay though lol and have the code in between
<Bike>
looking at the elisp manual it doesn't seem their setf is different from CL's, other than that you can't extend it?
<Bike>
there's also a letf
<scymtym>
Bike: let me try to find what i was referring to
<beach>
hayley: You have a tendency to write ambiguous phrases. But that kind of skill can be improved with practice. Mainly, it is just a matter of exposing your writing, and re-reading it yourself.
rgherdt_ has quit [Ping timeout: 240 seconds]
<hayley>
Okay, thanks.
<pjb>
indeed, RMS had to write emacs lisp because there was no good lisp running on unices in 1982.
<pjb>
nowadays, we have several CL and even scheme implementations running on unix, macos, ms-windows, and even android and iOS (in some way), so writing an emacs nowadays could avoid re-implementing a new lisp.
<scymtym>
Bike: the comment at the top of gv.el relates the approach to CL's SETF
<hayley>
A week ago I drew up a state machine to convince myself that my atomic operations wouldn't drop messages, but it wouldn't fit in a reference manual, and sadly I can't easily embed an image into Lisp code (no, a comment with the Graphviz code does not count), so it would not fit into the existing file structure too well.
<Bike>
i see, so instead of a setf expansion you define... not an expansion function, but a function that takes an expansion function as an argument, sorta...
lisp-newbie has quit [Quit: This computer has gone to sleep]
cosimone has joined #commonlisp
nirnam has quit [Remote host closed the connection]
yitzi has quit [Remote host closed the connection]
cosimone has quit [Remote host closed the connection]
cosimone has joined #commonlisp
srhm has quit [Ping timeout: 272 seconds]
srhm has joined #commonlisp
<pjb>
hayley: embedding an image in code would depend on the renderer you want to use.
<pjb>
hayley: if you want to do that in an emacs buffer, it's easy enough.
attila_lendvai has quit [Remote host closed the connection]
notzmv has joined #commonlisp
attila_lendvai has joined #commonlisp
lisp123 has joined #commonlisp
lisp123_ has quit [Ping timeout: 258 seconds]
karlosz has quit [Client Quit]
jimka has quit [Ping timeout: 276 seconds]
nij- has joined #commonlisp
yitzi has joined #commonlisp
amb007 has quit [Ping timeout: 256 seconds]
amb007 has joined #commonlisp
<akater[m]>
Bike: Elisp has defsetf and define-setf-expander but they recommend gv instead.
jimka has joined #commonlisp
nij- has quit [Quit: Using Circe, the loveliest of all IRC clients]
retropikzel has quit [Quit: Leaving]
<akater[m]>
beach: re: no longer have an excuse to write Emacs in Emacs Lisp rather than Common Lisp --- porting is hard but what is true, there is less incentive for those who like Common Lisp to write in it rather than in Emacs Lisp.
<akater[m]>
In his article “The Structure of a Programming Language Revolution”, Richard P. Gabriel juxtaposed programming systems and programming languages, and it is likely that people interested in Lisp are inclined to value programming systems as much, or more so, as languages. And Emacs is a programming system that Common Lisp doesn't have while the language is not that different anymore.
cosimone has quit [Remote host closed the connection]
shka has joined #commonlisp
froggey has quit [Ping timeout: 240 seconds]
lisp-newbie has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
lisp-newbie has quit [Client Quit]
lisp-newbie has joined #commonlisp
jimka has quit [Ping timeout: 272 seconds]
lisp-newbie has quit [Client Quit]
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
amb007 has quit [Ping timeout: 272 seconds]
cpape` has quit [Remote host closed the connection]
cpape` has joined #commonlisp
retropikzel has joined #commonlisp
vats has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
cosimone has joined #commonlisp
retropikzel has quit [Quit: Leaving]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
nirnam has joined #commonlisp
amb007 has joined #commonlisp
Josh_2 has joined #commonlisp
<Josh_2>
Hi, is there a way I can see the git commit history from CL? I want to make a sort of 'changelog' for my website
<Josh_2>
altho tbf it would probably be better if I manually write it
<nirnam>
ah yes, exactly what I wanted, thank you :>
vats has quit [Ping timeout: 258 seconds]
Tomte has quit [Client Quit]
<Bike>
keep in mind that it's just a macro mechanism, so for example if your "place" has side effects, they'll be evaluated each time you refer to the symbol
CrashTestDummy2 has joined #commonlisp
silasfox has joined #commonlisp
CrashTestDummy has quit [Ping timeout: 258 seconds]
CrashTestDummy has joined #commonlisp
CrashTestDummy2 has quit [Ping timeout: 245 seconds]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
<akater[m]>
I find it amusing that `(setq x nil)` can execute arbitrary code in CL!
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
pegaso has joined #commonlisp
jimka has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
lisp-newbie has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 268 seconds]
attila_lendvai has joined #commonlisp
hafat has joined #commonlisp
lotuseater has quit [Remote host closed the connection]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
<pjb>
akater[m]: theorically. In practice what happens is either: 1- you get an undefined variable error (rare) 2- it's equivalent to (setf (symbol-value 'x) nil) 3- it's equivalent to (defparameter x nil) ; BAD! 4- it's equivalent to (deflex x nil) ; very rare
amb007 has joined #commonlisp
<pjb>
akater[m]: the problem is that if it declares x special (thru defparameter), then you can spend days debugging expressions using x: (let ((x 42)) (lambda () x)) won't work anymore!
<pjb>
akater[m]: but it's indeed funny that undefined is not really constrained so you could write an implementation that would do really wild things. Like clang, say…
<pjb>
random-nick: if it's already defined, no problem.
<pjb>
random-nick: what is undefined, is when x is not defined yet.
attila_lendvai has quit [Read error: Connection reset by peer]
<akater[m]>
random-nick: That's what I meant.
<pjb>
random-nick: you can assume that deflex would expand to a define-symbol-macro x.
attila_lendvai has joined #commonlisp
lisp-newbie has quit [Quit: This computer has gone to sleep]
<pjb>
The yodaiken article is interesting and important IMO. We can also make this error with the clhs.
<pjb>
Now, when you write tutorials or examples, even in the REPL, it's as easy to write (let ((x 32) (example x)) than (setf x 32) (example x). So DO write (let ((x 32) (example x)) and with emacs, it's really very easy to edit in the REPL!
<pjb>
So there's no excuse not to update old tutorials and write new tutorials correctly.
<pjb>
(let (x) (setf x 42) (example x)) if you insist on setf.
amb007 has quit [Ping timeout: 258 seconds]
amb007 has joined #commonlisp
hafat has quit [Quit: Leaving]
tyson2 has joined #commonlisp
yitzi has quit [Quit: Leaving]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
jimka has quit [Ping timeout: 258 seconds]
mariari has quit [Quit: WeeChat 3.2]
gaqwas has joined #commonlisp
kevingal has quit [Remote host closed the connection]
lotuseater has joined #commonlisp
shka has quit [Ping timeout: 250 seconds]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
tyson2 has quit [Read error: Connection reset by peer]
tyson2 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
amb007 has quit [Ping timeout: 258 seconds]
mariari has joined #commonlisp
amb007 has joined #commonlisp
jimka has joined #commonlisp
jimka has quit [Ping timeout: 240 seconds]
OlCe has quit [Remote host closed the connection]
lisp-newbie has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
nirnam has quit [Read error: Connection reset by peer]
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
nirnam has joined #commonlisp
attila_lendvai has quit [Read error: Connection reset by peer]
attila_lendvai has joined #commonlisp
jimka has joined #commonlisp
vats has joined #commonlisp
peterhil has quit [Ping timeout: 258 seconds]
uai has joined #commonlisp
uai has quit [Quit: WeeChat 3.2]
uai has joined #commonlisp
<lisp-newbie>
Hi, I'm getting when doin: (alexandria-1:alist-plist (param-list)) a plist where each value is itself a list of the value AKA a cons... but I just want the value itself...anyone have any ideas why and how to fix it?
<Josh_2>
Can you show me what you mean?
dsk has joined #commonlisp
jimka has quit [Ping timeout: 256 seconds]
makomo_ has quit [Quit: WeeChat 3.0.1]
makomo has joined #commonlisp
<lisp-newbie>
the outputs? yeah...
<Josh_2>
Yes
<Bike>
lisp-newbie: in an alist the value for a given key is the cdr of the cons. like '((a . 4) (b . 6)) means a = 4, b = 6
<lisp-newbie>
for a list like this: (("id" 24) ("name" "sample - 24, 712 issue 76"))
<Bike>
well, you had an alist where the values are lists
rain3 has quit [Ping timeout: 258 seconds]
<nirnam>
what do you call a list that contain alist in which value are a list?
jimka has joined #commonlisp
<pjb>
lisp-newbie: assoc returns the entry. For an a-list, you can use cdr on the entry to get the value. If you map keys to lists, you can use second instead.
<lisp-newbie>
pjb Bike, thanks, I was dealing with the same function I've been working for the past few days, I got it... I did like this: (map 'list (lambda (it) (cons (symbol-maker (car it)) (cadr it))) alist-nonsymbols)
<pjb>
because with conses: (("list" (1 2 3 4))) == (("list" . ((1 2 3 4))))
<pjb>
The question is whether you have a lot of literal data, in which case you may prefer to avoid the dot (simplier to type), then you must use list operators, or whether you will build the alist by program, in which case you can ignore the question and just use cons and car/cdr. (or acons to build the a-list).
<pjb>
with a lot of literal data, you may even prefer to write p-lists.
<lisp-newbie>
oh gt it
<lisp-newbie>
by program
<lisp-newbie>
*got it
<lisp-newbie>
yeah, thanks, that clears it up, I'm going to check if it works now
<pjb>
p-lists have the advantage of having fewer parentheses, but the inconvenient of not detecting missing keys or values.
<pjb>
(a 1 b 2 c 3) simplier to write. but if you skip a value: (a 1 b c 3) that breaks without noticing.
<Inline>
duhh, no idea but i liked the one sided paren of plisp or so in reduce (algebra system)
<Inline>
heh
froggey has joined #commonlisp
lisp123_ has joined #commonlisp
peterhil has joined #commonlisp
lisp123 has quit [Ping timeout: 272 seconds]
<jcowan>
my brain is a little fried today: is there a CL macro-like thing that is recognized in operand position either as well as, or separately from, being recognized in operator position?
<pjb>
I don't understand the question.
<pjb>
perhaps you mean lambda?
amb007 has joined #commonlisp
<pjb>
(lambda ()) is a macro that expands to (function (lambda ())) in which lambda is (in) an argument.
lisp-newbie has quit [Quit: This computer has gone to sleep]
lisp-newbie has joined #commonlisp
cage has quit [Remote host closed the connection]
pegaso has quit [Quit: Leaving]
nirnam has joined #commonlisp
cage has joined #commonlisp
Fare has joined #commonlisp
silasfox has quit [Ping timeout: 276 seconds]
jimka has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
lisp-newbie has quit [Quit: This computer has gone to sleep]
silasfox has joined #commonlisp
lisp123 has joined #commonlisp
lisp-newbie has joined #commonlisp
mingus has quit [Read error: Connection reset by peer]
mingus has joined #commonlisp
lisp123_ has quit [Ping timeout: 276 seconds]
lisp123 has quit [Ping timeout: 240 seconds]
lisp-newbie has quit [Quit: This computer has gone to sleep]
dlowe has quit [Ping timeout: 245 seconds]
jimka has quit [Ping timeout: 258 seconds]
gaqwas has quit [Ping timeout: 258 seconds]
CrashTestDummy2 has joined #commonlisp
CrashTestDummy has quit [Ping timeout: 252 seconds]
lisp-newbie has joined #commonlisp
pve has quit [Quit: leaving]
<jcowan>
Symbol macros, yes. Thanks.
<lotuseater>
I like those. :)
<jcowan>
I'm not a big fan, but they have their uses.
<lotuseater>
yes
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<lotuseater>
for example one time I used SYMBOL-MACROLET in a function which was a translated geometric algorithm from Pascal
<lotuseater>
so for "better reading" I used eg (symbol-macrolet ((p[i].x (point-x (aref p i))))) to condense this accession to the x coordinate
lisp123 has joined #commonlisp
<jcowan>
A nice case is to somewhat transparently convert a function to a macro. You can't write #'foo where foo is a macro name, but you can write foo where foo is a symbol macro that expands to the function underlying the ordinary macro.
nirnam has quit [Read error: Connection reset by peer]
nij- has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
<nij->
I can't figure this out.. could someone help out? It's related to CFFI and some UNIX socket stuff: %make-unix-socket
amb007 has quit [Read error: Connection reset by peer]
PinealGlandOptic has joined #commonlisp
random-nick has quit [Ping timeout: 245 seconds]
rgherdt_ has joined #commonlisp
amb007 has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
lisp-newbie has joined #commonlisp
amb007 has joined #commonlisp
lisp-newbie has quit [Client Quit]
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
lisp-newbie has joined #commonlisp
lisp-newbie has quit [Remote host closed the connection]
attila_lendvai has quit [Ping timeout: 252 seconds]
selwyn has quit [Quit: Leaving]
uai has quit [Quit: WeeChat 3.2]
<nij->
Bike: oh - I want to send a message from the Lisp repl to the terminal :)
jimka has joined #commonlisp
<dieggsy>
does allegro's excl:dumplisp not work properly if run from sly/slime ?
<dieggsy>
it seems to hang on alisp -I my-image (I also don't know how to start a sly repl from an image)
Melantha has quit [Quit: WeeChat 3.2]
<nij->
dieggsy what's the error message?
<dieggsy>
nij-: no error message, the image just doesn't start up properly if i dumplisp from within sly
<dieggsy>
....i've found a few people online saying saving images while connected to slime/sly doesn't work, so maybe that's just something i hvae to live with?
<dieggsy>
it just sort of hangs forever
<nij->
sly works by connecting to the slynk server
<nij->
maybe it's because that the image is await to be connected to a sly?
<nij->
Last time it didn't let me dump, saying that i will break the thread (that allows the connection)
<dieggsy>
ah, ok. welp. now I know, i guess. it's extremely inconvenient though
<dieggsy>
i wanted to save state after something that takes quite a while to execute
<Xach>
dieggsy: it is very normal for any lisp to not work if there are threads and stuff running.
<Xach>
dieggsy: the normal way to do that is to load things in a single thread and then dump, being careful not to start other extra stuff
<Xach>
or carefully stop it if you do start it
<Xach>
i use alisp dumped images, slynk is loaded but no server started. the server starts when the image restarts.
<dieggsy>
Xach: wait, but that does mean i can't dump after already running slynk, right ?
<Xach>
dieggsy: i think you can, if you stop the server and its threads.
<dieggsy>
Xach: i'm not actually sure how to do that. wouldn't that cut off my connection with the repl
<Xach>
dieggsy: one of them, yeah. but allegro has a rich repl by default, and can also do batchy things too (which is a good way to set up an image to dump)
<Xach>
in other words: you should not generally be interactively initiating an image dump from a repl like sly's.
<dieggsy>
ah. ok. and the way around this would be to... start some other repl from which i start a slynk server that I connect to with sly, and stop sly when I want to dump, doing so from the original repl?
<nij->
Bike: Nvm, I found a workaround! Finally :) thanks for reaching out!
<nij->
You stop slynk, not sly dieggsy
<nij->
sly is on the emacs' side. Slynk is the thread that's run from the perspective of the lisp repl.
<dieggsy>
er, right. that
<nij->
In particular, there's `slynk.lisp` and `sly.el`.
<nij->
So you wouldn't want to start slynk at all..
<dieggsy>
well, I'd want to if i want to interact with lisp from emacs using sly
<nij->
But maybe there's some workaround. I dunno \@_@/
<dieggsy>
the point is to have the convenience of sly but be able to save an image as well
<dieggsy>
so I'd have to start and stop it when i needed to do that
<Xach>
dieggsy: in my experience making an image is very batchy. not something you do after a fun interactive session.
<Xach>
I'm open to new paradigms but that's my experience
<nij->
I think dieggsy wants a running slynk once it's started.
<nij->
Is that what you want?
<nij->
Oh perhaps not \ @@ /
<dieggsy>
What I want is just to save an image after a REPL session like I can do from a terminal, because then I can later start a repl using that image
<dieggsy>
which works fine on the terminal
<dieggsy>
but doesn't let me do fun emacs stuff
<Xach>
dieggsy: i haven't seen people do that - i think it would take a little creativity but maybe it's not too hard
<Xach>
being aware of what threads might be doing stuff and stopping them
<nij->
You can perhaps create a thread that sleeps for 20 seconds, and then wake up, killing all other threads, and save+die.
<nij->
That will kill slynk and the connection to sly too xD
<dieggsy>
Basically this is just because we have a program that's largely interacted with through the repl and sometimes to debug I read in a bunch of objects from a database, which can take a couple hours. It'd be nice to have an image to start from where this is all pre-loaded. I can probably just set this up once from the terminal and try and connect to that image with sly/slynk, since I don't have to do this regularly. Might try that next