freenode/#lisp - IRC Chatlog
Search
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
0:04:47
lispmacs
does anybody know if there is a way in GCL to increase the bind stack size. I have a case of bind stack overflow that does not seem to be a problem with the same code in SBCL
0:06:13
Xach
i understand there are some appropriate uses but those users aren't here that i know of
0:07:41
pjb
Well, maximal has been ported to ecl and other CL implementations, so I'm not sure there remains a use fo gcl. At least not until a big effort is made on it.
0:20:11
lispmacs
bitmapper: Xach: pjb: The wxmaxima 20.03.1 package in Guix uses maxima wih gcl 2.6.12. I didn't personally have anything against gcl, but I was just running into this case
0:21:36
MichaelRaskin
Nixpkgs defaults to Maxima on SBCL, and I assume this is not a completely unique decision
0:22:35
lispmacs
but I was still wondering if gcl had a way to adjust bind stack size. I don't really like to stop using a piece of software just because I run into one error
0:23:14
lispmacs
i couldn't find anything on that in the manuals that were installed with it, but maybe I missed something
0:26:04
lispmacs
LdBeth: they are all using sbcl it seems. Maybe that is the answer to my question :)
0:31:08
LdBeth
But usually it means you’re writing wrong code/there’s a bug in maxima than the binding stack limit has been set too low
0:37:39
lispmacs
LdBeth: hmm, yes, I'm thinking that there must be a maxima bug in the code triggering the overflow. Maybe I'll try some code adjustments and see if I can work around it
2:58:51
beach
pjb: A hard question to answer. During bootstrapping, I compile (using the SICL compiler) files containing definitions of macros, normal functions, generic functions, classes, etc. Then I load the compiled files into first-class global environments and the resulting code is executable in the host Common Lisp system (using an interpreter for intermediate code). And I generate native code, but there is no system for that code to
3:01:17
beach
You can say that, yes. I tried turning the intermediate code into Common Lisp code for execution in the host, but the SBCL compiler was unable to handle the size of the resulting code.
3:01:53
beach
So it means I can test a lot of the SICL infrastructure, including the generation of discriminating functions and such, but I can't test the native-code generator yet.
3:04:45
beach
Plus, Bike and karlosz are working on Cleavir compiler optimizations that I have not integrated into SICL yet, but they are part of Clasp now.
3:05:19
beach
And heisig is working on a very nice implementation of the sequence functions, using sealed classes and generic functions.
3:05:59
beach
His functions are portable and they often perform better than the native ones in SBCL.
3:07:23
beach
And scymtym continues to improve Eclector. It is an extremely useful library module now.
3:08:21
beach
Trucler (compile-time lexical environments) is not moving, but appears to be working as advertised. That was also heisig's work.
3:09:37
beach
Coming soon: Extraction of first-class global environments into a separate repository, and a version of PRINT-OBJECT that can be customized by the client.
3:11:56
beach
Coming a bit later: Separate repository of the Cleavir compiler framework, including the representation of abstract syntax trees and intermediate representation.
3:14:57
beach
All those modules are possible to use in order to create a complete Common Lisp implementation. But, most existing implementations can't use them because of the way these implementations are built.
3:14:58
beach
The modules often require the full Common Lisp language, and that is incompatible with the way most Common Lisp implementations are gradually bootstrapped from a subset of the language.
3:15:48
beach
So at some point, I need to turn the SICL bootstrapping technique into something that can be used by other Common Lisp implementations as well.
3:26:37
LdBeth
I’d imagine that if SICL can access host lisp’s functions and data it is already ideal to be used for all sorts of code analysis
3:34:31
beach
But yeah, the Cleavir-based compiler can be customized, so it can be used to turn source code into an abstract syntax tree, using the macro definitions of your choice, including the host ones, if that is what you prefer.
3:35:27
beach
Those macro definitions are just part of a first-class global environment that the compiler works against, so it is even possible to stick (say) ECL macros in such an environment and compile ECL code in SBCL.