rumbler31 has quit [Remote host closed the connection]
rumbler31 has joined #lisp
lavaflow has joined #lisp
rumbler31 has quit [Ping timeout: 244 seconds]
wxie has joined #lisp
<LdBeth>
Good morning
Achylles has quit [Ping timeout: 258 seconds]
shifty has joined #lisp
<no-defun-allowed>
morning LdBeth
lemoinem has quit [Ping timeout: 258 seconds]
lemoinem has joined #lisp
lemoinem has quit [Quit: Reconnecting]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
techquila has quit [Remote host closed the connection]
lemoinem has joined #lisp
libertyprime has joined #lisp
techquila has joined #lisp
orivej has joined #lisp
cranes has quit [Ping timeout: 245 seconds]
<gaze___>
hey, super basic question, but how do I fundamentally identify operations that cons? I understand what a cons cell is, where the name comes from... I'm trying to understand what people mean when they talk about "careless consing"
<gaze___>
I'm also interested in what's involved in writing GC-less lisps
<no-defun-allowed>
"consing" would be just allocating memory
<gaze___>
ah okay
<no-defun-allowed>
writing a GC-less lisp involves not writing a lisp because it is trivial to create circularity with closures, conses and other data structures
t58 has quit [Quit: Night]
<no-defun-allowed>
or, since the CL standard technically doesn't require a garbage collector, it involves wasting all your memory very quickly
<gaze___>
ah well fair enough.
<gaze___>
well there is this notion of a linearly typed lisp
<gaze___>
right?
<no-defun-allowed>
seems like a very sad lisp to me
<aeth>
gaze___: You can detect consing pretty easily in SBCL through lots of different ways. e.g. you can disassemble and the consing is commented in SBCL. I think the only exception is when it's done in a function call, but the non-inline function calls are also commented.
<aeth>
You can also sb-profile:profile some functions and then sb-profile:report to see if they allocate anything. Unlike the previous method, this will give you consing even for functions that are called by the function being profiled, unless the function that is being called is also being profiled iirc.
<aeth>
gaze___: ironically, I think SBCL with carefully used GC will probably provide better real-time performance than that because SBCL is very mature
* no-defun-allowed
thinks of a way to put her opinion towards lisps minus the lisp parts politely
<gaze___>
ah I'm just goofing off with a cortex-M3 microcontroller
<gaze___>
I don't imagine it has enough memory to run sbcl
<no-defun-allowed>
how much memory does it have?
<aeth>
gaze___: Real-time programming in CL is not about avoiding the GC altogether, it's about controlling when it happens, which means you avoid doing it within the hot loops, but don't avoid allocations altogether. You probably pre-allocate it before the loops begin. Not really good for stuff like microcontrollers, though, because you probably wind up using *more* memory this way.
<gaze___>
20 kbytes of sram
<no-defun-allowed>
maybe ulisp <ulisp.com> would work
keep_learning_M has quit [Quit: This computer has gone to sleep]
<gaze___>
ulisp is really cool. I'm particularly interested in a tethered compiler where you run a compiler on the host system and shoot code over to the microcontroller as you write functions... but it still maintains enough interactivity that you can peek and poke registers and experiment with drivers
keep_learning_M has joined #lisp
<no-defun-allowed>
can't really guess what board is closest, but it suggests pause times of around 1-3ms usually
<oni-on-ion>
most langs/runtimes/plats have sexp, its a short hop from that to having custom actual lisp
<aeth>
I'm surprised that that didn't get cut off.
<oni-on-ion>
always forget CL has no tail calls; but i've a feeling its not too tricky with some macro magic
<oni-on-ion>
(for hobby-level, not industrial)
<no-defun-allowed>
you can use a trampoline system to do tail calls, provided you have some loop that consumes them outside your tail calling functions
<aeth>
oni-on-ion: It's "easy"... you just return a thunk and call the thunks in a loop. This is called a trampoline.
<oni-on-ion>
aha =) yep makes sense
<aeth>
I benchmarked it against SBCL's actual TCO (which isn't enabled on all optimization levels) and it doesn't seem to noticably impact performance. I think it might make multiple return values more complicated, though.
<aeth>
But it's definitely more doable for a mini-language than for adding it on top of CL because you'd probably need to do something like run a code walker if you wanted it to work on arbitrary CL
<no-defun-allowed>
sorry i got cranky gaze___, people calling things lisps that aren't (and i'm very lenient on that; dynamic typing, late binding, macros and conses are basically all i want) annoys me
<gaze___>
no worries! Just excited to see where I can fit lisp in my projects
<oni-on-ion>
code walker
<oni-on-ion>
neat, Carp is written in HS i did not know that. also reminded of how ugly HS can get! =)
<no-defun-allowed>
i would say "maybe this is more relevant for ##lisp" but maybe this is more relevant for #haskell at this rate
<gaze___>
I feel like HS can be as readable or as opaque as the author feels like making it... much like lisp
<oni-on-ion>
aeth, mini-language do you mean using CL for bootstrapping ?
* no-defun-allowed
sighs
<no-defun-allowed>
i'll be back in a bit, prolly should have breakfast/lunch and not work myself up
ym555_ has joined #lisp
ym555_ has quit [Client Quit]
ym555 has quit [Ping timeout: 245 seconds]
lavaflow has joined #lisp
lavaflow has quit [Ping timeout: 272 seconds]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
lavaflow has joined #lisp
wxie has quit [Quit: wxie]
wxie has joined #lisp
<LdBeth>
Where’s the spec for indenting CL code come from?
<White_Flame>
is there a an actual (non-code) spec?
<White_Flame>
afaik, the behavior of slime defines the accepted style
nirved has quit [Ping timeout: 252 seconds]
<aeth>
White_Flame: afaik, all of the old standards were basically superseded by SLIME and any other programs should be a reliable clone of that file
<aeth>
now, of course, that could probably push the question to where SLIME got its exact behavior
<aeth>
Someone could also write a spec from that file, which would probably be useful
<White_Flame>
it is kind of annoying, though, that the only control over indentation that seems to exist is &body vs &rest
<aeth>
Without modifying emacs, yes. You do need to be able to if you e.g. want something that indents like FLET
<White_Flame>
for full DSL sublanguages, where the entire structure is handled as a single list, there's no real way to declare houw it should indent
<LdBeth>
In LispM Zmacs accepts a special declare form which specifies the indentation
linli has quit [Remote host closed the connection]
libertyprime has joined #lisp
jeosol has quit [Quit: Page closed]
juliusdeane has joined #lisp
<juliusdeane>
I have a decent knowledge of functional programming and don't really like clojure. Which flavor of lisp do you think would be most practical for someone like me to learn?
<beach>
Good morning everyone!
<beach>
Hello juliusdeane.
<beach>
juliusdeane: This channel is dedicated to Common Lisp, so we are biased in favor of Common Lisp.
<beach>
juliusdeane: The functional programming style is used in Common Lisp mainly in macro expanders. Modern application code written in Common Lisp uses object-oriented programming (using CLOS generic functions) a lot.
eabarbosa has joined #lisp
<juliusdeane>
Sounds cool! Would you recommend any specific compiler for CL?
<beach>
Depends on your needs. Most people here probably use SBCL. Other popular choices are CCL and ECL.
<juliusdeane>
Which has the best emacs integration?
<beach>
They can all use SLIME with Emacs.
<oni-on-ion>
White_Flame, hmm using lang modes in certain blocks? if slime/emacs were extendable in this way i am not sure. but it works great and automagically in org-mode files which mix different languages source code blocks
<eabarbosa>
beach: or SLY with Emacs :D
<beach>
Fair enough.
<Josh_2>
Mornin
<beach>
Hello Josh_2.
rumbler31 has joined #lisp
john2x has joined #lisp
eabarbosa has quit [Remote host closed the connection]
<aeth>
juliusdeane: In case you're wondering, ##lisp is the Lisp family channel. Most of the other major Lisps are Scheme, so #scheme might also be relevant, if you want to consider your options. As beach said, this is the Common Lisp channel, so we are biased.
<aeth>
(With Scheme the line between dialect and implementation is a bit blurred, unlike with Common Lisp, where almost all code is portable.)
gabbiel has joined #lisp
<aeth>
juliusdeane: SBCL is the most popular and CCL is the second most popular. SBCL usually produces the fastest code. On the other hand, CCL's compiler is faster (as in, lower compilation times) and it has some macOS integration. ECL is "Embeddable Common Lisp", designed to be embedded in other applications. e.g. it has libecl.so, which could make interfacing with it easier.
<gabbiel>
hey guys. I have a macro "synonymize-function" which basically defines a new function which does the same as an existing function
<aeth>
juliusdeane: Most other implementations fill some niche, e.g. ABCL runs on the JVM.
<gabbiel>
I can safely do that with fdefinition
<gabbiel>
but I also want the new definition to inherit setfability
<beach>
gabbiel: There you go again. You need to define "setfability".
<gabbiel>
beach: think car, car is setfable too
<gabbiel>
I can do (car list), and I can also do (setf (car list) some-value)
<beach>
gabbiel: Functions don't have any such ability. When you see something that works with SETF, it is either because it is a separate function named (SETF <symbol>) or because that something has a SETF expander.
<beach>
gabbiel: So there is no such intrinsic ability with any functions.
<gabbiel>
I tried setfing the fdefinition of (setf new-definition) to the fdefinition of the existing function, but that only works with functions that have "setftability"
<beach>
gabbiel: They are 2 different functions, as I said. No function has such an ability.
<gabbiel>
beach: I understand, but how else can I communicate when a function also has a setf version
<beach>
gabbiel: It has a different name, as I said.
<beach>
Two different functions.
<beach>
Or it might not. It would be a SETF expander rather than a function.
<beach>
The Common Lisp HyperSpec doesn't require an implementation to do one or the other.
<gabbiel>
do you understand what I'm trying to do though? I know that's just semantics
<aeth>
gabbiel: iirc, setf can have a function or a macro, and the "or a macro" is going to be the hard part.
<gabbiel>
yeah I can see that already
<beach>
gabbiel: There is no relation between the function FOO and the function (SETF FOO). You need to manipulate the two separately.
<gabbiel>
there is a relation
<beach>
Fine.
<gabbiel>
I mean, it makese sense that car is related to (setf car)
<gabbiel>
I understand they do different things, but they are related in a way, right?
<beach>
gabbiel: Only by the name CAR.
<aeth>
gabbiel: There doesn't have to be a relation, though. You could create one with a separate API from the corresponding regular function (if there even is one), it will just mess with e.g. SLIME's minibuffer which afaik prints the non-SETF version's API
<gabbiel>
would you say (setf car) is more related to car than (setf some-random-function)
<beach>
gabbiel: Only because they share the symbol CAR in their names.
<gabbiel>
that's a relation, and also by the fact they work with the same concept. i.e. the car is a place, and to setf a car, means setting that place
<beach>
gabbiel: Sure, but you can't find the function named (SETF CAR), given the function named CAR.
<aeth>
gabbiel: well, one's a getter (accessor in CL terms) and one's a setter (writer in CL terms).
<gabbiel>
it'd make sense that if we're synonimizing a function to another, we should synonymize their setf functions
<beach>
gabbiel: You need to have the symbol CAR. Then you can find both CAR and (SETF CAR), and as I recall, (SETF CAR) may not exist. It could be a SETF expander instead.
<gabbiel>
how do I recieve the function (setf car) given car, function doesn't seem to work
<gabbiel>
nvm, it seems I quoted it, it works like this (function (setf car))
<beach>
gabbiel: You are not listening are you?
<beach>
gabbiel: There is no relation between the function FOO and the function (SETF FOO). You need to manipulate the two separately.
<gabbiel>
I am.
<beach>
gabbiel: You need to have the symbol CAR. Then you can find both CAR and (SETF CAR), and as I recall, (SETF CAR) may not exist. It could be a SETF expander instead.
<beach>
"In general, the exact macro expansion of a setf form is not guaranteed and can even be implementation-dependent; all that is guaranteed is that the expansion is an update form that works for that particular implementation, that the left-to-right evaluation of subforms is preserved, and that the ultimate result of evaluating setf is the value or values being stored. "
<aeth>
one thing you might be able to do is (get-setf-expansion `(car x)) as long as you're able to get the function's lambda list and as long as that lambda list matches the setter's (it doesn't have to!)
<gabbiel>
so synonimizing setf functions too shouldn't be done?
<aeth>
I see from that that SBCL uses SB-KERNEL:%RPLACA
<gabbiel>
at least no in the same code for synonimyze-function?
<aeth>
gabbiel: if you want the setter to match, you should probably have it as a separate argument imo... e.g. (#'car #'(setf car))
<aeth>
Have the user do the work. Worse is better.
<gabbiel>
what about the setf expander thing, that seems more complicated, I guess I'll do that separate argument thing
<gabbiel>
the limited functionality kills me, Ideally, i'd want to be able to handle the expanders as well
john2x has quit [Ping timeout: 248 seconds]
rdh has quit [Remote host closed the connection]
eabarbosa has joined #lisp
eabarbosa has quit [Remote host closed the connection]
rumbler31 has quit [Remote host closed the connection]
wxie has quit [Ping timeout: 250 seconds]
wxie1 is now known as wxie
rumbler31 has joined #lisp
varjag has joined #lisp
juliusdeane has quit [Remote host closed the connection]
<LdBeth>
gabbiel: you can just let the setf expander to call (setf OLDSYMBL)
<gabbiel>
I was thinking that too, now all I need is to know how to determine if its a normal setf function, or an expander, of it has none of them
rumbler31 has quit [Ping timeout: 268 seconds]
<LdBeth>
Yes, a common case is that symbol is not setfable at all
<LdBeth>
But the thing this what you’d like to do with that macro?
varjag has quit [Ping timeout: 246 seconds]
<gabbiel>
I'd like to define a new function called new-name, which does what old name does, inhertis documentation, args, and the setf function/expander.
<gabbiel>
Thanks to fdefinition, I have everything covered, except the setf function/expander
<gabbiel>
I really want it to be a synonym, or as identical as possible
<LdBeth>
gabbiel: so is there any practical use?
keep_learning_M has quit [Quit: This computer has gone to sleep]
<gabbiel>
yes, for example, I have some code for keeping tracks of some recipes
<LdBeth>
What one probably would do is refactoring
<LdBeth>
With some textual utility’s instead
moldybits has quit [Quit: WeeChat 2.4]
<gabbiel>
a recipe is a list, whose name is the car, now I'd like to calle recipe-name instead of car for readability purposes. and what if I want to change the name of a recipe? I'd rather also call (setf (recipe-name recipe) new-name) than (setf (car recipe) new-name)
<gabbiel>
ldeth: what do you mean refactoring with textual utility? care to expand?
<gabbiel>
*ldbeth:
<LdBeth>
gabbiel: then you shouldn’t relay on the global namespace but use something like a hash table
<gabbiel>
but aren't functions global in the package, i.e. once defun'd, they are reachable
<LdBeth>
gabbiel: I mean what people usually do is replace the occurrence of recipe-name to new name in the source code
<LdBeth>
And then reload the source code into a new lisp process
<gabbiel>
I was thinking of using struct, since I know you can represent them as lists, I'm not sure one can setf the same, but regardless, this macro seems useful to me
<gabbiel>
ldbeth: recipe-name is the new name, car is the one I'm trying to synonymize it to
<LdBeth>
It’s the same: replace all occurrences of (car recipe) to new name
<LdBeth>
Which is the process called refactoring
<gabbiel>
that seems a hack, and what if I have (setf (car recipe)), not it wouldn't work because recipe-name has no "setfability"
<gabbiel>
that's why im trying to get it to inherit everything from car, instead of defining it and its setf function and then doing the textual replacement
moldybits has joined #lisp
<LdBeth>
If use defstruct, the field accessor is defined with setf as well
<gabbiel>
I fogot defstructs can be represented as lists, and I stuck with lists because they can easily be printed to a file and retrieved later
<LdBeth>
And defstruct will handle the corner cases well
<White_Flame>
"#<" is the magic incantation there, not "#" on its own
<gabbiel>
but now I understand only if #<
<White_Flame>
and PRINT-UNREADABLE-OBJECT can make that output for you, including the address
<gabbiel>
pretty cool that structs are serializable, I thought they werent cause of that #, but now I know
<gabbiel>
still though, if I were to use structs in list form, (which defines getters and setters) it'd only do so for the first level of the list/tree. I have stuff like recipe-notes which is defined as the third of the second element in the tree, or the caddadr
<gabbiel>
I still want the synonymize-macro and synonymize-function macros, I'll have to study up on get-setf-expansion, defsetf, and friends to know what to do
<gabbiel>
thanks for the input though, i appreciate you guys
donotturnoff has joined #lisp
elderK has quit [Quit: Connection closed for inactivity]
igemnace has quit [Quit: WeeChat 2.4]
_leb has quit []
eabarbosa has quit [Remote host closed the connection]
makomo has joined #lisp
Mandus has quit [Ping timeout: 246 seconds]
<makomo>
gabbiel: maybe you could use GET-SETF-EXPANSION to do what you want, i.e. discover whether your place is defined using a SETF expander or a SETF function
nanoz has joined #lisp
<makomo>
you would first check whether the function (SETF <symbol>) exists. if it does, you're done. otherwise, a SETF expander for it might exist, so you use GET-SETF-EXPANSION to retrieve the expansion of the place
Mandus has joined #lisp
<makomo>
if that expansion *didn't* expand into a call to the function (SETF <symbol>), then a valid SETF expander was provided
<makomo>
(GET-SETF-EXPANSION will return an expansion that calls (SETF <sym>) if no SETF expander exists for the place, even if (SETF <sym>) itself doesn't exist)
<makomo>
gabbiel: also, regarding your synonimization, i think the name you're looking for is "aliasing"
<makomo>
gabbiel: check out DEFALIAS in Serapeum
<makomo>
gabbiel: btw, how to actually check that GET-SETF-EXPANSION didn't return an expansion that calls (SETF <sym>)? i'm not sure
<makomo>
i fear the expansion might be implementation-dependent
<makomo>
but also, as people already pointed out, just because a place is of the form (<sym> ...) doesn't mean it has any relation to the function <sym>. it might take totally different parameters or a different number of them as well
<makomo>
(this would be a problem when trying to call GET-SETF-EXPANSION, because you need to give it a place of the form (<sym> ...))
<makomo>
(since there's no bulletproof way of discovering a function's lambda list)
ravenousmoose has joined #lisp
ggole has joined #lisp
refpga has joined #lisp
<gabbiel>
hold on let me read all that
<gabbiel>
I see that problem of (setf symbol) not being at all related to symbol
<gabbiel>
but wouldn't that be a really small number of cases
<gabbiel>
generally, if (symbol object) is a place, and we want to change it, we use (setf (symbol object) value)
manualcrank has quit [Quit: WeeChat 1.9.1]
<gabbiel>
but to cover those cases, I'd do like someone said, to have an optional parameter detailing the setf function, idk what do do in case its a setf expansion though
manualcrank has joined #lisp
<gabbiel>
gnite
rippa has joined #lisp
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shangul has quit [Remote host closed the connection]
kajo has quit [Ping timeout: 258 seconds]
iovec has joined #lisp
random-nick has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
kajo has joined #lisp
varjag has joined #lisp
dale has quit [Quit: dale]
FreeBirdLjj has joined #lisp
<phoe>
Morniiiing
ravenousmoose has joined #lisp
<beach>
Hello phoe.
john2x has joined #lisp
<no-defun-allowed>
Hey phoe
dkmueller has joined #lisp
<saturn2>
gabbiel: there's a very simple way to do what you want, which is simply (defmacro recipie-name (x) `(car ,x))
<saturn2>
this will work with setf no matter how your implementation implements it
<saturn2>
on the other hand, it's probably better style to use a structure or clos object unless you're doing something rather unusual
donotturnoff has quit [Ping timeout: 258 seconds]
<pjb>
(defstruct (recipie (:type list)) name) (recipie-name (make-recipie :name "Tarte aux pommes")) #| --> "Tarte aux pommes" |#
<pjb>
(make-recipie :name "Tarte aux pommes") #| --> ("Tarte aux pommes") |#
<pjb>
(defstruct (recipie (:type list) :named) name) (make-recipie :name "Tarte aux pommes") #| --> (recipie "Tarte aux pommes") |# (recipie-name (make-recipie :name "Tarte aux pommes")) #| --> "Tarte aux pommes" |#
v88m has quit [Ping timeout: 244 seconds]
v88m has joined #lisp
igemnace has joined #lisp
john2x has quit [Remote host closed the connection]
john2x has joined #lisp
<aeth>
saturn2: In practice, when I structure data in lists, it's not because there's not a better option, it's because it's in a macro (or, more rarely, function) to *build* the more appropriate data structures.
<aeth>
gabbiel: So if that's the case, then use destructuring-bind. Very useful for parsing lists.
<aeth>
(And the setter thing isn't an issue, since you'd be setting up a different data structure other than the input one)
<aeth>
I basically never use CAR/CDR/CADR/CDAR/CAADR/... anymore.
gjvc has joined #lisp
dddddd has quit [Read error: Connection reset by peer]
hr0m has joined #lisp
ebzzry has quit [Read error: Connection reset by peer]
beach has quit [Disconnected by services]
beach has joined #lisp
nowhere_man has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 272 seconds]
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life has joined #lisp
baskethammer has joined #lisp
SaganMan has joined #lisp
_whitelogger has joined #lisp
void_pointer has joined #lisp
john2x has quit [Ping timeout: 250 seconds]
pfdietz has joined #lisp
wigust- has joined #lisp
wigust has quit [Ping timeout: 258 seconds]
<pfdietz>
An issue I have with destructuring-bind ... indeed, with all builtins -- is that error signaling is too unspecific. I'm not sure how to make this better, though. Wrapping handlers around everything is too awkward.
<flip214>
makomo: pfdietz: emails to admin <at hostname> are checked more often than IRC -- at least in my case.
rumpelszn has left #lisp ["Using Circe, the loveliest of all IRC clients"]
rumpelszn has joined #lisp
<makomo>
flip214: gotcha
random-nick has quit [Read error: Connection reset by peer]
<phoe>
I've not had issued with contacting clnet admins on IRC though
<phoe>
but then again, that is my case only
Jesin has quit [Quit: Leaving]
<flip214>
phoe: I can only offer the data point that I'm checking mails more often than IRC. YMMV, Other Admins Might Work Differently.
karlosz_ has joined #lisp
karlosz has quit [Ping timeout: 250 seconds]
karlosz_ is now known as karlosz
Jesin has joined #lisp
karlosz has quit [Quit: karlosz]
random-nick has joined #lisp
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dmiles has quit [Read error: Connection reset by peer]
dkmueller has joined #lisp
<gabbiel>
good morning
<gabbiel>
saturn2: yeah I noticed I could use structures yesterday, and I plan to use structures, but I still feel like synonymize-function is useful
<gabbiel>
saturn2: and I can't use defmacro, because then it wouldn't inherit lambda list and documentation
<gabbiel>
aeth: but why would I need to destructure when I know where what I want is. destructuring is usfule when working with multiple items
<pjb>
gabbiel: so I guess by now you've noticed that places can be set by different means than a (setf foo) function.
<pjb>
gabbiel: you have (setf foo), defmacro foo, defsetf (2 ways) and define-setf-expander.
<gabbiel>
yes
<pjb>
gabbiel: but the worst, is that places defined by the standard (all the "Accessor" operators, and the accessors defined by defstruct) can be implemented by yet another, implementation dependant way.
<gabbiel>
pjb: hopefully I find a way that works universally
<pjb>
So, while you can get the (setf foo), the macro foo, or the setf-expansion for user defined places, you cannot do that for Accessors defined in the Hyperspec.
<pjb>
For those places, you need to have an explicit list and handle them specially.
Zaab1t has joined #lisp
<pjb>
gabbiel: see also 5.1.2.2 Function Call Forms as Places
Zaab1t has quit [Remote host closed the connection]
<gabbiel>
as someone said, I don't really need to copy the code, I can just define the setf in terms of the old, like so (setf (kar x) v) => (setf (car x) v)
<gabbiel>
I guess that won't really make it identical
<gabbiel>
but generally, setf functions of getters don't even have documentation, and common sense dicates that car can be setf with (setf car)
orivej has joined #lisp
karlosz has quit [Quit: karlosz]
ravenousmoose has joined #lisp
rixard has joined #lisp
nanoz has joined #lisp
slac-in-the-box has quit [Remote host closed the connection]
cosimone has joined #lisp
dale has joined #lisp
rixard has quit [Quit: (eq status leaving) T]
cosimone has quit [Quit: WeeChat 2.3]
Josh_2 has joined #lisp
<pfdietz>
Structures are an optimization. Consider using standard objects first.
<aeth>
Use structures if :type in the slots matter, especially for performance, so especially for things like numbers and arrays of numbers.
<aeth>
If the problem requires a C-like approach, you can write C-like code this way.
<aeth>
Don't use structures just because the creation macro is simpler. You can always write your own defmacro* if you want.
<aeth>
gabbiel: destructuring-bind is useful if you have a list that has information in specific places, including a plist tail, which can be parsed with &key
caltelt has joined #lisp
dmueller has joined #lisp
<gabbiel>
pfdietz: that's what I did, but structs come with accessors, which is a must for me
<gabbiel>
aeth: i dont need performance, unless I have 100k recipes or something, which I doubt I'd ever have
<gabbiel>
aeth: how would wrting my own defmacro* help?
<aeth>
sorry, defclass*, I misspoke
<oni-on-ion>
with defclass/CLOS you can change the interface/implementation for all living objects. defstruct more like plain records
<gabbiel>
aeth: i'd use destructuring-bind if I needed a bunch of info from some list that I don't treat as its own object
<aeth>
What it looks like you want is to turn a slot foo into (foo :accessor foo :initarg :foo) if it's not a list and if it's a list leave it as a list for e.g. a slot that needs a custom definition beyond the default
<aeth>
In your custom class definition macro
<gabbiel>
in this case, recipe is a list, but I treat it as an object, which has info I need, like recipe-name, recipe-flavors, recipe-notes. It'd make more sense to use those functions than destructure everytime
<oni-on-ion>
with-slots
<aeth>
oni-on-ion: Never use with-slots
<aeth>
Use with-accessors and go through accessors
<oni-on-ion>
idk, ive only posted a link about them
<gabbiel>
I'm not well versed in CLOS, and i'd rather stay away from it, it seems to me like structs are sufficient for me as I'm only storing information, I don't need specific behavior that would require initializtion or whatever
<oni-on-ion>
then structs are perfect. thats also what i do myself. shoving everything into CLOS is not far from going full java
ym555 has joined #lisp
<oni-on-ion>
CLOS is quite verbose for simple things
<gabbiel>
yeah tbh I like how I can just do (defstruct my-struct field1 field2)
<aeth>
You can get that in defclass* if you just tell that macro how to handle a default slot
<gabbiel>
with clos, i'd have to do a little more, ie, give accesor names, init names
<aeth>
writing this outside of SLIME so it's probably wrong, but... (etypecase slot (list slot) (symbol `(,slot :accessor ,slot :initarg ,(intern (symbol-name slot) :keyword)))
<oni-on-ion>
yea :initform :initarg is annoying .
<aeth>
oh you probably want :initform nil there, too. That's probably what defstruct is doing
<gabbiel>
how do I check if a symbol has a setf version?
<gabbiel>
there should be a defined-p to tell if a symbol has a function definition
<gabbiel>
what's something that has a setf expansion
<oni-on-ion>
ehh CL and its gratituous use of keywords
<gjvc>
i have now got .asd file and quicklisp and symlinks all working
<gjvc>
now back to real work :-)
<gjvc>
odd number of &KEY arguments
<oni-on-ion>
ohh real work =)
<gjvc>
i can now load a repl and ql:quickload the whole project
<gjvc>
this is indeed the right way to go
<gjvc>
i have had to remember that the .quicklisp directory used by meacs/slime is/was different from the one in the project. Haven't addressed that yet, but it seems to be working so I'm not too bothered.
<oni-on-ion>
in local-projects ? =)
<gjvc>
correct
<oni-on-ion>
kewl
<gjvc>
thank you to pjb et al who steered me on the right course
terpri has quit [Ping timeout: 258 seconds]
cosimone has joined #lisp
<gjvc>
i want to pass a list to a :keyword argument
<gjvc>
this appears to be problematic
shifty has quit [Ping timeout: 248 seconds]
<oni-on-ion>
(defun x (a &key b) ...) -- (x :b '(1 2 3)) ?
<gjvc>
just a matter of quoting it? let's have a go.
<pjb>
define ...
<pjb>
(defun x (a &key b) (list a b)) (x 'a :b '(1 2 3)) #| --> (a (1 2 3)) |#
<pjb>
What's the problem?
<oni-on-ion>
(list 1 2 3) == '(1 2 3)
<oni-on-ion>
i think he was missing quote...
<pjb>
I think you forgot the mandatory argument.
donotturnoff has quit [Remote host closed the connection]
<oni-on-ion>
and/or that
<gjvc>
boom
<gjvc>
simply a matter of quoting i think
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Lycurgus has joined #lisp
anewuser has joined #lisp
rixard has joined #lisp
elderK has joined #lisp
Lycurgus has quit [Quit: Exeunt]
rixard has quit [Quit: (eq status leaving) T]
<aeth>
oni-on-ion: that's not quite true... (list 1 2 3) is the same as '(1 2 3) as long as you don't try to modify the list
Zaab1t has joined #lisp
<aeth>
'(1 2 3) is a literal so for all practical purposes that means that it has to be treated as immutable (the compiler or runtime environment doesn't actually check this, unfortunately)
<oni-on-ion>
aeth, in the context above thats all.
<aeth>
oni-on-ion: the context is ... and that ... could easily be (setf (car b) 42)
Zaab1t has quit [Remote host closed the connection]
xkapastel has quit [Quit: Connection closed for inactivity]
<oni-on-ion>
aeth, i understand there can be more potential to it, but he solved the problem
<aeth>
oni-on-ion: if the problem was solved by quoting the list then the problem wasn't actually solved because gabbiel was talking a few hours ago about aliasing (setf car) which means that that list is potentially going to be modified.
karlosz has joined #lisp
<gjvc>
aeth actually it's going to be evaluated -- i think i might need to use a macro instead
<pfdietz>
gabbiel: standard objects can come with accessors, too. Just put :accessor <name> in the list for a slot.
<oni-on-ion>
aeth, i am not sure what you are talking about, gjvc has not said anything further until now.
<aeth>
oni-on-ion: oh sorry, my bad, the question was by gjvc not gabbiel
<oni-on-ion>
ah its ok
<aeth>
I wasn't paying enough attention, my bad.
<aeth>
gjvc: It definitely seems more like a macro API than a function API once you start expecting a list as input
<aeth>
Especially since a macro can often handle all of that in its fancier macro lambda list
karlosz has quit [Quit: karlosz]
ggole has quit [Quit: Leaving]
lavaflow has joined #lisp
john2x has joined #lisp
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gabbiel>
I want to alias so bad.
<pfdietz>
And the accessors of a standard object are generic functions. You can write additional methods for them. Very useful.
cosimone has quit [Ping timeout: 258 seconds]
cosimone has joined #lisp
caltelt_ has joined #lisp
<pjb>
gabbiel: you cannot do it for all accessors, without knowing the lambda-list of the accessor.
<aeth>
pjb: Isn't there a portability library that gets a lambda list of a function? It might not work on the other kinds of accessor, though.
<pjb>
nope.
<pjb>
I mean there might be, but it's not conforming.
<aeth>
in the actual arguments.lisp #-(or :abcl :allegro :ccl :clasp :clisp :cmucl :corman :ecl :lispworks :sbcl :scl)
<pjb>
using com.informatimago.common-lisp.lisp-sexp.source-form
<aeth>
pjb: I'd ay that once something supports that many implementations, it's basically usable.
dmueller has quit [Quit: WeeChat 2.4]
<aeth>
It looks like it works on macros as well as functions if you use ' instead of #'
caltelt_ has quit [Remote host closed the connection]
igemnace has quit [Quit: WeeChat 2.4]
caltelt_ has joined #lisp
random-nick has quit [Read error: Connection reset by peer]
leb has joined #lisp
cosimone has quit [Quit: WeeChat 2.3]
dkmueller has quit [Quit: WeeChat 1.6]
notzmv has joined #lisp
makomo has quit [Ping timeout: 268 seconds]
dmiles has joined #lisp
karlosz has joined #lisp
kajo3 has quit [Ping timeout: 248 seconds]
leb has quit []
kajo has joined #lisp
techquila has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 258 seconds]
lonjil has joined #lisp
lonjil has quit [Remote host closed the connection]
lonjil has joined #lisp
lavaflow has quit [Ping timeout: 272 seconds]
lonjil has quit [Remote host closed the connection]
lonjil has joined #lisp
moldybits has quit [Quit: WeeChat 2.4]
karlosz has quit [Quit: karlosz]
<gjvc>
shinmera has some impressive emacs setup
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
caltelt_ has quit [Remote host closed the connection]
caltelt_ has joined #lisp
caltelt_ has quit [Ping timeout: 272 seconds]
lavaflow has joined #lisp
<pfdietz>
The portable way to get lambda lists of functions, at least those defined with macros, is to add a *macroexpand-hook* that stores it somewhere when the function is defined.
iovec has quit [Quit: Connection closed for inactivity]
quazimodo has joined #lisp
wxie has joined #lisp
rumpelszn has quit [Ping timeout: 246 seconds]
rumpelszn has joined #lisp
john2x has quit [Ping timeout: 258 seconds]
<drmeister>
Does anyone understand slime and how it starts up?
<drmeister>
On linux with clasp it currently appears to start up but it sits in the *inferior-lisp* rather than switching to the *slime repl clasp*
<drmeister>
buffers/windows/whatever.
<drmeister>
I'm trying to figure out how to debug this - it's quietly failing.
ym555 has quit [Quit: leaving...]
<no-defun-allowed>
Do you have slime-fancy in your slime-setup list?
<drmeister>
I just removed it hoping that would make a difference - it didn't
<drmeister>
Although I should probably clear the cache and start over.
<no-defun-allowed>
Pretty sure you need that in the list.
<drmeister>
I have this in *Messages* Polling "/tmp/slime.832" .. 86 (Abort with ‘M-x slime-abort-connection’.)
<drmeister>
Oh really? It needs to be there eh?
<drmeister>
I thought it was an option.
<no-defun-allowed>
I think it is.
<no-defun-allowed>
And I'd assume if it's just waiting, then SWANK hasn't yet set up a server on that Unix file socket.
<no-defun-allowed>
(While you're at it, add slime-fancy-inspector maybe cause that adds specialised methods to the object inspector and in general is apparently fancier)
<no-defun-allowed>
Here the magic blob M-x slime loads is `(progn (load "/home/nodefunallowed/quicklisp/dists/quicklisp/software/slime-v2.23/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init") :from-emacs t) (funcall (read-from-string "swank:start-server") "/tmp/slime.58858"))` which just loads SWANK and starts a server where Emacs expects it to my knowledge.