freenode/#lisp - IRC Chatlog
Search
8:27:03
flip214
jackdaniel: ah, right. Yes, I can annotate each IS test in there with the iteration value -- but then I loose the "expected/got" output!
8:29:39
flip214
What I'd like to have is some (let ((5am:*test-iteration* (list "my test ~d: ~a" i args))) ...) and have that FORMATted on failures as well (or at the first failure in that loop)
8:44:04
no-defun-allowed
is there a way for FORMAT to emit a newline if and only if the formatter is past 80 columns or so?
8:46:22
no-defun-allowed
well, i'd prefer at the end of objects, so i can have one print-object method that emits #<type :foo [long foo] [newline] :bar [bar]> or #<type :foo [short foo] :bar [bar]>
8:49:42
jackdaniel
(interesting fact: stream-column-number may return NIL, so do not assume it to be always a number)
14:13:29
devon
But I've read it several times and I'm still not sure I've parsed the prose as intended.
14:16:33
jackdaniel
devon: most likely, there is no context for what you said right now on a page or two of the history
14:17:22
devon
I presume it's ok to destructively modify the output of (format nil ...) but CLHS seems mum on the topic.
14:20:41
sjl_
someone else pointed me at that months ago when I had the same question. just passing it along.
14:28:16
flip214
jackdaniel: a stealth mixin to 5am, to provide the extended reporting? yeah, why not?
14:33:44
jackdaniel
flip214: then you could mix a class with slot iteration* to fiveam::test-failure with :initform *iteration* and define a method reason on said class which: calls next-method and then prints whatever you wanted to preserve
14:40:04
flip214
my plan was to bind some variable to some explanation; when a test fails, this content would be printed out first (once only!)
14:42:35
jackdaniel
I doubt it, recently I've ordered a bucket because plate is not enough to have things on it ,)
15:19:24
sjl_
something like (do-external-symbols (s :alexandria) (when (fboundp s) (print s))) will get you started
15:19:51
beach
trafaret1: OK, so how about you tell us which "package" you want this information about?
15:20:47
beach
trafaret1: I am introducing too much noise here. I'll leav you in the capable hands of sjl_.
15:21:52
sjl_
beach is correct in that packages in common lisp are containers for symbols. wrapping your head around symbols is one of the trickier parts of CL if you're coming from other languages.
15:22:28
sjl_
but if you just want to say "what new functions can I now call if I import package :foo", the snippet I mentioned above will help you out
15:23:45
sjl_
a symbol in common lisp is an object like any other. most programming languages try to hide away their existence from you
15:26:11
sjl_
especially if you're coming from Python, where something like "if foo: ..." is parsed into some kind of abstract syntax tree by Python that you never get to see/worry about
15:28:03
sjl_
but, to maybe clarify what beach was getting at: a symbol in CL can name many different things. For example, you can have a class and a function with the same name:
15:29:27
sjl_
You can't export just one or the other from a package, because packages are containers of symbols. You export the symbol foo, not the class or the function it names.
15:30:24
sjl_
so the snippet I pasted: (do-external-symbols (s :alexandria) (when (fboundp s) (print s))) says "for each exported symbol of the package :alexandria, if it names a function, print it"
15:31:14
sjl_
Which does (I think) what you were originally asking for (minus the parameters bit, which you can use describe to get at, though I think that might be implementation dependent)
15:51:20
pjb
trafaret1: to understand "wrap your head round something", you will have to read "Stranger in a Strange Land" and grok the word "grok" (which is a Martian word).
15:53:40
pjb
sjl_: only being fbound doesn't mean name a function: (defmacro foo () 'foo) #| --> foo |# (fboundp 'foo) #| --> #(7100233775316992 #<Compiled-function foo Macroexpander #x3020031D527F>) |#
15:54:08
pjb
(symbol-function 'foo) #| --> #(7100233775316992 #<Compiled-function foo Macroexpander #x3020031D527F>) |#
15:56:14
sjl_
Is there a way to check if a symbol is truly bound to a normal function (and not a macro) then?
15:56:51
pjb
(and (not (eql (find-package "COMMON-LISP") (symbol-package sym))) (fboundp sym) (not (macro-function sym)))
15:57:35
pjb
Unless the implementation is "misbehaved" and define special operators and others in implementation specific packages, so you would have to exclude those packages too.
15:57:57
LdBeth
ACTION sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/darhaWqTAPTlClLhyWjreyWI >
16:37:30
fortitude
looks like it wasn't outright rejected, so much as the maintainer doesn't feel like they have the bandwidth to be active on the project
16:37:48
fortitude
I filed a PR with a bufix a while back and didn't hear from the author, so that's not too surprising
16:39:32
fortitude
they do have some concerns about a class->struct change causing problems for clients
16:43:21
fortitude
shka_: I'd noticed the speed issue too; what did you use for profiling? just sb-sprof?
16:47:30
phoe
dim: https://github.com/marijnh/Postmodern/issues/192 you might want to take a look here
17:07:48
fortitude
shka_: it may very well be worthwhile to fork in order to pursue different goals than the original author
17:08:14
fortitude
I'm kind of curious if performance can be improved without having to switch to a struct (probably not by as much), but I don't know if I'll have any time to look at it soon
17:10:03
fortitude
shka_: but if those aren't exported, you might be able to move that data into a struct stored in the class
17:14:08
fortitude
I saw about 30 seconds to process 80k rows or so with cl-csv, where a javascript library was only a few seconds tops
17:16:52
shka_
anyway, if both fare-csv and cl-csv are slow, i will roll my own csv reader based on the cl-csv
17:19:21
shka_
i will probably optimize it further, so it will be completely on par with the python csv module
18:34:06
fiddlerwoaroof
My particular csv file was fairly regular, so I was able to get away with handrolling a CSV parser
18:39:02
fiddlerwoaroof
The code isn't very pretty, but I have a somewhat optimized split function that fixed my issues
18:40:11
fiddlerwoaroof
My main concerns were to make it faster to process really big strings and to expose the interface of Python's str.split which is, im(ns)ho, the best-designed split function out htere
18:40:12
fiddlerwoaroof
https://github.com/fiddlerwoaroof/fwoar.lisputils/blob/master/string-utils/string-utils.lisp#L163
19:31:34
jasom
beach: Do you have any thoughts on the suitability of SICL for working as a transpiler; e.g. how sane would it be to write a HIR to <some other language> compiler, and how easy would it be to get a large subset of lisp working in that manner?
19:32:46
jasom
I know that the bootstrap phase requires some sort of incremental code loading, so it may not be workable for less dynamic languages...
19:35:43
jasom
Bike: IIRC SICL only uses an HIR to CL translator for a small subset when bootstrapping, and then the new runtime does the rest?
19:37:46
jasom
oh, neat; I'll have to look at both of those. The existence of HIR to CL seems to imply that it can handle cases where code is not stored on a user-accessible heap at least.
19:40:15
jasom
The SICL standard library might rely on e.g. "give me the range of PCs for which this function is executing" for e.g. debugging or conditions.
19:42:20
jasom
well there is lisp and then there is lisp. Plenty of lisp code in the SBCL library makes assumptions about how the runtime works, for example.
19:43:07
jasom
but it sounds like it is worth me learning more about SICL at this point, so thanks for answering...
19:43:10
Bike
it's hard to actually do that, but that's more because of the standard not being modular than because the SICL code relies on internal representations
19:44:04
jasom
There's not any obvious kernel lisp implementation that is the right basis for building a full CL implementation
19:44:50
jasom
ACTION always thought it might be interesting to implement CL in one of the smaller scheme standards just for the sake of portability.
19:45:24
jasom
It's not obvious that e.g. R4RS is a good kernel language for lisp, but you can run R4RS scheme on just about anything these days.
19:49:53
Bike
well, i think the point i want to make is that HIR is high level enough that it doesn't involve implementation details at all, except maybe how big fixnums are. and even then if you don't have inline definitions that won't come into play
19:51:43
jasom
but it does seem like it would be hard to do something like CLiCC with SICL since it expects to be hosted in the final runtime (except when bootstrapping), right?
19:52:46
Bike
that's not a property of the LLVM-IR language. you could have a C backend, compile things into SOs and then dlopen them
19:53:25
jasom
CLiCC can statically compile a subset of common lisp to portable C. https://www.cliki.net/CLiCC
19:54:07
jasom
it's distinct from the KCL family in that it is intended for writing static application code that will be compiled once AOT rather than incrementally compiled and loaded.
19:54:42
Bike
SICL, the implementation, is not intended to do that. beach is all about an interactive system
19:54:57
Bike
I see no reason you couldn't do that in Cleavir, but I don't think that's any interesting property of the IR