freenode/#lisp - IRC Chatlog
Search
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)
21:10:52
PuercoPope
Is there a way to splice (,@) outside of quasiquote? I'm trying splice code that is already being spliced (and evaluated at macro-expansion time)
21:11:31
PuercoPope
I'm trying to get rid of the surrounding parentes around write-byte at the end https://gist.github.com/PuercoPop/4e6a1bdb348d032a99261a0f81a84ba8
21:11:50
phoe
PuercoPope: you are most likely doing something wrong if you are working with , or ,@ outside quasiquoted forms
21:18:49
PuercoPope
phoe: yeah, because I haven't commited the code I couldn't link the repo directly. You can find expand-request-reader here https://git.sr.ht/~puercopop/cl-xcb/tree/schemas/src/xcb/schema.lisp#L39
21:19:38
PuercoPope
I still have to fix the non-sense of using expanding into a lambda + funcall. But I'm still early in the PoC phase
22:03:49
ralt
error1 handler is doing a bunch more things too, so yeah, that's why I came to the conclusion "I want handler-bind*" :P
22:08:10
phoe
just :compile-toplevel? AFAIK it is going to make it impossible to use handler-bind* outside of that file
22:11:15
phoe
once you get that, the whole magic drops away, but the macros become easier to write in general
22:15:34
phoe
"The body of an eval-when form is processed as an implicit progn, but only in the situations listed. "
22:19:08
ralt
so AIUI, phoe's point is that given the empty list, it is never processed, and hence shouldn't fail
22:21:10
Bike
but more broadly, i don't think the compiler is restricted to not fail just because the uncompilable code is never executed
22:21:30
Bike
in these cases it's obvious that it's never run, but in general it's the halting problem
22:21:49
phoe
I understand "The body of an eval-when form is processed (...) only in the situations listed" as "no situations, no processing"
22:22:43
Bike
it would be very weird if this is the only place the standard says something cannot be looked at by the compiler at all.
22:24:30
specbot
Processing of Top Level Forms: http://www.lispworks.com/reference/HyperSpec/Body/03_bca.htm
22:25:25
Bike
in the first case, in the example you gave with COMPILE none of that is relevant since it's not top level.
22:25:59
Bike
fundamentally i don't see what value there would be in restricting the compiler like this