freenode/#lisp - IRC Chatlog
Search
8:59:19
White_Flame
yep, if you've not used emacs before, it's probaly the easiest way to get it up and running with everything
8:59:51
ralt
One thing I really like with this concept is that you no longer need a database, you can store everything in defvar or whatever, and that's effectively persistent
9:01:58
ralt
I would argue most people don't understand how transactions work anyway, so you're making it easier to understand
9:03:55
no-defun-allowed
cl-worlds is an implementation of the "worlds" concept proposed by Warth, Ohshima, Kaehler and Kay for "controlling the scope of side effects".
9:05:22
no-defun-allowed
The basic idea is that one can "sprout" a world from the current world, perform some changes in the world, and then commit those in an atomic manner, after checking that no slots that the computation has read have been changed. Oh, and it lives at https://gitlab.com/Theemacsshibe/cl-worlds or https://github.com/nodefunallowed/cl-worlds
9:05:43
solrize
do most ppl here use slime? do you have it set up so that it launches an inferior lisp as soon as you visit any .lisp file?
9:07:06
solrize
thanks, i got the autolaunch code from someone here and it freaked me out at first, but i see some point to it. other thing i notice is i have to restart slime a lot when the inferior lisp resets... is that an issue for you? i had never used slime before quite recently
9:07:19
phoe
solrize: yes and no, I launch slime manually at the start of my emacs session if I am going to work with lisp stuff
9:07:37
no-defun-allowed
I use a custom metaclass that stores (changed) object slots in a hash table in the current world, so no.
9:09:00
no-defun-allowed
That might make accessing slots somewhat slower, especially if one is accessing a slot bound many parent worlds away for the first time. (After that, however, it'll be cached in the current world.)
9:13:49
no-defun-allowed
ralt: I would suggest skimming http://www.vpri.org/pdf/tr2011001_final_worlds.pdf for the space and time properties of worlds; my implementation is a rough translation of the algorithms in section 5.
9:17:41
ralt
no-defun-allowed: thanks, I actually did something similar for work, except I did a copy of the top-level container and used immutable objects inside
9:19:31
ralt
It effectively means a cheapish clone operation at first and then basically zero overhead
10:08:20
phoe
nope, it establishes a restart allowing user to set the place with a new value and retry the assertion
10:08:51
phoe
the type designator that is passed as the second argument to CHECK-TYPE stays constant
10:09:51
shka_
well, my issue here is that when check-type is used in the top level function, it is obviously very useful and restart helps
10:10:56
shka_
however, when used in a inner function, restart becomes misleading, because value was passed from the above, and therefore error was made before calling the inner function
10:11:36
phoe
yes, if you do (defun foo (x) (check-type x ...) ...) then the restart stores the value in the variable X
10:12:56
phoe
the STORE-VALUE restart in such context effectively becomes a USE-VALUE one since it only allows the function to be called once; the stored value may then discarded when the function exits and the local variable X goes out of scope
10:14:10
phoe
using CHECK-TYPE in such contexts becomes more meaningful if you have places that are more persistent, such as (defun foo (x) (check-type (slot-value x 'my-slot) ...) ...) since then the value is *actually* stored and remembered even when the function quits
10:14:31
phoe
and, honestly, I don't really know how to work around that limitation in the general case
10:16:11
shka_
i tend to use :before methods for validating arguments (it happens that i like OO style for interfaces) but i started to consider using :around instead
10:20:09
phoe
in initialize-instance :before the slots are not yet bound because shared-initialize was not yet run
10:21:12
phoe
I found that validation in :after for initialize-instance does not compose well when you have multiple :after methods
10:21:24
phoe
where the more specific ones depend on the values of slots validated in the less specific ones
10:23:50
shka_
i mean, you are often ending up with (defgeneric make-a-very-specific-type-of-object ...)
10:25:53
phoe
yes, that's the issue - the restart is meaningless and does not actually store the value in the object
10:29:49
phoe
I can imagine that it could be fixed if the variables bound by DEFMETHOD were actually checked at the end of the method and their values were passed to the next called methods; meaning, if a :BEFORE method could alter the values that are passed to next methods
10:30:33
phoe
portable code may depend on these bindings being fresh and therefore mutate them freely
10:30:55
phoe
ACTION adds this issue to the bucket of issues for the Hypothetical Revision of the Standard
10:54:33
ym
Is there some kind of macro extension library implementing typed declarations like for example (let ((foo :type fixnum)) ...)?
10:57:09
Xach
jackdaniel: http://report.quicklisp.org/2020-05-16/failure-report/mcclim.html#mcclim_test fyi
11:03:03
ym
I know that compilers like SBCL do all the magic inside, but I like to control the process, you know.
11:14:44
Xach
ym: I think there are some binding libraries that include type info in the binding. can't think of a specific one offhand though.
11:56:30
ralt
Like if you're using cl-sqlite, it'll automatically figure out that it should add the `libsqlite-3-0` package to the "Depends" field of the package
11:57:34
ralt
phoe: no, it's embracing the packages philosophy of declaring C dependencies rather than trying to bundle them all in a single deployed archive and some environment variables setup at startup to make it work
11:59:27
phoe
ralt: I see, so you'll want to actually make some kind of mapping between foreign libraries and debian packages that provide them
11:59:28
jackdaniel
but I don't know details, it was done so pgloader could be put in debian repositories
12:00:49
ralt
cffi-toolchain is doing half of the job, by providing a binary where grovel libraries are embedded, and the Debian package can provide additional metadata about the system shared libraries that your application is using
12:37:28
ralt
That would make sense. Maybe I can add a subclass to fork/save-lisp-and-die and do the rest afterwards?
12:38:08
phoe
after save-lisp-and-die finishes, the currently running Lisp image is destroyed - at least in case of SBCL
12:38:33
ralt
Yes, that's why I'm saying I can fork, do the slad in the child, and do the rest in the parent
12:42:44
ralt
So my subclass would implement asdf:perform, fork, do (call-next-method) in the child which will slad, and in the parent I wait for the child to die then do the Debian packaging
13:00:45
phoe
pjb: http://www.informatimago.com/develop/lisp/com/informatimago/languages/latex/parser.lisp is missing a closing paren somewhere
13:29:46
phoe
this package has everything written in Lisp... save for the lexer, which is written in flex-generated C
13:49:00
phoe
I am staring at https://github.com/tvraman/aster-math/blob/master/lisp-code/lexer/lispify.l now
14:32:24
phoe
Which regex library provides the symbol named SCAN-MATCH-REGEXP? The only occurrences of this symbol on Google and Github are in informatimago code.
14:42:57
montxero
How does on structure an appplication similarly to how Emacs is structured? That is tgere is a core, and several applications can be written to extend/complement this core in the same way Emacs packages extend the funtionality of Emacs?
14:44:59
phantomics
Then you can write other packages that depend on the direct dependents of the core, creating a hierarchy
14:45:14
montxero
phantomics: Is there a simple application written this way I can study? or are there sources for learning about this style of architecture?
14:46:09
phantomics
It's not that simple, but my April language may help you understand: https://github.com/phantomics/april
14:47:15
phoe
you can also consider various implementation-dependent language extensions to the core, such as sockets, threads, Gray streams, MOP et cetera
14:49:16
phantomics
April is actually designed in such a way that you can extend the language, if you look at spec.lisp you'll see it contains a specification for the entire language, and then at the bottom of spec.lisp there's a small commented section where the spec is extended by creating another function in the language
14:49:50
phantomics
These extensions could be done in software packages that depend on the april package, that's an example of a plugin-supporting system
14:53:44
beach
montxero: I tend to split an application into "modules", where each "module" is located in a particular Unix directory, has its own ASDF system definition file, and has one or more package definitions (in the packages.lisp file) that are specific to that module.
14:54:49
beach
montxero: Then, you can have one "core" module and use the :DEPENDS-ON clause in ASDF:DEFSYSTEM so that your other modules depend on the core module or any other module for that matter.
14:57:53
phantomics
Understanding ASDF is the first thing, looking as .asd files will help you understand
14:59:32
phantomics
Unfortunately, the ASDF manual is rather dry: https://www.common-lisp.net/project/asdf/asdf.html
14:59:59
phantomics
I learned by messing around with ASDF, studying the existing .asd files and referring to the manual to clarify things
15:00:05
montxero
I want write an application to manage references and citations (like Jabref) but also research sources as well
15:01:11
beach
montxero: If you expose your code here (or in #clschool if the stuff is really trivial), then you will likely get remarks on it.
15:01:22
montxero
The idea is to have a core application, then build the reference manager, document reader, document retriver, etc separately
15:03:01
phantomics
Is everything build around the concept of a "paper", and you then build a graph connecting papers and sources, etc.?
15:05:07
montxero
phantomics: Not exactly, I want to manage my research resources better.. rather than have several directories holding different papers, I want to have all of them in a single location
15:05:43
montxero
I also want a bibliography manager that handles different kinds of sorces correctly.
15:06:57
montxero
I want it to ensure conference papers have all the requisite fields including location (especially the conference location).
15:07:48
montxero
I want it to perform sanity checks on every bib entry to make sure they are all in order.
15:07:50
phantomics
I see, that's the goal but it's important to figure out the data model that will support that goal. It sounds like "paper" and "source" will be some of the major object types.
15:08:38
phantomics
This is a pretty big project to get started with, you may want to try for a smaller proof of concept and then evolve it
15:08:58
phoe
pjb: plus the main body doesn't compile due to some nested backquote issues; I've tried to work around that and fix it up a bit but I hard-crashed at the regex function.
15:09:49
phantomics
When you're starting out it's best to do something small, because it takes a good deal of trial and error to learn the right ways to architect things, that way you won't be overwhelmed
15:10:16
montxero
One of the main things I want is the concept of a document. Since sources may be books as well.
15:11:27
phantomics
Right, "document" would be the root class, then "paper" and "book" and so on would descend from it. A "library" containing multiple documents could be another object
15:12:57
montxero
The libray is a database of documents. Documents will have tags associated with them.
15:14:34
phantomics
That's what you'll want to use for this, you could practice creating classes for "library" and "document," then making subclasses of document, then writing some methods to ask questions about documents
15:15:43
phantomics
It's a good book, Paul Graham doesn't like doing anything object-oriented, you could adopt his approach but I like using objects when I feel it makes sense
15:15:55
minion
montxero: please 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).
15:18:40
phantomics
This is the chapter that starts covering CLOS: http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html
15:21:37
phoe
pjb: correct; my biggest question is which regex library you've used, since I have searched a few I know and none provided the regex function that you---
15:23:43
pjb
Yeah, it would be nice, before I die, that I make a big code review, and finish all open projects… Some play chess with Death, some leave open projects…
15:31:27
srazzaque
phantomics: re "PG doesn't like doing anything OO" - mind elaborating? CLOS sounds like a natural fit for the doc/paper/book, would PG just prefer lists? structs?
15:32:24
beach
srazzaque: It is just a fact that Paul Graham doesn't like object-oriented programming, at least not using CLOS.
15:32:56
beach
srazzaque: On Lisp is about the use of the Common Lisp macro system for very advanced purposes, including so called embedded languages.
15:33:05
pjb
srazzaque: my interpretation is that some people don't get OO so they deam OO bad and avoid it.
15:33:39
theseb
Do other languages like Python have anything like the "let" form? In Python you just set variables to whatever values you want....Why don't they have a need to set them for a special block like with let?
15:35:46
phantomics
I appreciate Graham's perspective more than the Java-style trend of making everything OO
15:36:46
phantomics
But I see OO as being useful for things that fit the model, like the library/document/tag concept
15:37:09
beach
theseb: It has nothing to do with fun. It has to do with limiting scope and naming things.
15:37:21
theseb
beach: you may be able to do { int x; ..... } without anything in front of the left { in C but I've rarely seen it
15:38:36
pjb
Only, since {} in C is a statement, you cannot use it in expressions: (+ (let ((a 42)) (* a a)) (let ((b 33)) (* b b))) #| --> 2853 |#
15:39:24
beach
theseb: A block should be created whenever you need a temporary computation that is needed only for the next few statements.
15:39:24
pjb
on the other hand, in C you can use (e1,e2,…,en) ; but you cannot put statements in the expressions. And you need to remember switching the syntax { ; } -> ( , ).
15:39:54
Bike
could you introduce blocks like that in early C? I know until C99 things like if and while didn't actually introduce a new scope
15:40:46
theseb
beach: if I need to encapsulate some code in C or Python or ....i usually squirrel it away in a separate *function*
15:42:18
beach
theseb: There is really not a big difference between the use of LET in Common Lisp and {} in C, other than what pjb is pointing out.
15:43:04
beach
theseb: Both introduced a lexically nested "block", and as Bike says, you can access variables from outside the "block".
15:43:54
beach
theseb: So if you would introduce a separate function in C, you would probably do the same in Common Lisp. That's worthwhile when there is a natural name to the chunk of code.
15:46:08
beach
theseb: Though, I used to have several students who avoided nested blocks in C, because they thought that "the variables had to be created every time the block is entered, so it is slow", which just shows their total lack of knowledge of compiler design.
15:46:22
theseb
beach: actually that brings up another point....if let didn't exist...you could get similar encapsulation by using a lambda function...the only difference would be that you could not access the vars outside the snippet as you said!
15:47:20
beach
theseb: LET is basically syntactic sugar for LAMBDA, and you can definitely access variables in outer scopes.
15:47:41
Bike
this should be covered in whatever text you're using to learn lisp and its implementation
15:50:42
phoe
pjb: my main question is your use of SCAN-MATCH-REGEXP with a stream variable; doesn't the stream get used up when one reads from it?
15:51:09
phoe
Like, we have multiple RULE forms in there. Won't each of them execute SCAN-MATCH-REGEXP that might possibly remove characters from the stream?
15:51:55
beach
theseb: Scientists often overestimate their ability to write good code. To the extent that some of them don't even think of software development or computer science as valid disciplines.
15:52:47
theseb
beach: yes scientists often have poor software engineering skills..i can vouch for that
15:54:08
Josh_2
There was a very good example of what you are saying beach in practice here in the UK government following advice based off of very poorly written models
15:55:23
theseb
beach: since you're a teacher...maybe you can appreciate these fuzzy ideas I've had in my head ....I want to bring software to physics education...I'm thought of a "computational introductory physics course" with python or lisp...problem is not every student learns programming in high school
15:57:02
beach
theseb: I would have to think about that. I have mostly given thought to how to teach it to computer-science and software-engineering students.
15:58:31
selwyn
john carmack reviewed the imperial epidemic simulation code and he concluded that "the software engineering seems fine"
15:58:37
theseb
beach: and I'm sure you know teaching programming is slow at first.....little things we take for granted like editors and syntax cause pain for newbies
15:58:39
phantomics
Non-CS students are less likely to know programming to start with, and thus less likely to have bad Algol habits to unlearn
15:59:10
pjb
phoe: the question is whether the language needs backtracing for scanning. They usually don't.
16:00:02
theseb
beach: the teacher often wants to turbo ahead and it is excruciating because they make what seems to us like such trivial mistakes...so nothing seems to get done for a long time....THAT is the problem with the notion of "let's just a quick 1-2 week programming intro at the beginning of the semester!" idea...students would get pissed
16:00:52
phantomics
Although for teaching math-related material, I think APL is the best language for beginners. If you set someone up with an interpreter and you can teach them to enter the special characters, there is almost no boilerplate or other extraneous stuff to figure out
16:01:48
phantomics
Understanding environments, editors, compilation etc. are often the biggest hurdles for beginners, it's important to get fast results with a small feedback loop
16:01:57
beach
theseb: I think we will get kicked if we continue this discussion here. We would have to find a different forum for it.
16:02:09
theseb
phantomics: as much as i respect CL...have you sen Racket and their DrRacket IDE? it is quite impressive and also removes a lot of barries as you brought up
16:03:09
phantomics
I've been working on creating an easier Lisp environment within the browser, but that's still a long way out
16:03:27
MichaelRaskin
phoe: the rest is http://dpaste.com/17930HR and it is pretty specific to what happens to this HTML on the next step
16:04:36
phantomics
theseb: My browser app actually manifests an entirely different display of s-expressions, displaying them as a graphical tree grid rather than text
16:05:10
MichaelRaskin
The first file is PEG, in the syntax maximally similar to The Original PEG Paper, which is handled by esrap-peg
16:05:21
phantomics
I also have the ability to insert arbitrary interface elements into the grid and show different output types, like images, d3.js graphics, spreadsheet grids, etc.
16:06:23
beach
phoe: Speaking of which, I think you are already overwhelmed with the help on the book, so I think I'll stay away.
16:07:14
theseb
beach: one last question....do you agree with me and phantomics that DrRacket IDE + Racket is probably the best programming intro environment there is?
16:07:20
phoe
If anything, I'll poke you later, when the book is already more or less typeset and the previous reviewers have their stuff merged
16:08:10
beach
Oh, proofreading a book is not hard for me. It is just too messy with too many people pushing their own stuff right now.
16:09:11
phantomics
My April APL compiler was created to augment it, because spreadsheets are a major interface modality and vector languages are a natural fit for spreadsheets
16:13:21
MichaelRaskin
Hmm. I guess no. But that's all that is needed to get string -> parse tree: http://dpaste.com/092PP1D
16:13:51
phoe
oh! can I just skip the peg file and evaluate the stuff from http://dpaste.com/17930HR ?
16:17:17
MichaelRaskin
Second is parse tree to something, where something happens to be some crazy HTML
16:26:06
pjb
theseb: AFAICS, it would be possible to write a CL compiler for DrRacket, so you could !lang cl and be happy for ever?
16:30:47
theseb
pjb: someone implemented python in CL..you may have heard of CLPython... https://common-lisp.net/project/clpython/
16:39:38
Fare
rpg, I ran upgrade tests on what I have and found plenty of failures. I'll analyze the failures and do better.
16:42:08
phoe
MichaelRaskin: your parser seems to work, however it's pretty verbose - the string " does not appear in this chapter;" is represented in code by https://plaster.tymoon.eu/view/1836#1836
16:48:38
MichaelRaskin
Ah right, sorry, I didn't paste that part of the file. Yes, these can be just defined.
16:49:26
phoe
I've defined these two dynavars, but I have no idea how to use that second part of the file just yet
16:54:46
phoe
I get a big string that seems very much glued together without any newlines or anything else - is that the intended result?
17:05:11
MichaelRaskin
AST-eval is _fully_ agnostic, so the fact that the output is a string is just an accident
17:37:45
beach
bitmapper: You were the one who tried the SICL REPL the other day, right? Well, it works again, but it can't do many useful things. You can do things like (car '(a b)) but you can't create generic functions yet.
17:38:15
beach
bitmapper: But I think progress is going to be fast from now on, so check back in a few weeks.
17:41:45
beach
Fare: Thanks. It is till executing in the host Common Lisp system, but it is executing (mostly) SICL code.
18:20:58
theseb
The following returns "(+ 1 2)"......(print ( (lambda (a) a) '(+ 1 2) ) )....Must an eval be added inside the lambda expression "(eval a)" to evaluate a and return 3?
18:27:07
Fare
many of the upgrade failures are actually regular brokenness, as in CMUCL's subtypep being broken my some class redefinitions.
19:12:21
pjb
bitmapper: last time I looked at it, it need ffi4gen, which needs an old apple-gcc-4.2 compiler to be compiled.
20:08:09
pve
I'm experimenting further with some MOP stuff, and SBCL tells me (I think) that it cannot change the class of an instance of standard-generic-function into my subclass. Is it really forbidden or am I missing something?
20:13:46
pve
I think I could manually *move* them one by one, from the old to the new, but that seems fishy
20:14:25
Bike
"Portable programs must not call change-class to change the class of any generic function metaobject or to turn a non-generic-function object into a generic function metaobject. "
20:17:23
Bike
i think you'll have to get the list of methods, call remove-method on each to make them unaffiliated, fmakunbound the name, define the new generic function, and add-method them all
20:40:54
pve
Bike: this does indeed seem to work (first annotation): https://plaster.tymoon.eu/view/1842#1843
20:42:36
Bike
change...class is kind of a problematic name for this, since it doesn't change-class (i.e. preserve the identity of the object)