freenode/lisp - IRC Chatlog
Search
9:11:06
jackdaniel
but during development mutating application while it runs is a standard technique
9:11:21
akr[m]
Fair enough, but this doesn't have to be something you would want actually do in production
9:12:01
jackdaniel
well, having ability to do that may be great or debugging, but some security measurements would be necessary if you plan to enable swank on production
9:13:54
jackdaniel
akr[m]: you may try to pick something from the resources mentioned on reddit: https://www.reddit.com/r/Common_Lisp/
9:14:52
akr[m]
As an example of the kind of thing I'm looking for, I was wondering how feasible it would be to have a program which would modify parts of its own code using a genetic algorithm in response to external stimuli (i.e. user input)
9:15:22
beach
akr[m]: Also, the concept of a "program" is not well defined in Common Lisp. Basically, a program is just a collection of functions that are called in some pre-defined way. So whenever you define a new function or redefine an existing one, you are basically modifying a running program.
9:15:56
jackdaniel
it's not something what programmers would do every day, but that's definetely possible. You'd have to declare function as notinline and evaluate new function definitions compilation
9:19:24
beach
akr[m]: Definitely feasible. Here is an example: (defun f (x) (setf (fdefinition 'f) (compile nil `(lambda (x) (+ x ,x)))) x)
9:22:54
beach
I am going to work on Fundamental mode in Second Climacs for a while to make sure it works, and to do some performance tests. And I will clean up the build process and document it so that others can try it out. Common Lisp mode needs to be restructured, and I don't feel like doing that at the moment.
9:23:27
akr[m]
beach: interesting, although I have to admit that I don't know what it does from looking at it
9:24:18
minion
akr[m]: look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
10:02:41
shaftoe
practical common lisp is fantastic... only thing it's missing is mentioning quicklisp (which didnt exist at the time)
14:42:08
marvin2
hi. can someone recommend me a pastebin that does not have ads for people viewing my code?
15:10:49
JuanDaugherty
is the position on sbcl that it just provides AMOP and generic CLOS support without a specific CLOS as most implementations do or did I miss a presentation of the latter someplace? I believe it would have been PCL in cmucl
15:12:56
beach
For example, I think Xof did a complete rewrite of the generic-function cache, using the original paper for inspiration.
15:13:13
JuanDaugherty
yes i know, but it all seems to have merged into the general implementation, also found it weird that in the manual it talks about the object system as being external to spec
15:13:52
JuanDaugherty
i'm used to implementations presenting the object system as thing on it's own rather than an aspect
15:15:39
JuanDaugherty
i can deal with either but obviously would want to start with the latter if it were available
15:16:34
JuanDaugherty
thanks for responding, at this point i gather there isn't anything other than the original/current cmucl pcl docs
15:17:17
JuanDaugherty
i think i'm good with the current 1.3 docs and a decent project example if there's no purposive document
15:19:08
JuanDaugherty
(as distinct from what I said i found, as expository prose on use of the object system at the user, rather than protocol author level)
15:20:12
JuanDaugherty
protocol/object system. It may be I just never fully absorbed although i knew at some level
15:21:16
JuanDaugherty
cl-http and maybe one or two other code sets are only ones I actually worked with
15:22:52
JuanDaugherty
i observe the default of pcl or whatever and that's what seems to be missing in current sbcl docs, the basis of the query/observation
15:26:23
beach
My native language is Swedish, but I rarely use it anymore. In total I speak 5 languages.
15:26:26
JuanDaugherty
anyway i'm a native speaker of English and I do often get complaints on my language use, so it's not just you
15:30:28
beach
SBCL started off as CMUCL, and CMUCL started off as a different dialect (not Common Lisp) of Lisp. Then it became an implementation of CLtL1 (which does not have an object system). Only later was PCL added. You can still see this history in many places of SBCL. For example, the compiler is written without the use of generic functions and such.
15:45:24
beach
The thing with PCL, and thus with SBCL CLOS (and presumably with the CLOS implementation of most current implementations of Common Lisp) is that it was written at a time when processors looked very different from the way they look today.
15:45:25
beach
In particular, there was no big difference between a memory access and a register access in terms of performance. For a modern processor, the PCL generic dispatch technique uses way too many memory accesses.
15:45:50
JuanDaugherty
i see. I have relatively little exposure to immigration but now see that is what one would expect if one immerses in an expatriated culture
15:47:02
JuanDaugherty
also apologies if I've asked this before, didn't search logs but have a sense of deja vu
15:48:38
JuanDaugherty
western new york, it's mostly a reaction to the stupidity for which americans are so justly famous
15:48:38
beach
The excessive number of memory accesses for the PCL dispatch technique is the reason I came up with a technique for SICL that is better adapted to modern processors: http://metamodular.com/generic-dispatch.pdf
15:50:14
beach
pjb: But now I am very excited about my progress on Second Climacs, so it shall have to wait.
15:57:04
beach
JuanDaugherty: Xof just arrived. You can ask him more about SBCL CLOS if you need to.
15:59:09
afidegnum
hello, please can anyone help me understand this about Macros? https://ghostbin.com/paste/v355s when do we use quote and comma? if i understand well, Quote is equivalent to EVAL in some languages, right?
16:02:16
beach
afidegnum: The simplest way to see the backquote facility is to consider it to be a quote, EXCEPT that if some nested stuff is preceded by a comma, than that stuff is evaluated.
16:04:17
beach
afidegnum: So in your paste, the result is a list (* x y) where x is the value of the parameter VALUE and y is either 1, 60, 3600 etc., according to the value of the parameter UNIT, which is presumably one of the symbols s, m, h, d, ms, or us.
16:05:38
beach
Anything inside a backquoted form that is not preceded by a comma is never evaluated.
16:07:06
afidegnum
while reading notes on letoverlambda, there is a preceding function, sleep unit, (sleep-units% 2 'm)
16:07:56
beach
If sleep-units% is a function, its arguments are evaluated before the function is applied.
16:09:36
beach
Like I said, the arguments to a function are evaluated before the function is applied.
16:10:18
afidegnum
aaah, wait, does it mean it mean it would have generated a variable not found error if (m) was rather used?
16:11:09
beach
If you had said (sleep-units% 2 m) then you would have gotten an "unbound variable" error.
16:11:54
beach
The parameter UNIT is a variable inside the function and the value of that variable is the value of the argument that was passed when the function was called.
16:13:15
beach
In which case, the value of m is the symbol s. so sleep-units% will be called with the number 2 and the symbol s.
16:13:19
afidegnum
i haven't tried a failed call yet but i wanted to understand the rational behind the (un)quoted variable/symbol
16:19:24
malice
Hey, I haven't wrote any macro in a long time and now I'm struggling with what seems to be pretty easy.
16:19:52
malice
I want to write QLIST macro so that (qlist (1 2) (3 4) (5 6)) == (list '(1 2) '(3 4) '(5 6)). Is this possible?
16:21:34
afidegnum
even though i m not good in macro yet but i think with this, you pair quote and loop the sequence range. am i correct beach ?
16:25:09
afidegnum
beach: sorry for disturbing again, even though i read it last week but can you please help clarify the difference between '# &body &rest ,@ letargs
16:26:36
beach
afidegnum: &body and &rest are the same. They define a parameter that will hold a list of all remaining arguments (after all the required arguments have been bound to their respective parameters.
16:28:27
beach
afidegnum: ,@ is a "splicing unquote". If you do `(a b ,(list 1 2) c) you get (a b (1 2) c). If you do (a b ,@(list 1 2) c) you get (a b 1 2 c).
16:31:40
beach
#' is known as a "reader macro" Not an ordinary macro. When the READ function sees #'bla, it returns a list (function bla). It is analogous to ' which is also a reader macro. When the READ function sees 'bla, it returns the list (quote bla).
16:34:17
beach
Presumably, the argument to the macro is something that looks like LET bindings, like the list ((x 10) (y 20) (z 30)).
16:35:11
beach
&rest is not a parameter. It indicates that the parameter BODY holds a list of all arguments except the first two.
16:36:01
beach
So if you call NLET like this (nlet bla ((x 10) (y 20)) a b c d) then the value of BODY will be the list (a b c d).
16:38:14
beach
afidegnum: I need to go cook dinner. I'll leave you in the capable hands of other #lisp participants.
20:52:17
krwq
Bike: so i.e. if you got a list of something which has a form let's say: ((:name "a" :foo "bar") (:name "b" :foo "asd")) - what's the best way to i.e. find something with name x (if doesn't exist then create and add new one) and modify field :foo into y
20:52:51
krwq
i wrote function which does that but i think i slightly overcomplicated as the code seems to be too long for such simple thing
20:54:33
Bike
(defstruct thing name foo), then (let ((result (find "x" list-of-things :key #'thing-name :test #'string=))) (if result (setf (thing-foo result) "y") (push (make-thing :name "x" :foo "y") list-of-things)))
20:55:45
afidegnum
hello, i m reading about clack, lack and woot web but there is no deep down documentation. anyone ever used them?
20:56:32
Bike
geez, given how much trouble i've had with git submodules i don't know if i can even say much
20:56:36
krwq
Bike: i'd rather keep it as a lisp tree as it is more flexible and i do not want to define all structs since i dont know them
20:58:57
krwq
if there exists a folder on my disk which is not a local repo it should automatically create a repo, and check if on my github account there is a repo with such name
21:01:13
Bike
I don't think I understand the problem very well, but the most basic thing is to avoid using list manipulation functions directly.
21:01:30
krwq
also each of this repos should be detected if it is lisp repo and if it is it should update .gitignore file if it isn't properly set
21:01:59
Bike
like, if you stick with your list-of-plists, you should have (git-name plist) rather than (getf plist :name). then you can swap the underlying representation more easily later.
21:06:45
krwq
i never know if i should use (with-slots) everywhere or rather prefer some accessors or maybe some other way
21:08:49
aeth
classes = general stuff; structs = if you know the types, and the types will never change, and you want/need them to be fast; arrays = use them like structs the numbers are all the same non-bignum type and you are okay with numerical indices (most implementations will support most arrays of non-bignums and the rest will just treat them as regular arrays)
21:08:49
krwq
Bike: i do not care about it when i represent program in form of code. after im finished and stuff is slow i wonder how can i not change the logic and still make everything fast - then i update my tooling
21:09:24
Bike
yeah, that's the basics, like i said you use accessor functions instead of getf or whatever directly. and don't worry about performance while you're putting it together.
21:09:36
aeth
and then of course there are simple vectors (that hold everything) and lists and strings, but those are fairly obvious in use cases.
21:10:13
Bike
one thing i do is just start writing out high level functions in terms of a nonexistent lower layer, and then i write the lower layer to fit whatever was convenient above.
21:10:29
krwq
compiler should figure out if it should use conses behind or plain continous block of memory