freenode/#lisp - IRC Chatlog
Search
2:37:03
dmiles
well what i should say.. is what be even more awesoem for me is if ECL wasnt bothering to make C files
2:37:45
dmiles
or better if a CL was never able to compile or translate anyhting.. if it was all merely an interpreter.. in which then i could decide where/when to compile things
2:38:16
Bike
if you have your own implementation it doesn't need to compile anything until compile or compile-file is called
2:41:16
White_Flame
while I haven't poked into your details, are you wanting to compile CL into Prolog, or interpret CL from Prolog?
2:42:26
dmiles
I have been so far compiling to Prolog (thus translating) then loading/executing the translated version
2:45:30
dmiles
the translator/compiler is mostly working but the last 29% of the code i need to write for it is still unknown.. heck it might be 50% still i need to do
2:46:48
White_Flame
the first 90% of the code takes 90% of the time. The final 10% takes the other 90% of the time.
2:51:06
dmiles
one problem was even though ECL code was helping out i still have to remove anything related to C backend
2:53:26
dmiles
would have.. so gonna try http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/impl/clisp/0.html
2:56:13
dmiles
but still open to suggestions if someone knows of a CL interpreter that 90% or more is just written in .lisp
3:01:15
dmiles
that be acceptable as long as if it expected to bytecode its system libs i can get in there and stop that
3:05:54
dmiles
even with such an interpreter .. i am still taking chunks out of its interpeter making it call my compiler first then executing
3:07:15
dmiles
Bike: in the case with SBCL i would need to ensure it could be used with its compiler completely broken
3:10:55
dmiles
impls seem to start out close to what i am starting out with and then over time they drift futther away
3:11:52
Bike
you could also write an interpreter yourself. i have most of a closure compiler (which would be portable) somewhere, i just didn't see a demand
3:12:03
Bike
the annoying parts are parsing declarations and parsing lambda list bindings, but you can sorta jank code for that
3:15:09
dmiles
in my host language i wrote a compiler and interpreter that handlers defun/defmacro/lamda etc... it parses the lambda lists and produces host language stub functions that call them etc.. i qualkify it as janky code :P
3:18:29
dmiles
Bike: "most of a closure compiler (which would be portable) somewhere" i'd love to look at it and see if i can use it
3:19:23
dmiles
ACTION arglist parser: https://github.com/TeamSPoon/wam_common_lisp/blob/master/prolog/wam_cl/arglists.pl
3:19:45
Bike
https://github.com/Bike/compilerer i haven't touched this since 2014 apparently and don't remember how it works beyond the concept
3:24:19
dmiles
well what io was thinking is it would have been a Full-CL-AST to a lessFullAST (but still CL)
3:25:05
Bike
here, like for example look at how tagbody is defined https://github.com/Bike/compilerer/blob/master/tagbody-go.lisp
3:26:10
Bike
but to compile the compilerer system you need to have like a working loop macro and stuff, here
3:27:28
White_Flame
do you compile LET into LAMBDA somewhere in there? seems like it would be the most obvious one
3:28:37
Bike
the annoying one is let* since you have to figure out which declarations go with which bindings
3:29:07
Bike
lambda is annoying because you have to pase the lambda list and also worry about special bindings
3:36:48
dmiles
i have a working package system.. readtables, arrays, hashtable .. quitre a bit of CL implemented
3:42:35
dmiles
"yeah i insert a closure of restoration of specials" this is done gensyming a tempvar savign a value.. then SETQing the specials at LET[*] time .. then SETQing back at body exit time
3:54:22
White_Flame
also you have to consider threading effects, as dynamic bindings should be thread-local
3:57:29
dmiles
i am using unwind-protect for the restorations .. but hrrm the threading side effect i realized i not actualyl done it correctly now
4:02:11
dmiles
oh right actually.. if no thread-local one had been started .. a SETQ would hit the global?
4:03:44
White_Flame
in SBCL, referring to a special var's value checks the TLS value first, and if it's unbound, returns the global symbol-value
4:03:53
dmiles
oh interesting.. after the SETQ that hits the Global i might start lettign this thread have the Binding it jsut set as if thread local
4:04:30
White_Flame
and yeah, setting a variable has to check the TLS as well, to determine where it goes
4:05:53
dmiles
(this allows otehr threads to nanoselconds later to manip the Global and it wont hurt the thread that just did the same thing
4:06:54
White_Flame
would capture the current global value into tls (assuming no existing outer binding)
4:23:24
dmiles
yeah... (let ((*x* *x*)) ...) == (let ((tempvar *x*)) (unwind-protect (progn (convert-to-tls '*x*) ... ) (setq *x* tempvar))
5:07:39
jeosol
I have a CLOS question: Do slots initialized with :default-initargs in the base case, are the values carried over in the derived class?
5:09:33
jeosol
Thanks Bike. That's what I expected, but I am getting some weird behavior. Let me check my code again.
5:17:29
jeosol
Bike: I seem to get correct behavior if I re-specify default-initarg for the slot in the derived class. It doesn't appear it is carried over
5:17:57
jeosol
This is excerpt is from PCL: This option is used to specify forms that will be evaluated to provide arguments for specific initialization parameters that aren't given a value in a particular call to MAKE-INSTANCE
5:19:33
Bike
(defclass foo () ((%slot :initarg :slot :accessor foo-slot)) (:default-initargs :slot 7)) (defclass bar (foo) ()) (foo-slot (make-instance 'bar)) => 7
5:21:47
jeosol
My code is just messy now, I need to refactor a bit for clarity. I may have chosen a poor design for my class structures.
5:33:37
jeosol
Bike: Thanks. It was a bug in my code. I had 3-level inheritance and mixed up the inherited class at 2nd level
5:46:08
jeosol
I picked a complex class structure where I am stringing a lot of concepts together (A,B,C,D), with each concept taking a few options/cases (e.g., A1, A2). I am now creating several classes: (defclass A-B-C-D () .) (defclass A1-B-C-D (A-B-C-D) () (:default-initargs ...))
5:46:54
jeosol
It then became difficult to manage the options and possibilities. Perhaps a different design would have been more tractable. When I started, I modeled this case after the stream example in Sonja Keene's CLOS book.
6:17:03
markasoftware
From the (defclass) CLHS docs: "The :accessor slot option specifies that an unqualified method is to be defined on the generic function named reader-function-name to read the value of the given slot and that an unqualified method is to be defined on the generic function named (setf reader-function-name) to be used with setf to modify the value of the slot. "
6:23:44
pjb
markasoftware: this is a special case. Functions can be named either by a symbol, or by a list where the first element is CL:SETF and the second a symbol.
6:24:54
pjb
markasoftware: note: there are other ways to implement accessors used by setf that are not functions named (setf foo), such as setf-expanders, and other implementation specific ways.
6:26:05
pjb
markasoftware: some implementation intern a symbol named |(SETF FOO)|, some put an entry in the symbol-plist of FOO, etc.
6:48:35
beach
It is interesting to see that jmercouris seems to assume a particular way of bootstrapping Common Lisp, i.e., that it has to be built from a small subset of itself. As it turns out, that is a very painful way of bootstrapping a Common Lisp system.
7:02:13
no-defun-allowed
Dibejzer: I think that is a shell problem, not a SBCL problem. Did you `chmod +x hello-world.lisp` first and run it using `./hello-world.lisp`?
7:04:00
no-defun-allowed
And most certainly, do NOT run it with sudo unless superuser permissions are necessary.
7:05:20
no-defun-allowed
If you run a program with sudo, it can pretty much do whatever with your computer, as it is run as the `root` user.
7:06:52
no-defun-allowed
It would be like rightclicking the program and selecting "Run as Administrator".
7:07:56
no-defun-allowed
These are Unix problems and not Lisp problems though, so I should probably leave them though.
7:08:04
Dibejzer
But, even "simple" actions, like entering folders quite often are impossible without sudo
7:08:49
phoe
Dibejzer: if you can't enter a folder without sudo there's usually a very good reason for that
7:09:49
no-defun-allowed
Then you should change the permissions on those directories so that your regular user can read them instead of using a hammer^W^Wsudo on them.
7:10:22
aeth
Dibejzer: you can always discuss it in #lispcafe (the off-topic channel) but that doesn't sound typical
7:10:38
Dibejzer
So, is it a normal workflow that you have to manually change permissions for so many folders?
7:11:30
aeth
pretty much everything in modern Linux/Unix is done in /home/your_name and permissions don't really come into play unless you e.g. want to make install SBCL globally (but you can install SBCL locally, I do... in fact, usually /home is much larger than / so you literally can't install everything globally)
7:12:44
aeth
Literally all of my programming is done locally, including installed language implementations. The only thing related to #lisp that I have installed in the root partition under /usr is stumpwm, the window manager, afaik
7:13:25
no-defun-allowed
ACTION still grabs SBCL from the Arch repository since that's usually close to the newest version
7:13:55
Dibejzer
I understand the concept, but will take some time to understand how to implement it
7:14:46
Dibejzer
but, for example, the script we chmoded back there was in the ~/.clisp/hello-world.lisp
7:14:52
no-defun-allowed
Installing is one of the legitimate uses for sudo, running hello world programs probably is not.
7:15:17
aeth
Installing things globally under root is dangerous because you can really mess things up if you're outside of your distro's package manager unless it's installed under /usr/local/ and even then it might mess up some things.
7:15:50
aeth
If it's under your home directory ~/ then the worst case is that it can mess up everything in home, which is only 85% of everything that's important :-p
7:16:42
aeth
no, you should not need sudo to access anything under /home unless it's under another user's home, but you only really need one "real" user who has a home
7:17:07
Bike
i don't think this is the ideal channel for untangling why your system is apparently so untrusting of you
7:19:15
aeth
Dibejzer: Anyway, the tldr is to write simple scripts under ~/bin (and chmod +x them) that set the correct environment variables (because often that's the only way to do it) and install stuff like SBCL locally. e.g. for SBCL I installed it to ~/.local I have a "export SBCL_HOME=/home/myname/.local/lib/sbcl" followed by the path to the ~/.local/bin/sbcl
8:42:22
Demosthenex
5 second opinion, total noob looking for a simple testing framework while working in repl, what to use?
8:44:39
Shinmera
if you move on from the repl you might want to look into bigger things like parachute or whatever else. there's a thousand of them out there, so pyp.
8:46:06
Demosthenex
i'm seeing quite a few, that's why i asked. looks like alot of duplication, not alot of differences.
8:46:35
Demosthenex
just tinkering with a restful api, and wanted to start capturing things i'm doing in the repl as tests
8:52:09
phoe
if you want to run a bunch of automated tests, choose one of the already existing ones - 1am, fiveam, parachute, fiasco, anything.
8:53:19
Demosthenex
and yes there is reason to use a testing framework with teh repl. i nail down a piece of code and test it on the repl, i need to record that in a test so it repeates later
8:54:31
phoe
I default to 1am in the beginning since it is so dumb that I can fully understand it after reading its source
9:18:36
Shinmera
Also, almost any discussion in here about what a best practise might be will inevitably result in hours long discussions, so I don't even know if such practises exist :)
9:46:57
smokeink
can slime step-debug through macro-expanded code ? https://stackoverflow.com/a/3216672
10:58:47
vydd
phoe: hm. does any of the frameworks you listed support parametrization? (I tried looking at all of their docs, but couldn't find any hints on that)
11:15:43
Xach
Hmm, is there a good way to get in touch with Leo Zovic other than filing bug reports?
11:20:51
phoe
vydd: parametrization as in running the same test body with different input each time?
11:25:57
phoe
vydd: typically you do not need that in Lisp due to its functional nature; you can write a single test that has (dolist (test-datum *test-data*) (is (goodp test-data)))
11:29:52
vydd
either I'm confused about how ..parachute in your case? works, or we're talking about different things... let me test that code and get back to you
11:32:31
phoe
I'm in a bus, can't really use a proper emacs now - maybe Shinmera will be able to assist
11:53:15
vydd
phoe: it does work with dolist! that's cool https://plaster.tymoon.eu/view/1567#1567 ... Shinmera, maybe you could consider adding that to a FAQ?
11:55:05
vydd
curious thing, btw. with no docs, I just tinker with the code and try to make stuff work through autocomplete. when docs are available, and especially as comprehensive as Shinmera's, I try searching in docs first, and when I fail, I kind of assume the feature is simply not supported
12:08:42
Shinmera
vydd: In those cases I typically construct my own test result instances instead of relying on IS etc, so that the overview shows the proper values.
12:09:01
Shinmera
It's a bit cumbersome though, so I might have to look into a way to improve that and add it to the docs.
12:09:42
Shinmera
IS, etc. are just thin macros. If you expand one (or look in testers.lisp), you should be able to figure out how to get it done.
12:10:44
Shinmera
Also, doing parametric tests like that can quickly explode the number of test cases. I should add a way to bundle tests or suppress them from being displayed in the overview.
12:12:05
Shinmera
trying to run uax-9's tests with the default report will kill your emacs, for instance.
12:34:23
vydd
Shinmera: here's a reason why first class support for parametrization might be needed: https://plaster.tymoon.eu/view/1568#1568
12:34:48
vydd
(I've read with-shuffling, and I'm aware it won't work, I just wanted to get the point across)
12:36:40
vydd
oh, it is? :) that's how this whole thing started - I couldn't find it in docs, and then phoe offered dolist as a solution... so, how do I do it?
12:38:31
Shinmera
(loop for test in (alexandria:shuffle (loop for x from 0 to 10 collect (make-instance 'parachute:comparison-result ..))) do (parachute:eval-in-context *context* test))
12:39:49
Shinmera
you could also write a result that first gathers all tests, then shuffles them, and then evaluates them, then bind *context* before doing IS.
12:40:28
Shinmera
Maybe with-shuffling ought to do that, but it might also be surprising. I don't know.
12:42:12
vydd
understood. I thought there was a way other than the cumbersome one (your words! :)) when you said "supported", that got me confused
12:44:25
vydd
do you accept PRs? I guess the real problem would be agreeing on the right API. maybe a new thing like DEFINE-PARAM-TEST could be introduced.. not sure
12:45:33
Shinmera
Designing the right API is indeed the problem. I don't consider it urgent enough of a problem right now, though, since you can just construct the instances.
12:46:48
vydd
true...well. you know what, when I get to the stage I want to have regression tests in the app I'm working on, I'll try with parachute, and if make-instance starts getting annoying, we can chat again
12:55:16
Xach
Hmm! I need to provide an alternate name for http://beta.quicklisp.org/client/quicklisp.sexp because the "sex" substring is blocked for many people behind (very stupid) content filters.
12:57:21
pfdietz
When using the RT test framework, I would use the idiom of having the form under test return NIL for success, otherwise it would return information about which specific input caused the failure.
12:57:25
vydd
Xach: sounds good... just not sure if it would be interpreted in a special way on macOS
12:58:10
Shinmera
pfdietz: In Parachute the test-result instance typically returns the result of the form under test when evaluated.
12:59:51
pfdietz
I'm guessing the IS macro is so one can put several tests together that share some expensive set up and teardown code.
13:00:55
Shinmera
so FINISH returns the result of make-instance after completing the test, which is then the value for the thing function, that serves the IS comparison.
13:01:02
pfdietz
RT just has test definitions that look like (deftest <test-name> <test-form> <expected-results>)
13:04:14
pfdietz
One thing I added to rt in ansi-test was the ability to execute the tests repeatedly, in random order. This found a bug in SBCL (some persistent state in the handling of certain method combinations). Not quite the same as with-shuffling.
13:04:51
Shinmera
There's a lot of stuff that could be added to Parachute that's found in other frameworks, I'm sure :)
13:06:38
pfdietz
I just want to understand what all the various frameworks are bringing to the table, so one can be extended to cover all bases.
13:07:26
Shinmera
The latter is what Parachute tries to do. It has a very flexible evaluation model, which I tried to put to the test by writing compatibility layers that emulate the syntax and semantics of other frameworks.
14:10:33
pfdietz
I need to find that usage summary for the various test frameworks in quicklisp systems. A few had most of the "market".