freenode/#lisp - IRC Chatlog
Search
8:10:55
flip214
When using 5AM in a loop, is there some way to name the current iteration? If there's an error then "X evaluated to Y which is not Z" doesn't help that much without the loop iteration or similar data.
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