freenode/#lisp - IRC Chatlog
Search
18:30:35
Bike
sometime i should actually flip through that book on architecture and see how it got so big on programming of all things
18:31:02
aeth
jackdaniel: I would say "if you can express something as an inline function" rather than "as a function". If people are doing macros for performance, the only persuasive alternative is inline functions.
18:40:51
aeth
Perhaps things like how to structure your with- macros, e.g. this article: http://random-state.net/log/3390120648.html
18:44:45
scymtym_
there are multiple kinds of patterns in the OOA/D space. general responsibility assignment patterns (GRASP) are more general guidelines like in jackdaniel's macro example, design patterns in the GoF sense are actually patterns with a name, problem statement, etc. and specific roles that match parts of the design model and architecture patterns are yet another thing
20:00:58
phf
what was the name of the project of implementing most of the Standard in portable lisp, that i believe beach was working on and that the c++/llvm lisp compiler is using?
20:08:07
onion
is it possible to.... link symbols, like a symbolic link in the filesystem? for eg 'this-symbol points to whatever 'this-other-symbol points to
20:13:20
jcowan
In particular, you can redefine standard functions provided that doing so does not impact other functions
20:13:37
jcowan
e.g. you can redefine car to do something else, but this must not affect the definition of cadr
20:17:07
onion
that would be quite the implementation to define the behavior of .. changing parts of CL =)
20:17:40
specbot
Constraints on the COMMON-LISP Package for Conforming Programs: http://www.lispworks.com/reference/HyperSpec/Body/11_abab.htm
20:18:04
onion
in smalltalk its totally cool, to change system stuff, undefined behavior is kind of assumed to do that stuff too. people are a bit self conscious when they find themselves changing system core guts ...
20:18:58
Xach
I like changing internal behavior in my favorite implementation but I don't expect it to work on anything but the version of the implementation I changed.
20:19:40
onion
jcowan: ah cool, so in scheme, the stuff that already "links" or refers/points to system builtins, they are still ok ?
20:20:19
phoe
onion: so it is permitted to tweak your implementation's internals - just don't expect any kind of support when you do so on your own
20:21:38
aeth
Clearly, the solution with a native code compiler is to recompile everything that uses car so that the desirable new behavior is used.
20:22:33
jcowan
and if car is redefined to return a newly created car object, the likelihood of the compiler continuationg to work after a pervasisve change is small
20:23:44
pierpa_
jcowan: I seem to remember that it is possible to redefine CAR. No standard function must change behaviour because of this change.
20:24:51
jcowan
In R6RS and R7RS systems, car is imported from a library, and that makes it an error to redefine it
20:25:27
onion
so for ex., i could modify the symbol lookup stuff a bit, hackish, and add my own little symbol list for lookup. not that symbol links/aliases have any practical use, im just curious
20:29:18
onion
CL especially being one of the least tempting runtimes to 'customize' considering its purpose. albeit general =)
20:30:17
oleo
yah, the when the runtime system says it's UBER it doesn't have to be UBER when you port your ideas....
20:43:45
pagnol
I'm looking for something that would allow me to verify that an s-expression has a certain structure in a declarative fashion
20:47:36
aeth
destructuring-bind and a trivial do-destructuring-bind macro are the way to go, probably. https://gitlab.com/zombie-raptor/zombie-raptor/blob/840ea66d8f264ddaa11d4c65ebb348febe8e77c6/data/shader.lisp#L43-47
20:48:40
pagnol
I would like to declaratively specify that what follows :depends-on should be a list of keywords, for example
20:49:41
aeth
you can combine destructuring-bind and the 5-line do-destructuring-bind to write a declarative macro that essentially combines them. Probably < 40 lines.
20:49:57
oleo
(defun isomorph-p (a b) (cond ((atom a) (atom b)) ((atom b) nil) ((isomorph-p (car a) (car b)) (isomorph-p (cdr a) (cdr b))) (t nil)))
20:50:12
|3b|
ACTION wonders if there are any better parsers available for lists than last time i looked. most of the ones i found only worked on character input
21:03:16
Xach
jasom: that seems to be a variation of what i said. (which does not bother me...just want to make sure i understand.)
21:04:58
aeth
Something like this is more idiomatic imo: (let ((foo `(+ 1 2 3))) (destructuring-bind (symbol &rest arguments) foo (check-type symbol symbol) (apply symbol arguments)))
21:05:16
aeth
destructuring-bind makes your assumptions concrete and that gives you more useful errors when they're wrong!
21:06:03
aeth
car/cdr/caaddr/cdddadr/etc. are just ways to get a random NIL. And in CL (car NIL) => NIL and (cdr NIL) => NIL so you don't know where the NIL was introduced, so you don't know where the s-expression was malformed.
21:28:14
cgay
(eval '(list x y)) => error if x or y unbound. (apply #'funcall '(list x y)) => '(x y) Or did I misread the question...it seems too obvious.
21:29:21
jasom
cgay: you have a list that is of the form (FUNCTION ARG*) and you want to call the function with the arguments.
21:31:40
cgay
ok, I'm just pointing out that eval also evaluates all of the args as well, whereas apply/funcall will happily pass along the symbols.
21:37:19
Bike
stuff with a load form is still self evaluating, it just has arbitrary effects at load time.
21:41:13
jeosol
Need some help on condition system to make my code not blow up depending on input. I am calling a function (evaluation solution ..) which does a bunch of calculation steps. One of these steps could fail making the whole evaluation invalid
21:42:13
jeosol
so I want to wrap this top function with conditions so if it fails, I assign some variables and move on.
21:43:10
jeosol
Based on what I read, I have to throw some error (could be same error type for simplicity) in the different steps and just invoke a predefined restart. Does this sound right
21:43:59
Bike
So you have something like (loop for run in runs do (compute run)), and compute sometimes fails, but in that case you want to continue to the next run?
21:44:56
jeosol
More or less Bike, that is right. Sometimes, I ship the runs via parallel function, but let's discuss the serial case
21:45:34
jeosol
There are several other functions things might fail at and I can't instrument each sub function with conditions/restarts
21:46:12
jeosol
If I call the function, and error results because of some incompatability in parameters, I just given a high objective function value (disregard case) and move on to next
21:46:26
|3b|
restart would let you do things like change a value and continue a particular calculation (or configure how you wanted to handle errors at the top level if you have multiple options for that)
21:46:59
jeosol
yes |3b|, I have some other code using restart, but I was thinking there is a probably a simple way to do this
21:47:30
jeosol
I have something with handler-bind that invokes one of the automatic restarts for a simple test case.
21:49:09
jeosol
I worked through the log file analyzer example in PCL and have a case that works for that example. I still have to consider instrumentation with parallel call.
21:51:50
jeosol
But that example, has a way to test if the entry is even valid. Then proceed with normal proceed or have a restart-case. There are two points of failure, with my CL code when processing the parameters, and then another black-box I call that could also fail
21:52:36
jeosol
even if the CL side executed fine. I just want to call everything one error and be done. Not much time to really instrument code and identify failure points and type.
21:55:35
jeosol
Bike: that sounds like it, I was thinking a different type of error that inherits for 'error'
21:58:34
jeosol
It seems the idea is go near the potential failure points and throw the error, then wrap my function evaluation code with handler-bind where I specify one restart to invoke automatically.
21:59:52
|3b|
so if you just want to completely ignore a run, (handler-case (compute run) ((error (e) (format *error-io* "run ~s failed" run)))) or similar
22:02:08
jeosol
not sure if I explained correctly. If run is good F(X) = value from successful run, if bad, F(X) = 1e9. So what I do is initial F(X) variable to 1e9, and if call was sucessful, it will have the correct value.
22:03:21
|3b|
though if you have time to find specific expected failures, handling those specifically reduces chances of missing some typo and getting more failures than the input would normally cause on its own
22:04:43
jeosol
|3b|: yes, I do plan a full instrumentation with condition system so as identify other recovery mechanisms,
22:05:07
|3b|
ignore-errors also could be useful for finding the errors you would want to eventually handle explicitly, if you store them and make a report at the end or whatever
22:16:28
jeosol
|3b| what do you mean by failure points. My evaluations are serial, so there should be one failure point. Or you mean it will keep track of callers
22:18:06
|3b|
i mean ignore-errors/handler-case will just tell you what the errors were, not where they were signalled (which may be enough to find the problems, depending on the code)
22:19:07
|3b|
handler-bind and dissect will let you store a stack trace at each error, so if it fails in different places with different inputs, you can find all of those at once
22:19:19
jeosol
|3b|, sure eventually I need to be able to identify there the errors are, so I will have to come up with some error hierarchy eventually.
22:20:29
jeosol
for me on the development side, but for users, I would use some automated option, e.g., handle the error smartly, repair solutions, etc
22:21:28
jeosol
guys, I am happy to say, I ran small test case twice, after wrapping my F(X) code within (ignore-errors ..) and both times it ran to completion.
22:23:11
Shinmera
drmeister: You mean something that gathers symbols and docstrings and smashes them into a document?
22:23:36
drmeister
Say I had a technical writer and I want to write documentation for functions and classes or an API?
22:24:08
jasom
drmeister: https://sites.google.com/site/sabraonthehill/lisp-document-generation-apps
22:29:35
Shinmera
There's been a couple of major improvements over the last half year or so thanks to prompts by Baggers.
22:32:14
rpg
What I would most like to see is a tool like declit that lets you add structure by putting in arbitrary text (the stuff that tells users the big picture), and lets you rearrange entries to suit a structure that's not the same as the codes'
22:34:22
jeosol
so I took a quick look at the sabraonthehill link and there is a comment about adding tutorial type material in Staple
22:35:25
jeosol
Oh I see, I would love to take a look at documentation systems. Didier's post a while ago about some library tool discussed about Declit
22:36:39
jasom
I have not used Staple, so it may be my new least non-favorite once I get the chance to try it :)
22:36:40
Shinmera
I'm not sure why Sabra has lots of "no"s in his table for things like author, license, etc. as those have always been outputted by Staple since day one.
22:38:34
Shinmera
Staple can also be used as a full manual generation. Which symbols are outputted can be configured.
22:39:21
Shinmera
I'm rethinking how to make the symbol selection process more easily customisable right now, so hopefully that'll be more convenient soon.
22:46:42
rpg
Shinmera: Something like ASDF -- you could have a chapter for the object model, a chapter for plan-building, etc. It would be conceptually organized.
22:49:03
Shinmera
Well, the cop-out answer is that you can do anything (rainbows) since you can write your own template. To answer your question otherwise, the main "documentation body" is parsed from another file -- typically the README.md, so whatever structure you put in there is output into the resulting HTML. If you want to chop up the symbol indexes and intermix them with your main documentation body then that's currently
22:50:02
Shinmera
If you look at the template, the bulk of it is taken up by the symbol index, which is the main thing Staple does. https://github.com/Shinmera/staple/blob/master/modern.ctml#L99-L158
22:50:37
Shinmera
It does some minor stuff like primitively analysing <code> segments in the resulting body to try and provide cross-references, but the main documentation text is largely left untouched.
22:51:14
Shinmera
It could do more, I suppose, if I had a good idea about what people want it to do for that.
22:53:18
SAL9000
Shinmera: In regards to staple's analysis of "See XYZ" -- any particular reason that you're ignoring cross-package See links? In other words, I'm extending/wrapping another package - I want to cross-reference it's docs (in staple-browser).
22:54:15
Shinmera
Staple-browser is just a small hack that invokes staple directly. For staple "usually", it has no way of knowing where the documentation for another project lives, so it can't make a link to it.
22:54:43
SAL9000
ah. I've been pretty much treating staple as a doc-browser more than an doc-generator. :)
22:55:33
Shinmera
That behaviour could definitely be improved though. Providing a way to let staple know how to resolve cross references would be good.
22:56:40
SAL9000
FWIW, it *does* put an <a> element in, but foo:bar makes a bogus #link and foo::bar makes a link to a nonexistent file (iirc it'd make a link to ./bar)
22:59:20
jasom
https://www.scribd.com/document/375473123/Foo <-- automatic conversion of staple to PDF with pandoc is not terrible
23:00:48
SAL9000
you probably want to use pandoc for html->latex then mess with the source before pdflatex'ing
23:01:11
jasom
SAL9000: most of the things you would mess with in the header you can do on the pandoc command line with -V
23:01:57
SAL9000
looks like method & function names get a ton of extra paragraph breaks in the pdf, although maybe that's scribd web viewer brokenness
23:02:37
jasom
SAL9000: nope that appears too. Would be fairly simple to make html more friendly for pandoc conversion without changing the appearance I bet.
23:02:56
jasom
https://www.scribd.com/document/375473288/Staple-v2 <-- smapper margins with -V geometry:margin=1.5cm
23:05:28
jasom
ah, it looks like it is the <a> since each <code><code/> group gets its own line, and the <a> is interrupting the <code> blocks.
23:05:44
Shinmera
Alright, I need to head off to bed, but I'll gladly read about more suggestions once I wake up. Good night!
4:23:31
beach
jcowan: I don't understand your question. Cleavir is designed to be used to build the compiler(s) of Common Lisp, i.e. COMPILER-FILE, COMPILE, EVAL. So the unit to compile is either a file or a top-level lambda expression.
4:27:20
beach
I think I have a phrase in there somewhere, but I haven't designed any general mechanism.
4:31:51
beach
First the top-level lambda expression is turned into an AST, then to HIR, and that process returns a lambda expression that corresponds to a FASL file. So it has to be "tied" (or linked if you prefer) to a first-class global environment.
4:32:34
beach
That lambda expression is then compiled and executed on some arguments, like the environment.
4:33:12
beach
The side effects from executing that function will create the functions, variables, and other side effects that would normally happen when a FASL is loaded.
4:42:22
jcowan
Some of the historical section of the LispOS paper contains errors, but I'm not going to fuss over them now
4:46:07
jcowan
You say that processes exist because of the limited memory of minicomputers, but they were born on mainframes
5:00:55
beach
jcowan_: I re-read that paragraph, and as a result, I removed the "mini" prefix. Thanks for pointing that out.
5:56:49
beach
bjorkintosh: For example, when a program fails, in Multics, you have access to the stack. Then you can try to to fix the problem, say an attempt to call a function that does not exist, type `continue' and the execution continues.
5:57:28
beach
bjorkintosh: In many ways, the Multics development environment was similar to our Lisp environment, and in many ways better than what our free Common Lisp implementations can do.
6:04:06
ldb
Which has been said from `the Arise of Worse is Better', included in the appendix of the UNIX Haters Handbook
6:19:10
shrdlu68
I call CL the "undead language" - it's alive, only with an unholy, supernatural vigor.
6:25:05
beach
ldb: I find it more interesting to compare Multics and TOPS-20 on the one had to UNIX, Windows, MacOS, Android on the other hand, than to compare Multics and TOPS-20. My point in the LispOS specification is that we can do much better than what current systems do, and we have a good model for it, namely our Common Lisp environments.