xkapastel has quit [Quit: Connection closed for inactivity]
<krwq>
when loading file with quicklisp (possibly also asdf) why do function have to be defined in order (i.e. https://pastebin.com/qfYXGK5G but defining a first produces the error) - this makes sense to me if i executed them one by one but when loading the whole file I feel like this should just work
<|3b|>
quicklisp uses asdf to load things, so should behave similarly
<|3b|>
is it an error or warning?
<krwq>
error i think
<krwq>
either way it won't just load
<|3b|>
odd, would expect warning
<|3b|>
but LOAD works similarly to repl. it READs a form, then EVALuates it
<|3b|>
COMPILE-FILE processes whole file at once, so can do as you expect
<|3b|>
and it returns name of output file, which you can LOAD, so (LOAD (COMPILE-FILE "foo.lisp")) is a common idiom
<krwq>
but the function doesn't get executed until later so im not sure why does it complain
<|3b|>
hmm, you said ql/asdf though, which should be using compile-file
<|3b|>
are you calling A from a macro?
<krwq>
|3b|: no, does possibly :serial t in the asd file make any difference or is it just for order of files
<|3b|>
that just orders the files
* |3b|
doesn't even get an warning from LOADing the example you pasted, is real code public anywhere? (on SBCL)
<mfiano>
Hmm, I need some help figuring out how to do something with the MOP
<|3b|>
ah, that was the 'correct order' version
<Bike>
what is it that you are trying to do
<mfiano>
I know about `closer-mop:slot-definition-initargs` which will give me the initargs given a class. But how would I discover initargs not present in the class? Like if I specialize a `reinitialize-instance` method, I would like to get those valid initargs as well. Basically I'm trying to get all initargs that can be supplied to `make-instance`.
<|3b|>
with A first, i only get a STYLE-WARNING, but loads fine
<Bike>
mfiano: oh, that's tricky, but doable. let me organize myself a bit
<krwq>
|3b|: let me check if that's the warning or error - either way I'd expect debugger not to pop up
<|3b|>
so without seeing full code i can only guess you somehow try to call it too soon
<mfiano>
Bike: Ok, thank you.
<krwq>
|3b|: actually i might be calling it when I think about it - i often put tests as top-level asserts under the function itself
<Bike>
make-instance initargs are slot initargs but the keys of allocate-instance and initialize-instance and shared-initialize
<Bike>
so you'd have to uh
<Bike>
probably take all the initargs, and then look at the applicable methods for those three functions, and get the keywords out of those
<|3b|>
krwq: not even a style-warning if i put iit in a file loaded by asdf/ql
<Bike>
the implementation has something to compute this, but it's not exported
<krwq>
|3b|: i think this might be related to the asserts, let me put them in the bottom of file and see if it works
<Bike>
can i ask what you're doing with that information?
<Bike>
oh, and SLIME computes it too
<|3b|>
krwq: yeah, trying to test a function before defining things it calls would error :)
<krwq>
|3b|: kinda makes sense I guess :)
<|3b|>
(assuming good testing that exercised the code path with the call)
<mfiano>
If this isn't vague enough, we're writing a DSL for a game engine, and we want compile-time type-checking for the part of the language that generates forms to create instances.
<Bike>
it involves a lambda list parser for the methods
<krwq>
|3b|: thanks |3b| - completely forgot about the asserts, i wrote the file a while ago and had to do some changes today when I hit this
<mfiano>
Ah, would you recommend your sandalphon parser, or something else? I always get frustrated when looking for things to parse lambda lists and just write my own special purpose hacks.
<krwq>
mfiano: alexandria had something for that
<krwq>
mfiano: (might be missing the context)
<Bike>
just use alexandria's
<pillton>
Does alexandria's work on methods?
<Bike>
iunno
<mfiano>
It only parses OLL's
<pillton>
It only has ordinary lambda lists.
<pillton>
I think Shinmera has something.
<Bike>
(member '&key lambda-list would be enough to just to get them, really
<pillton>
Good point.
<Bike>
plus allow other keys would be necessary to i guess
<pillton>
I don't think it matters for method lambda lists.
<Bike>
it does in this c ontext
<pillton>
Oh it does.
<mfiano>
What do you mean other keys?
<Bike>
i mean &allow-other-keys
<mfiano>
Oh, right. Can't really use `member` then, right?
<mfiano>
Or what are you suggesting?
<pillton>
Why not? &allow-other-keys must come after &keys.
zotan has quit [Ping timeout: 268 seconds]
zotan has joined #lisp
<Bike>
you can use member, i'm just saying you'd have to look for allow other keys as well
<mfiano>
Ok. I'm not very familiar with the MOP. What will give me the lambda list for reinitialize-instance?
mulk has quit [Ping timeout: 250 seconds]
noloop has quit [Ping timeout: 256 seconds]
<Bike>
well you don't need the lambda list for reinitialize instance
<Bike>
you need the lambda lists for the methods of reinitialize-instance relevant to the particular class you're looking at
keep_learning has quit [Quit: Ping timeout (120 seconds)]
<mfiano>
Yeah, that's what I mean actually.
<Bike>
you can calculate those methods with compute-applicable-methods(-using-classes), then use mop:method-lambda-list
mulk has joined #lisp
<no-defun-allowed>
how does the CLIM listener handle drawing graphical representations of values?
keep_learning has joined #lisp
keep_learning has quit [Quit: Ping timeout (120 seconds)]
<mfiano>
Bike: I can get c-a-m to work, but I can't figure out how to get c-a-m-u-c to work. I just get a no applicable method error. Can you provide an example of using this?
<aeth>
I can parse function lambda lists except for &aux. It wouldn't take much to add method support because I designed it for my extended lambda list syntax that basically is the defmethod lambda list for types instead of classes and with the addition of &key and &optional support, which defmethod doesn't support.
<aeth>
It would take some work to librarify it, though, because I basically use it for define-function and related things, like local function bindings with the same syntax.
<aeth>
s/the same syntax/the same lambda list syntax/
metallicus has quit [Quit: WeeChat 2.3]
zotan has quit [Ping timeout: 250 seconds]
<mfiano>
Ah I see. I was passing in a symbol instead of a function object.
zotan has joined #lisp
<fiddlerwoaroof>
no-defun-allowed: it uses a thing called "presentations" to associate a value with a particular display on the screen
<no-defun-allowed>
right
<fiddlerwoaroof>
I'm not quite sure how the default representation of, e.g., repl results is handled
<fiddlerwoaroof>
Maybe by specializations of CLIM:PRESENT?
<no-defun-allowed>
that'd make sense
<fiddlerwoaroof>
It probably depends a lot on the context
<fiddlerwoaroof>
Because WITH-OUTPUT-AS-PRESENTATION associates a value with the arbitrary display produced by its body, iiuc
<mfiano>
Bike: Stupid question. Why do I get an applicable method specialized on SB-PCL::SLOT-OBJECT in addition to the class specializer when computing methods for reinitialize-instance?
<Bike>
in sbcl, slot-object is a superclass of standard-object
<Bike>
so there might be methods on it
<mfiano>
Ah i see
akoana has left #lisp ["Leaving"]
jason_m has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
<LdBeth>
Good evening
mrcom has joined #lisp
notzmv has quit [Quit: WeeChat 2.3]
mulk has quit [Ping timeout: 258 seconds]
mulk has joined #lisp
notzmv has joined #lisp
akoana has joined #lisp
keep_learning has joined #lisp
esrse has joined #lisp
akoana has left #lisp [#lisp]
mrcom has quit [Read error: Connection reset by peer]
jason_m has quit [Ping timeout: 268 seconds]
keep_learning has quit [Quit: Ping timeout (120 seconds)]
anewuser has joined #lisp
mrcom has joined #lisp
<drl>
\q
dddddd has quit [Remote host closed the connection]
hectorhonn has joined #lisp
<hectorhonn>
morning everyone
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
<no-defun-allowed>
morning hectorhonn
themsay has joined #lisp
wusticality has quit [Ping timeout: 258 seconds]
lavaflow has joined #lisp
mulk has quit [Ping timeout: 240 seconds]
mulk has joined #lisp
kdas_ has joined #lisp
kushal has quit [Ping timeout: 256 seconds]
<LdBeth>
does SBCL has %address-of ?
<|3b|>
what would it do?
<|3b|>
APROPOS doesn't show that specific symbol anywhere though
<LdBeth>
like print the number part of #<SHIP #x302000ECCD0D>
<|3b|>
just for display or for use as a pointer?
<Bike>
that number part is due to the :identity argument in print-unreadable-object
<Bike>
it's not suitable for mmuch else
<|3b|>
^ for dissplay
<|3b|>
there is sb-kernel:get-lisp-obj-address if you want to poke into internals (and understand that you will probably break things, and it can change at any time, unsupported, etc)
<|3b|>
keep in mind GC can move things around at any point, so for most objects that can change unpredictably
kdas_ is now known as kushal
<LdBeth>
|3b|: just for display
<LdBeth>
Bike: ah, I see
<|3b|>
probably best to just use print-unreadable-object then, more or less portable even :)
<|3b|>
possibly combine with with-output-to-string
<|3b|>
(string-trim "#<>{} " (with-output-to-string (s) (print-unreadable-object (nil s :identity t)))) or something
<|3b|>
(replace NIL with your object)
keep_learning has joined #lisp
<|3b|>
possibly add x to chars to trim (or remove # and skip 1 char)
keep_learning has quit [Client Quit]
nirved has quit [Quit: Leaving]
<LdBeth>
|3b|: thanks, I'll use print-unreadble-object
keep_learning has joined #lisp
mulk has quit [Ping timeout: 244 seconds]
pierpal has joined #lisp
pierpal has quit [Client Quit]
mulk has joined #lisp
pierpal has joined #lisp
nirved has joined #lisp
igemnace has joined #lisp
igemnace has quit [Client Quit]
Lord_of_Life has quit [Ping timeout: 250 seconds]
patrixl has joined #lisp
Lord_of_Life has joined #lisp
marvin2 has quit [Ping timeout: 250 seconds]
drl has quit [Quit: WeeChat 1.4]
<beach>
Good morning everyone!
permagreen has joined #lisp
<patrixl>
hi beach
noobineer has joined #lisp
patrixl has quit [Quit: ERC (IRC client for Emacs 26.1)]
patrixl has joined #lisp
patrixl has quit [Remote host closed the connection]
patrixl has joined #lisp
mulk has quit [Ping timeout: 268 seconds]
mulk has joined #lisp
sauvin_ has joined #lisp
sauvin has quit [Ping timeout: 272 seconds]
mulk has quit [Ping timeout: 246 seconds]
ealfonso has joined #lisp
wusticality has joined #lisp
ntbre has joined #lisp
Bike has quit [Quit: Lost terminal]
ealfonso has quit [Read error: Connection reset by peer]
SlashLife has quit [Ping timeout: 252 seconds]
noobineer has quit [Ping timeout: 250 seconds]
sauvin_ is now known as Sauvin
shifty has quit [Ping timeout: 250 seconds]
wusticality has quit [Ping timeout: 272 seconds]
wusticality has joined #lisp
igemnace has joined #lisp
igemnace has quit [Client Quit]
wusticality has quit [Ping timeout: 246 seconds]
_whitelogger has joined #lisp
scottj has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
verisimilitude has joined #lisp
APic has quit [Ping timeout: 250 seconds]
sindan has quit [Remote host closed the connection]
mrcom has joined #lisp
bexx has quit [Remote host closed the connection]
APic has joined #lisp
ntbre has quit [Quit: ntbre]
DGASAU has joined #lisp
DGASAU has quit [Ping timeout: 260 seconds]
stereosphere has joined #lisp
iovec has quit [Quit: Connection closed for inactivity]
<beach>
Yes, POINT in that position is called a METHOD SPECIALIZER.
<beach>
It means define a method on the generic function DRAW that is only applicable when its parameter P1 is an instance of the class POINT.
scymtym has quit [Ping timeout: 252 seconds]
<beach>
In the second case, you have an ordinary function with two parameters.
<beach>
It means: Define a function named COLORS-SLIDER-DRAGGED with two parameters. The first parameter is named SLIDER and the second parameter is named VALUE.
<asarch>
Oh, I thought it was an "instance" of the class 'slider'
<asarch>
Thank you
<asarch>
Thank you very much :-)
<beach>
The reader of the code might guess that the value of the SLIDER parameter is indeed an instance of the class SLIDER.
<beach>
That would be a very sane naming convention.
<asarch>
I still have a lot of C in my mind that confuses me a lot with Common Lisp way of life :-(
<beach>
You will get used to it. But it requires work.
<beach>
That's what you seem to be doing though, so that's good.
wusticality has quit [Ping timeout: 258 seconds]
<asarch>
A while ago I was confused by "(null ...)" instead of "(nil ...)"
<beach>
I think I saw that, but it was explained to you, right?
<asarch>
Yeah, yeah. Everything is fine now. Thanks
<beach>
Good.
<dim>
learning CL is quite a journey indeed
<asarch>
Yeah :-)
<asarch>
BTW, beach you are in France, right?
<beach>
Indeed.
<asarch>
I hope everything is ok
<beach>
Why?
<beach>
Well, sort of. :)
<asarch>
I saw some disturbs there in the news
<beach>
It's been going on for 8 weeks now. Every weekend.
<beach>
It is not as bad as it was.
<asarch>
Thank God :-)
pierpal has quit [Quit: Poof]
<jackdaniel>
or some other demiurg-ish being which maintain the order in France ;-)
pierpal has joined #lisp
<beach>
Heh.
<asarch>
So, the only way to "declare" a function with an instance of a class as one of its parameters is with DEFMETHOD?
<asarch>
You can't with DEFUN?
<beach>
Correct, ordinary functions do not specialize their parameters.
<beach>
Only methods on generic functions can do that.
hhdave has joined #lisp
<beach>
And DEFUN does not DECLARE a function, it DEFINES it.
<asarch>
So, there is no concept of "friend functions" in CLOS like with C++, right?
<shka__>
there is no private methods
<shka__>
or protected methods
<beach>
There is no need for anything like that, since classes do not imply encapsulation in Common Lisp.
<beach>
asarch: Maybe in your case, it is best to try to forget what you know about C or C++ when you work with Common Lisp.
* asarch
takes *a lot of* notes...
<TMA>
asarch: that does not mean that a function defined by DEFUN is unable to accept arguments of the desired type. it is just that there is no discrimination on the type of the passed argument, unless you write the discrimination yourself
<asarch>
Yeah, I need a red pill :-(
<schweers>
On the topic of encapsulation: is there a way to do proper encapsulation in Lisp? Not that I even found a need for it ...
<beach>
What is "proper encapsulation"?
<beach>
I mean, the package system is used for modularity.
<schweers>
goood question. I guess having some value which cannot be seen or even set by "outside" code?
<TMA>
schweers: it can be done by using uninterned symbols for names, but that's awful
<schweers>
I know and it has always been enough for me. But the hiding is based on convention, the language doesn’t enforce it.
<beach>
schweers: You don't trust yourself?
<beach>
schweers: You define those things in a separate package and you don't export their names.
<schweers>
I do, I’ve never had the need for such a thing. But many people want it. Also, I’m curious. Hence my question
<beach>
You can't do that in C++ either.
<TMA>
schweers: you can use let over lambda to the effect of private variables
<schweers>
beach: you can work around it in C++, but I think not portably, right?
<beach>
Bah, #define private public?
<beach>
or use GDB.
<schweers>
Okay, you’re right
<schweers>
<|3b|>
closures tend to hide things in a way that is hard to get to, so you could use them if you really wanted to
<schweers>
So if a C++ or Java person were to come on here and ask how to do private members in CLOS or lisp in general, you’d rather explain why it’s misguided to enforce it in the first place?
<heisig>
schweers: Proper encapsulation sounds like you have to give up root permissions on your own computer. Even then, you could still physically destroy the computer :)
<shka__>
schweers: furthermore, it would be really difficult to have C++/java style encapsulation in dynamic language like Common Lisp
<shka__>
it really does not blend itself into incremental workflow
<jackdaniel>
schweers: if you want to encapsulate interfaces there is an easy solution for that: you put all in a package and export only "public" things
<|3b|>
schweers: how do i haul furniture on a motorcycle?
<jackdaniel>
as of preventing from direct slot access, you may name your slots with gensym (macro is needed) and enforce proper method interface via readers/writers/accessors
<schweers>
I think my question has been answered :) To be clear: I’m with you all, I was asking this as a hypothetical
<schweers>
<jackdaniel>
of course this may be worked around with mop and listing slots
<schweers>
Oh, right ... MOP
<jackdaniel>
otoh I'm sure MOP would allow you to secure them even more ;-)
<jackdaniel>
also that, connected with backtrace capabilities: you would be able to see who calls your method and see, if it is a "friend"
<jackdaniel>
so technically that would be possible, it just doesn't make a lot of sense
<schweers>
lol
<|3b|>
also hard to compare features between languages. is the #define trick, or accessing 'private' slots with pointers comparable to accessing unexported symbols, or using MOP?
<schweers>
I have a feeling that accessing unexported symbols or even using MOP is more stable. But anyway, it was a hypothetical question anyway
<|3b|>
or using debugger APIs in either language
<shka__>
schweers: C++ style encapsulation is overrated anyway
<schweers>
shka__: I guess ... I wonder how much it is still used.
<shka__>
it is very much used, and it is somewhat helpfull in some projects, but it comes with downsides and make dynamic style of programming PITA
<shka__>
but i used to work in crappy C++ corpo-projects full of outsourcing programmers and there encapsulation had it's place
<asarch>
Well, thank you guys
<asarch>
(bed-time)
<asarch>
Have a nice day :-)
asarch has quit [Quit: Leaving]
<schweers>
shka__: sounds like a lot of pain :(
<shka__>
yeah, not a good time
larryba has joined #lisp
status402 has quit [Read error: Connection reset by peer]
status402 has joined #lisp
longshi has joined #lisp
adam4567 has joined #lisp
gigetoo has quit [Ping timeout: 258 seconds]
gigetoo has joined #lisp
KingRiver has quit [Ping timeout: 246 seconds]
Sauvin has quit [Ping timeout: 246 seconds]
nirved is now known as Guest26174
Sauvin has joined #lisp
nirved has joined #lisp
Guest26174 has quit [Ping timeout: 252 seconds]
sauvin_ has joined #lisp
Sauvin has quit [Ping timeout: 245 seconds]
<ogamita>
schweers: for private members or methods, we could talk about the % naming convention. A symbol starting or ending with a % could be considered "private" and "dangerous to use, know what you're doing". But nothing prevents you to use such symbol, even if they're not exported from a package.
hectorhonn has quit [Quit: Page closed]
<ogamita>
schweers: it is assumed that the lisp programmer is smart and knows what he's doing.
<schweers>
Exactly, nothing prevents others from using this. I’m fine with this and I do this (I think I saw this convention in some code written by beach). I was just wondering if a more strict enforcement was possible. Not because I want to use it, but just as a hypothetical question because I’m curious.
<ogamita>
with packages, there's the notion of exported symbols and non-exported symbols. The later can be considered "private".
<schweers>
ogamita: doesn’t every language community assume that their members are smart and know what they are doing?
<schweers>
Well, maybe not the java community.
<ogamita>
schweers: the only difference is that expored symbols can be accessed direct when the package is used, or qualified with a single colon, while the non-exported must be qualified with two colons: foo:exported-sym foo::non-exported-sym.
<ogamita>
schweers: perhaps, but the difference is that most lispers do, while most Cer or C++er don't.
<ogamita>
cf. shka__'s comment: <shka__> but i used to work in crappy C++ corpo-projects full of outsourcing programmers and there encapsulation had it's place
<ogamita>
this is the sad state of affairs…
sauvin_ is now known as Sauvin
<schweers>
I am very glad not to work in such an environment
pierpal has quit [Quit: Poof]
<LdBeth>
well, the point is modules won't attack each other
pierpal has joined #lisp
<schweers>
I wonder how people test their code if it’s full of private stuff ...
<TMA>
they don't
<schweers>
Especially the java community seems to do it, but they also seem to jump though an awful lot of hoops to do so.
<schweers>
<schweers>
Not that I set such a good example when it comes to testing code, mind you
<LdBeth>
no, they do static analysis
<shka__>
schweers: well, this is why TDD took off in java
<shka__>
if you are encapsulating everything, if you are not starting from the tests, you are likely to write untestable code
<schweers>
I’m not sure that is correct
<schweers>
<schweers>
You can still test the public interface. But yes, testing the more low-level stuff is difficult in such a scenario.
<shka__>
yes
<shka__>
but whole java object orientation approach is kinda ankward
<schweers>
I agree. Not that C++ is much better …
<shka__>
it is basicly the same
<schweers>
Well, java doesn’t even have C++’s broken MI. I’m still not sure which is better in that regard.
<shka__>
well, I recommend programming in CL if possible anyway
<schweers>
speaking of which: I think we have been off-topic for way too long anyway) ;
<shka__>
it is very 'agile' env with good interactivity
<schweers>
s/) ;/;)/
scymtym has joined #lisp
Lord_of_Life has quit [Ping timeout: 258 seconds]
scymtym has quit [Ping timeout: 260 seconds]
<jackdaniel>
when you acquire tao of programming you patiently wait for problems to fade away due to changed requirements, then you achieve the goal without even touching the keyboard ;-)
adam4567 has left #lisp ["ERC (IRC client for Emacs 24.5.1)"]
wusticality has joined #lisp
Lord_of_Life has joined #lisp
<ogamita>
exactly.
<ogamita>
schweers: and anyways, you should not test the internals, but the public APIs.
<ogamita>
(but then of course, it's Russian dolls: the internals are also decomposed into public API and clients, so you can test the internal APIs too).
<ogamita>
But the more internal the code, the more often it can change. The point of having API and distinguishing implementation from interface, is that you can change the implementation anytime, without breaking the rest of the program, since it only uses the public API.
<ogamita>
So if you test internal, as soon as you change it, you have to throw away the tests and write new tests for the new internals.
wusticality has quit [Ping timeout: 268 seconds]
robdog has quit [Remote host closed the connection]
yvy has quit [Read error: Connection reset by peer]
dddddd_ has joined #lisp
jmercouris has joined #lisp
dddddd_ is now known as dddddd
<jmercouris>
how can I edit the value of something in a plist?
<jmercouris>
e.g. how can I go from (list :a "fish" :b "salmon") -> (list :a "fish" :b "carp")
robdog has joined #lisp
esrse has quit [Quit: 굿나잇]
<shka__>
jmercouris: use member for :b, then (setf (second result) "carp")
<shka__>
it will return nil if there is no :b
pierpal has quit [Quit: Poof]
Selwyn has joined #lisp
<jmercouris>
I was hoping there was something I had overlooked, but ok, manually it is
<jmercouris>
thanks for confirming
pierpal has joined #lisp
<shka__>
alternative approach, sometimes usefull is to simply insert :b "carp" into front of the list
<jmercouris>
and then do an nreverse with a remove :D?
<shka__>
no, leave it be
<jmercouris>
I understand getf would return the first one
<jmercouris>
but I don't like it, feels dirty
<jmercouris>
however clever it may be
<shka__>
ah, it has use though
<shka__>
since removing the new value from such alist will restore original value!
<shka__>
which is pretty useful i would say
<jmercouris>
I guess it could be useful
robdog has quit [Ping timeout: 250 seconds]
<heisig>
jmercouris: There is (let ((plist (list :a "fish" :b "salmon"))) (setf (getf plist :b) "carp") plist). But you are right, it is dirty.
robdog has joined #lisp
robdog has quit [Read error: Connection reset by peer]
scymtym has joined #lisp
<beach>
jmercouris: Since a plist is not an abstract data type, you should not expect anything better.
m00natic has joined #lisp
<jmercouris>
well, it is called LISP for a reason...right? :D
<beach>
What do you mean?
<jmercouris>
list processing
<jmercouris>
so you know, the facilities for list processing are generally pretty good
<jmercouris>
seem to be lacking in the plist area though
<beach>
Not at all.
<jmercouris>
which of my statements?
<beach>
What I am saying is that neither list not plist is an abstract data type, so you can't expect them to have identity-preserving abstract operations on them.
<jmercouris>
oh I see, ok, yeah, that is true
<jmercouris>
I'm so close to using objects
<jmercouris>
I'm going to stick it out for a little longer though
<beach>
Lisp provides excellent concrete data types, but you have to create the abstract ones yourself (mostly).
akoana has joined #lisp
<beach>
In this case, it looks like you need an ADT called a "dictionary".
<jmercouris>
I don't get to choose the data type I'm working on without some complex transformations
<beach>
and a plist is but one possible concrete data type to build upon in order to create a dictionary ADT.
<jmercouris>
they come out of the database as a plist...
<jmercouris>
due to sxql
<beach>
I am so sorry to hear that.
<jmercouris>
I mean datafly*
Lycurgus has joined #lisp
<schweers>
jmercouris: well, you could put the data into a hashtable or something similar, do your processing and create a new plist again (if needed).
<jmercouris>
however here is what doesn't make sense
<jmercouris>
I can't seem to edit the plist in place inside my loop
<jmercouris>
it won't push those values to the list...
<heisig>
jmercouris: The only reason to ever use plists is that their printed representation looks pretty. For anything else, use alexandria:plist-[alist,hash-table].
<jmercouris>
within the loop, my "product" is updated, but it is not updated within the products list...
<schweers>
I don’t think you can do that, as PRODUCT comes rom PRODUCTS. If you push to PRODUCT, that will not change the list PRODUCTS
<jmercouris>
PRODUCTS is composed of PRODUCT lists
<jmercouris>
so it stands to reason that modifying a PRODUCT within PRODUCTS will change PRODUCTS
<schweers>
If I’m not mistaken, PUSH creates a new cons, and sets the reference (in your case PRODUCT) to this new cell.
<schweers>
<shrdlu68>
I don't understand. why is it "dirty"?
<jmercouris>
it is dirty because you have not deleted the old data
<schweers>
This will not change the list from which you are taking the list you are “pushing to”
<jmercouris>
ok, so I'll need to actually do the consing myself
<jmercouris>
ffs...
<beach>
jmercouris: You don't seem to understand.
<beach>
jmercouris: A list is not an abstract data type either.
<beach>
jmercouris: So PUSH changes the variable but not the list.
<schweers>
you could collect the PRODUCT values into a new list, if you want to keep the rest of your code the same.
<shrdlu68>
jmercouris: Old data?
<jmercouris>
shrdlu68: pushing to the beginning of an alist when there is an existing entry with the same "key" means that the old key/value pair is still there
<jmercouris>
they are not key/values, but for lack of a better term...
<shka__>
jmercouris: as PCL says: there is no list
<shka__>
there are just cons cells
<beach>
jmercouris: What is the result of this code: (defparameter *l* '(1 2 3)) (let ((l *l*)) (push 234 l)) *l*
<jmercouris>
(1 2 3)
<beach>
Yes, and that's what you have too.
<beach>
So your PRODUCT corresponds to L here.
<beach>
The list doesn't change.
<jmercouris>
yeah, I get it
<jmercouris>
symbol only points to the first cons cell in the list
<shrdlu68>
jmercouris: Oh, my bad, thought you were talking about setf getf.
<jmercouris>
and pushing will change the value
<beach>
jmercouris: Besides, you are not allowed to alter a list being iterated over in a LOOP.
<jmercouris>
beach: are you sure? I heard someone say the opposite some time ago I think
<beach>
Names, please!
<jmercouris>
It was a long time ago, I can't remember
<shrdlu68>
jmercouris: I think (setf (getf foo :b) "carp") is a clean way to do it.
<jackdaniel>
lists make goods equences but they make bad abstraction vehicle
<beach>
Oh, you mean that you will use a STANDARD OBJECT.
<jmercouris>
lol, yes :D
<jmercouris>
well, I'll use something extending standard object
<beach>
Xach: Heh.
<beach>
jmercouris: An instance of a subclass of the class X is an X.
<shrdlu68>
shka__: Why not, in this case?
<beach>
If TAX-PAYER inherits from PERSON then a tax payer (i.e. an instance of TAX-PAYER) is a person (i.e. and instance of PERSON).
<schweers>
beach: I’d like to thank you for your precise definitions. They may seem like nitpicking at first, but I am very glad you do this.
<beach>
Precision is very important in discussions like this.
<jmercouris>
I appreciate it as well, hence why I'm not getting angry
<beach>
Otherwise, there will be endless quibbling.
<schweers>
Of course it is, but not everyone knows all the details by heart (I certainly don’t).
<beach>
That's why I repeat them from time to time.
<jmercouris>
I used to get angry at it, but I see the value in it now, at least within the context of a programming dicsussion, my significant other seems to disagree with regard to other topics...
<shka__>
shrdlu68: in this case list could be :initform '(:a "b") in defclass, and so it would be created during read time
<schweers>
also: thank you for your patience!
<shka__>
therefore you mutate same instance in very surprising way
<shka__>
so yeah, i would rather not mutate conses, unless i just created those
<shrdlu68>
I see, would that apply to a hash-table as well?
<shka__>
in the same function
<shka__>
to a lesser extent i would say
nowhere_man has quit [Ping timeout: 244 seconds]
<beach>
shka__: Which is why you hide the entire mutation behind an API so that you can make sure that the CONS cells you mutate are the ones you created yourself.
<shrdlu68>
So that's not really something specific to lists.
longshi has quit [Ping timeout: 252 seconds]
<shka__>
shrdlu68: lists are often created at the read time and also multiple lists tend to share tails
<shka__>
so side effects in lists propagate like crazy
<shka__>
as beach said, if you need to mutate state you are better of making some kind of API
<shka__>
or perhaps using container library
<shka__>
which will hide state for you
kajo has quit [Ping timeout: 252 seconds]
<shrdlu68>
I never thought about that, but I feel like this is a lesson about creating standard object...
<shka__>
i don't think so
<shrdlu68>
or other such data structures, rather than a reason to not use plists.
<shka__>
i think that it is just lesson about managing state
<shka__>
and containing it
<shka__>
and "don't mix mutable and inmutable"
Lycurgus has quit [Ping timeout: 272 seconds]
amerlyq has joined #lisp
Arcaelyx has joined #lisp
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
<jmercouris>
so READ, it takes an input stream, so if you have a stream you have to make an input-stream and then pass it
<jmercouris>
is there another function or a way to just directly READ from a string?
<jackdaniel>
read-from-string has a suspiciously similar name
<jmercouris>
sorry there was a typo above, I meant to say "so READ, it takes an input stream, so if you have a *STRING* you have to make an input stream and then pass it"
<jmercouris>
jackdaniel: ok, I read some misinformation on stack-overflow which made me not investigate, should have checked CLHS, thanks for tip!
<Selwyn>
is there any community desire or effort to roll out abstract data types?
<jmercouris>
your question is so abstract I don't understand
<jmercouris>
you mean something like what alexandria provides?
<Selwyn>
ha
<jmercouris>
I was being serious, I don't understand the question
<jmercouris>
abstract data types? you mean data structures or what?
<Xach>
Selwyn: there is at least one library to do it.
<Selwyn>
beach said earlier `Lisp provides excellent concrete data types, but you
<Selwyn>
have to create the abstract ones yourself (mostly).'
<Selwyn>
yes for data structures
<jmercouris>
there are several that implement specific data structures
<jmercouris>
and they come with corresponding functions/methods for manipulating those data structures
<jmercouris>
however I don't think there is a de-facto library, if there is, I am not aware of it, then again I'm not a good source, as I am not aware of a lot of things
<Selwyn>
thank you
nowhere_man has joined #lisp
<jmercouris>
for example, if I wanted to use skip lists, I would just google "cl skip lists"
<shka__>
Selwyn: i have library just for this purpose
<shka__>
not in the quicklisp because it sucks a little bit to much
emar has joined #lisp
<Selwyn>
thank you. at first glance it reminds me somewhat of the Java Collections API
<Selwyn>
in a good way ;)
<shka__>
well, api is unstable, documentation is incomplete and so one
<shka__>
but it is usefull to me
<larryba>
is there a map function that only alters the elements, and leaves the data structure intact? so, if I pass a list, I should get list back. if I pass a string, I want string back
<shka__>
larryba: (map (type-of input) function input)
<jackdaniel>
doesn't he want something more like (prog1 sequence (map nil function sequence))
<larryba>
is (type-of input) actual syntax?
<jackdaniel>
map accumulates results of function applies to elements
<larryba>
I'll try
<jackdaniel>
applied°
aindilis has quit [Read error: Connection reset by peer]
<larryba>
it worked for lists
<larryba>
jackdaniel I don't know what that does, but based on my test with lists, shka__'s example works
<shka__>
larryba: type-of is legit function
<Selwyn>
jackdaniel: i think larryba wants only a non-destructive map
<larryba>
yes
<Selwyn>
then this is it
pierpal has quit [Quit: Poof]
<jackdaniel>
OK, I misunderstood what he said then
pierpal has joined #lisp
<larryba>
basically, (map .. (lambda (x) x) input) should just return input
aindilis has joined #lisp
<larryba>
(map (type-of input) ..) does that for strings, lists and vectors. which is good enough for me
wusticality has joined #lisp
<Xach>
(map-into (copy-seq thing) fun thing) is another option.
<jackdaniel>
larryba: (map type function sequence1 sequence2 …) actually creates a new sequence which holds results of applying function to elements of enlisted sequences, it doesn't return sequence1 itself
<jackdaniel>
(or if type is nil, it doesn't accumulate results)
JetJej has joined #lisp
<jackdaniel>
so if you do (map 'list (lambda (e) (1+ e)) #(1 2 3 4))
<jackdaniel>
you will have a list (not a vector)
<jackdaniel>
of course that could be shorter: (map 'list #'1+ #(1 2 3 4))
<larryba>
jackdaniel, I know. what I meant to say is that it should return identical copy
<jackdaniel>
maybe I've sipped to little coffee because it is still not clear to me what you are saying, I'll back off :-)
<Xach>
margaritamike: what does that module do?
<larryba>
jackdaniel, if I pass it a list, it should return a list. if I pass it a vector, it should return a vector. etc. shka__'s solution does that, so all is good. :)
<margaritamike>
it's for sending http requests Xach
<larryba>
Xach, any reason to prefer that over (map (type-of thing) fun thing)? does it work with more containers?
Lycurgus has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
<margaritamike>
Selwyn: is that the most popular one?
<margaritamike>
looks like it hasn't been updated since 2017 o.o
<jackdaniel>
OK, word "identical" confused me, because function is not necessarily #'identity. 'of identical sequence type' would make it clear to me.
<Selwyn>
it is recommended as a catch all solution in 'Common Lisp Recipes' - admittedly published in 2015
<schweers>
margaritamike: why do you think that is a bad thing?
<schweers>
<splittist>
margaritamike: what changes in the http protocol since 2017 are you concerned about?
orivej has joined #lisp
<Selwyn>
margaritamike: in general, one can expect to use Common Lisp libraries not updated in that timeframe without concern, whereas this is not as common in, say, the Python world for various reasons
<larryba>
jackdaniel, (map (type-of input) (lambda (x) x) input) will return identical copy of input, in every regard. if compiler is smart enough, and input's type is immutable, it could even just return input
<margaritamike>
well i saw there were quite a few issues in the repo not being tended to
<margaritamike>
so i thought it'd be a good idea if bugs were actively being fixed
<margaritamike>
is this the most popular http library?
<shka__>
larryba: it will not return input
<margaritamike>
i'm cool with that, i just want to use what everyone else agrees on is considered the library to use for an http request library
<larryba>
(I guess none of the types that map supports are immutable, so that is just in theory)
<shka__>
larryba: alexandria:copy-sequence exists
<jackdaniel>
larryba: sure, that's why I've put there "because function is not necessarily #'identity", but I'll drop it, I know what you mean so there is no need to nitpick on my side ,p
<margaritamike>
Selwyn: why is it not as common in the world of python as opposed to lisp
<margaritamike>
i appreciate the link btw
<margaritamike>
im gonna use this library i think
<margaritamike>
if it is what everyone else uses
<Selwyn>
margaritamike: afaik it is the most popular one
<Selwyn>
i don't actually know of any others. i used the most basic functionality a couple of times without problems
<larryba>
shka__, lets say that, hypothetically, strings were immutable, map could just return input given (map 'string (lambda (x) x) input)
<Selwyn>
margaritamike: with regard to Python vs. Common Lisp, Common Lisp is defined with regard to a fixed standard since 1994 (?), whereas Python is not and changes over time.
CrazyEddy has joined #lisp
<Selwyn>
this means that you can use Common Lisp code written portably some time ago without problems, whereas in Python there are the python2 python 3 incompatibility issues to start off with
<marvin2>
last time I checked most python programmers were still using 2.x, refusing to switch. not sure if that has changed recently
<Xach>
larryba: i can't think of one
<margaritamike>
ahh
<Selwyn>
one of my biggest surprises when i started to use CL was that old code would simply run fine, i remember previously never having to rely on python code that wasn't updated in the last few months
nowhere_man has quit [Ping timeout: 252 seconds]
<jackdaniel>
no worries, we are slowly catching up as the ecosystem grows
<Selwyn>
yes we are
<jackdaniel>
it is not as apparent thanks to Xach work to test at least briefly each QL release
larryba has quit [Quit: quit]
<jackdaniel>
(so libraries are guaranteed to at least build)
<Selwyn>
jackdaniel: i am looking forward to try out mcclim on my new laptop when it arrives this week
<jackdaniel>
cool :)
emar has quit [Ping timeout: 244 seconds]
plugd has joined #lisp
ggole has joined #lisp
kajo has joined #lisp
rozenglass has joined #lisp
_whitelogger has joined #lisp
wusticality has joined #lisp
refpga has joined #lisp
refpga has quit [Client Quit]
refpga has joined #lisp
wusticality has quit [Ping timeout: 250 seconds]
refpga has quit [Ping timeout: 250 seconds]
orivej has quit [Ping timeout: 240 seconds]
Bike has joined #lisp
jmercouris has quit [Remote host closed the connection]
<minion>
Remembered. I'll tell jmercouris when he/she/it next speaks.
rippa has joined #lisp
pierpal has quit [Remote host closed the connection]
<ogamita>
beach: that said, person has two subclasses: moral-person and physical-person, so it'd be better if tax-payer was an OPTIONAL mixin… Just saying.
<beach>
Sure. It is hard to come up with pertinent examples in real time like that.
<ogamita>
or even, a reified association between a thug organization and a person, since a single person will often have to pay several thug organisation to avoid being molested.
<ogamita>
:-)
<beach>
I could have used A and B, but that's less obvious.
sjl_ has joined #lisp
<ogamita>
Some people, in particular biologists have used UML to modelize real systems (like, cell metabolism). Perhaps it'd be useful to study those models to give them as real-life examples :-)
bexx has joined #lisp
bexx has quit [Ping timeout: 272 seconds]
bexx has joined #lisp
ggole has joined #lisp
pierpal has joined #lisp
status402 has quit [Quit: status402]
status402 has joined #lisp
meepdeew has joined #lisp
jprajzne has quit [Quit: Leaving.]
dale_ has joined #lisp
dale_ is now known as dale
heisig has quit [Quit: Leaving]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
longshi has joined #lisp
status402 has quit [Read error: Connection reset by peer]
shrdlu68 has quit [Quit: WeeChat 2.3]
LiamH has joined #lisp
status402 has joined #lisp
mrcom has quit [Read error: Connection reset by peer]
Selwyn has quit [Read error: Connection reset by peer]
meepdeew has quit [Remote host closed the connection]
nullheroes has quit [Quit: WeeChat 1.9.1]
status402 has quit [Quit: status402]
nullheroes has joined #lisp
mrcom has joined #lisp
wusticality has joined #lisp
anunnaki is now known as vertigo
Bike_ has joined #lisp
wusticality has quit [Ping timeout: 240 seconds]
Bike has quit [Ping timeout: 256 seconds]
jonh has joined #lisp
Bike_ is now known as Bike
Zaab1t has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
cage_ has joined #lisp
jack_rabbit has quit [Ping timeout: 250 seconds]
schweers has quit [Quit: ERC (IRC client for Emacs 26.1)]
FreeBirdLjj has quit [Remote host closed the connection]
whartung has joined #lisp
Kaisyu has quit [Quit: Connection closed for inactivity]
Arcaelyx has quit [Ping timeout: 272 seconds]
nanoz has joined #lisp
katco has quit [Remote host closed the connection]
shifty has quit [Ping timeout: 272 seconds]
amerlyq has quit [Quit: amerlyq]
FreeBirdLjj has joined #lisp
bexx2 has joined #lisp
bexx has quit [Ping timeout: 240 seconds]
asarch has joined #lisp
orivej has joined #lisp
X-Scale has quit [Ping timeout: 240 seconds]
cgay has joined #lisp
stereosphere has joined #lisp
xkapastel has joined #lisp
X-Scale` has joined #lisp
X-Scale` is now known as X-Scale
Khisanth has quit [Ping timeout: 250 seconds]
emar has joined #lisp
hhdave has quit [Ping timeout: 268 seconds]
dieggsy has joined #lisp
Khisanth has joined #lisp
warweasle has joined #lisp
metallicus has joined #lisp
metallicus has quit [Client Quit]
metallicus has joined #lisp
metallicus1 has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
refpga has quit [Ping timeout: 246 seconds]
plugd has quit [Quit: rcirc on GNU Emacs 26.1]
refpga has joined #lisp
wusticality has joined #lisp
m00natic has quit [Remote host closed the connection]
Arcaelyx has joined #lisp
wusticality has quit [Ping timeout: 246 seconds]
<fiddlerwoaroof>
ogamita: do you happen to haave a link or a reference to such a diagram?
metallicus1 has quit [Quit: WeeChat 2.3]
metallicus has quit [Remote host closed the connection]
Sauvin has quit [Remote host closed the connection]
<verisimilitude>
Look at the return value of USER-HOMEDIR-PATHNAME, asarch.
<asarch>
Yesterder, TMA told me: "asarch: that does not mean that a function defined by DEFUN is unable to accept arguments of the desired type. it is just that there is no discrimination on the type of the passed argument, unless you write the discrimination yourself". In this context, what does "discrimination" mean?
<beach>
asarch: Choose whether to accept or reject arguments of a certain type.
<pfdietz>
f and g are hook functions. They have no return value that matters. They're executed to set up an environment in which to call their arg, which is a thunk.
<pfdietz>
Maybe hook-compose
<pillton>
lazy-compose?
<jackdaniel>
back at the question about sequence copies: subseq guarantees a copy of the same type
<jackdaniel>
(subseq seq 0)
xsperry has joined #lisp
wusticality has quit [Ping timeout: 258 seconds]
ntbre has quit [Quit: ntbre]
Lycurgus has quit [Quit: Exeunt]
<xsperry>
pfdietz, g has no return value that matters, yet you are passing the return value of g as a second argument to f?
<xsperry>
s/second/first
<pillton>
xsperry: The function f may invoke the function argument to obtain the return value.
<pillton>
That is poorly worded.
nowhere_man has joined #lisp
<xsperry>
you're just passing wrapped g x for side effect purposes/