freenode/#lisp - IRC Chatlog
Search
12:10:10
flip214
Can I ask CFFI whether it found a function (during runtime, because of save/load image!), to provide some fallback?
12:25:21
jackdaniel
you can't also depend on a specific condition across implementation (it simply calls underlying implementation thing)
12:27:42
ogamita
Yes, you can look at cffi::%foreign-funcall to see how it finds the function. It's implementation-dependant.
12:54:34
jackdaniel
ANSI C defines only short int, int, long int and long long afair, and how many bits are assigned to each is platform dependent
12:56:13
jackdaniel
flip214: when I was poking cffi api I've found examples tests/ directory very useful
12:56:28
Odin-
jackdaniel: Correct me if I'm wrong, but I do believe ISO 9899 superseded ANSI X3.159...
12:58:04
jackdaniel
c99 has partial support in many compilers (i.e tcc aka tiny c compiler doesn't support complex float type)
12:58:36
Odin-
jackdaniel: That doesn't change the fact that there is a standard set of integer types.
12:58:37
jackdaniel
so we may declare that all that is obsolete and stop caring, but that would be greatly impractical approach
12:59:01
ogamita
There's stdint.h with int32_t uint32_t int_least32_t uint_least32_t int_fast32_t uint_fast32_t intmax_t uintmax_t.
12:59:05
jackdaniel
well, C standard has now for multiprocessing too, yet I still prefer to depend on pthreads
13:00:12
jackdaniel
I doubt people when confronted with wording "standard C" will assume C99 or C11 (C89 is much more probable)
13:00:50
ogamita
So people basically, still use programming languages that were standardized before they were born. They should use ANSI CL…
13:00:52
jackdaniel
at best your wording was sloppy, at worst you are refusing to stand being corrected. not that I care ,p
13:15:30
jackdaniel
neirac: if you pursue simple charts, then https://common-lisp.net/project/adw-charting/ is a very good library to have that
13:17:29
jackdaniel
if you want a toolbox from which you could build whichever chart you desire looking at McCLIM may be a good idea
13:17:53
neirac
jackdaniel awesome lib!, I'll use it and settle for bar charts. I'll check McCLIM out of curiosity
13:18:57
jackdaniel
nb: that would be a nice project to write a library explicitly for plotting in McCLIM (and not overly hard)
13:25:26
neirac
beach McCLIM looks pretty good, I saw also climacs is that discontinued? not able to reach cvs
13:26:15
beach
neirac: But I am not working on (first) Climacs anymore. The plan is for Second Climacs, a significant improvement.
13:33:07
neirac
jackdaniel have you used adw-charting ? I'm trying some examples from there but fails. I'm using quicklisp for loading :adw-charting-google
13:34:57
neirac
I'm trying 4.2.2 but fails with : Undefined function :PIE called with arguments (300 200) . [Condition of type CCL::UNDEFINED-FUNCTION-CALL]
13:41:45
neirac
jackdaniel I'm doing something wrong then, the vecto backend gives me the same error. (ql:quickload '(:cffi :dexador :plump :lquery :lparallel :str :adw-charting-vecto)) it seems to be loading adw but trying the vecto example fails.
13:44:53
jackdaniel
neirac: now when I think about it there could be some api issues, I think I've fixed them as they were encountered looking at the source code
14:03:04
neirac
beach can I export the plot to png ?. I'll check clim vgplot examples are not working
14:17:31
jackdaniel
(in fact, by PNG I mean whole set of supported raster image formats covered by opticl)
14:18:18
jackdaniel
some features are not implemented in all backends (i.e raster has transparency, while two others do not)
14:20:07
flip214
that said, you can eg. cut a rectangle out of another rectangle before painting it, ie. build masks as well
14:22:14
jackdaniel
also what flip214 says, you may first gather output records, compose them on the renderer side and after that create a resulting pdf
15:45:32
esper0s
iam currently going through the book SICP which uses the mit-scheme lisp dialect. I want to find the best way to run mit-scheme through emacs, would that be installing mit-sheme and then as suggested by the manual the XSCHEME library?
15:46:33
shka__
although this may be missleading, this channel is dedicated to the common lisp specificly
16:03:36
beach
I also often hear that the #scheme channel is very quiet, so if you need help, you are better of needing help with Common Lisp than with Scheme.
16:09:35
beach
esper0s: About the differences, modern Common Lisp uses object-oriented programming CLOS-style a lot, and there is nothing equivalent in Scheme, so the idiomatic programming style is very different in the two languages.
16:16:44
heisig
esper0s: I think Geiser (http://www.nongnu.org/geiser/) is quite nice for Scheme programming on Emacs. But, as beach hinted, you should also give Common Lisp a try :)
16:18:08
esper0s
thank you all for your help, i try to keep the learning scope narrow because it is big already as it is, i do plan on learning lisp in general but you gotta crawl before you walk :) thank you all again
16:19:04
ogamita
esper0s: the advantage of CL is that all implementations implement the same CL language. Not so true with scheme.
16:19:52
ogamita
I could not learn scheme beause each time it was with a different implementation, a different language. Once I tried CL, and next time it was the same language, even if the implementation changed. So I could make progress with CL.
16:25:10
jackdaniel
I would go with gnuplot bindings instead of McCLIM. While hacking something with it is fairly easy it requires some initial work. also getting chart things like axis, legend, nice colors etc will take more than a few minutes to implement
16:26:14
jackdaniel
but if you want to try McCLIM join #clim, I'm sure you'll get any help you need to hack your way through
16:41:03
neirac
ogamita, yes I already have gnuplot installed, vgplot works but only the first plot after that it starts failing.
17:01:30
beach
jackdaniel: I am looking at the size of some parts of ECL and Clasp. It looks like almost half the source lines of C code in ECL consist of Unicode stuff. :)
17:02:12
beach
jackdaniel: Does it seem right to you that, excluding Unicode stuff, ECL has around 170kLOC of C?
17:10:10
jackdaniel
yes. libgc is boehm. ecl had its own gc (written in C) and the module had 1200 LOC
17:10:43
jackdaniel
but it was removed around 2007 I think (I have a very vague plans to resurrect it)
17:49:30
francogrex
hi i would like an 'elegant' concise piece of code that allows me to read the last row in a flat file with over a million rows (using i suppose readline and random access file-position)... any ideas?
17:51:39
Xach
because the most elegant is to set a thing to the result of reading a line and when the file is at its end, return that thing.
17:52:29
Xach
francogrex: if i were doing it, and i wanted it to be a little faster, i would read a big binary chunk from the end and scan the chunk for the end-of-line markers i want, then convert the binary data between markers to a string.
20:36:38
Gnuxie[m]
can anyone tell me why this library decides to raise an error when it can't find a value for a key?
22:30:30
aeth
Gnuxie[m]: All of the JSON libraries are incredibly bad in different ways last time I took a look at them (who knows? maybe there's another 4 now)
22:31:57
aeth
One problem is that JSON is designed to be a trivial mapping to JS and coincidentally has very similar data structures in most other scripting languages.
22:33:51
aeth
It looks like jsown has improved recently. From the readme, "Recently, functions and macros have been added to ease the burden of writing and editing jsown objects." I guess that's the changes "a year ago" (2017-11-08) on Github.
22:38:30
aeth
Gnuxie[m]: Okay, the problem with jsown is that it appears to use alists for JSON data structures with the :obj prefix, not bad. But then for []s it uses regular, unprefixed lists, causing an ambiguity between nil-as-() and nil-as-false. It resolves this ambiguity by allowing :false or :f as the JS false value, but it *should* resolve this ambiguity by prefixing it lists instead.
22:39:32
aeth
In fact, it should be configurable which sequence results from [] because you might want vectors or (simple-array single-float (3))s or something, not lists, and now you've just added a conversion step. "high performance".
22:40:55
aeth
It looks like jsown might be the least ridiculous of the JSON libraries I'm aware of at the moment, though. At least it doesn't have nil<->null and nil<-false and nil<-[] like some of them.
22:42:46
aeth
(Similarly, a proper JSON library should let you choose between alists, plists, and hash-tables, with the third (hash-table) option potentially messing things up if you take in arbitrary JSON)
22:43:17
aeth
At least it prefixes the alists, though. So it gets a 50% for avoiding ambiguity in 1/2 of the data structures. :-p
22:45:07
aeth
It looks like jsown is *not* for serializing arbitrary standard-objects/structure-objects/etc. into JSON, though, which is a good thing. That's doing work at too high of a level imo.
22:46:06
aeth
Overall, it looks like I'd give it a 7/10, which is probably several points higher than the other JSON libraries I've seen.
22:46:50
jasom
Here's how I use cl-json for a bijective mapping: https://github.com/jasom/cl-fccs/blob/master/src/util.lisp#L25
22:47:35
aeth
jasom: Yes, it's nice that cl-json is generic enought that it can be configured to do things (somewhat) correctly, so that's an advantage over cl-jsown. Of course, defaults matter, and its defaults are terrible.
22:48:07
aeth
jsown gets you closer to correctness (with the issues above that I noted) but afaik you can't get all of the way there, unlike (potentially) with cl-json
22:48:08
jasom
the defaults are terrible on all of the options with the possible exception of the one that decodes everything to a standard-object with its own class heirarchy
22:50:03
aeth
jasom: Well, I just said what would work, at least until you get into 2+ dimensional arrays. :null<->null, nil<->false, prefix []s if lists so no truly empty list is possible because it would be something like '(:json-list), and allow the user to determine which sequence to encode/decode [] as, perhaps with a metadata scheme to allow multiple in one file.
22:50:44
aeth
You *only* need two backends for [] encoding/decoding unless you want to support multi-dimensional arrays: list and array, since the rest would just be an :element-type in make-array
22:51:35
aeth
jasom: Right, the complicating factor in the sequence/array generic approach to [] would be if you wanted to turn [[1, 2, 3], [4, 5, 6]] into #2A((1 2 3) (4 5 6)) and vice versa.
22:52:03
jasom
that seems a bit too high-level for me, though I could see the domains in which it would be useful.
22:52:08
aeth
You could, of course, not even attmept to solve it, and then you just have the list and 1D array backend, and it's pretty simple, the typical work-on-all-standard-sequences kind of exercise
22:52:48
aeth
jasom: It seems high level, but unlike a total object mapping, it's kind of necessary for efficiency for the same reason that you want to be able to specify (simple-array single-float (3))s as well: avoid coercing into the array you want, which could be expensive for long arrays.
22:53:35
jasom
aeth: but what about [[1,2,3],[4,5,6],...[7,8,9,10]]? You need to read the whole thing already
22:54:30
aeth
jasom: Because then you would either error on the first row (wrong row size) or when you either have too many or too few rows compared to what you expect.
22:55:40
aeth
jasom: So this would only work efficiently if (i) there was some form of metadata, either in a separate JSON schema, or in the JSON file itself, or in the program code or (ii) every array was of the same type.
22:57:16
jasom
st-json is the library I was trying to think about where you will always write out json equivalent to what you read by default, but unfortunatley it's nil <-> [] which I don't like.
22:57:17
aeth
jasom: So you would probably do this at a higher level library, but you would have to be able to support this sort of thing in the JSON library itself, or else you're just going to be allocating a bunch of sequences and then coercing, which won't work for some JSON formats with large arrays like e.g. 3D models (and, yes, for some reason, people do this in JSON sometimes)
22:57:59
aeth
jasom: ":null<->null, nil<->false, prefix []s if lists" is the only way to handle it imo. Well, perhaps something other than :null, but it has to be a keyword or symbol.
22:59:10
jasom
I concur, but write-what-you-read should be table-stakes and st-json and com.gigamonkeys.json appear to be the is the only ones that do that out-of-the-box
23:00:00
aeth
The way to handle the sequence-generic [] would probably be to either (i) make it the same every time (so request lists, vectors, or some other sequence type) or (ii) override it with some sort of internal schema format that can be generated by various schema/etc. methods
23:03:14
aeth
"some other sequence type" would be tricky. The easy/lazy way would be to just have length/element-type/etc. from make-array as part of the API. The hard way would be to use an extension (if possible; is it CLtL2?) to actually parse a result type so it can behave like #'map... but that 2nd approach won't get you everything (e.g. adjustable arrays with fill pointers)
23:28:26
esper0s
i have got a general question which is not related to lisp but the process of learning. I have found many times that when reading a book on programming i find nmyself spending a lot of time learning the formal way of expressing concepts as stated in the book. Do you consider such an action vain? Sorry for the irrelevance of the question to the channel
23:43:46
jasom
possibly stupid question: are condition types classes? The spec lists a "Class Precendence List" for them, but I can't find anywhere that says that any condition type other than "condition" is a class.
23:45:27
phadthai
they can be implemented with CLOS but not necessarily need to be (predating it if I remember)
23:46:38
Xach
jasom: my long-term understanding is that they are not required to be classes or to use clos
23:47:09
phadthai
esper0s: difficult to judge on learning methods, I think that learning the style is also good, however some books may not be considered good style today, or may be considered closer to scheme-style than cl-style
23:47:42
jasom
Xach: condition is specifically defined to not have standard-class as the metaobject, but it's not clear on whether or not e.g. define-condition creates a new class (that is not required to be a standard-class)
23:47:49
phadthai
esper0s: and I'm not sure if I understood well enough your question, likely not if my answer seems irrelevant :)
23:51:26
jasom
what is confusing is that it shows a class precedence list for the standard condition types, whereas other non-class types do not (e.g. short-float).
23:52:18
jasom
compare e.g. http://clhs.lisp.se/Body/e_parse_.htm to http://clhs.lisp.se/Body/t_short_.htm
0:06:37
_death
I think if you use CLOS, then it's reasonable to expect the implementation to support conditions as classes.. do you know of implementations where this expectation is not met?
0:07:00
jasom
reading chapter 9, it relatively clear that define-condition is only guaranteed to create a subtype of cl:condition, not a subclass.