freenode/#lisp - IRC Chatlog
Search
13:35:30
jmercouris
I'm getting the following return value from a funciton in a library I'm using @2019-03-08T15:33:13.000000+01:00
13:40:28
jmercouris
ok, so I'm getting these timestamps from SXQL, I am wondering if instead there is a way to just query by time instead of checking the timestamp
13:46:01
jmercouris
local-time seems pretty handy: (local-time:adjust-timestamp (local-time:today) (offset :day -1))
13:56:40
jmercouris
in case anyone is wondering in the future, you can use local-time objects in SXQL to do date comparisons
14:11:31
jdz
jmercouris: You might be able to do something like (... :created_at < "now() - interval '24 hours'")
14:18:50
aeth
The lack of updates in 25-30 years and the limitations of 16-bit will be painful to work with. Shouldn't be hard to run in DOSBox, though
14:22:09
aeth
The way a Lisp usually works (although 16-bit ones might be different because of necessity) is that they have tag bits on everything, which means that anything that cannot fit in a word *with* the tag bit has to be heap allocated except in niche circumstances.
14:22:13
aeth
e.g. single-floats fit in a 64-bit Lisp's word size, but not double-floats, since 64-bit floats need some tag bits. But in 32-bit Lisps, even single-floats will be heap allocated if they're 32-bit IEEE single-precision floating point
14:23:56
aeth
And a fixnum is basically the largest signed integer that isn't heap allocated on an implementation. So e.g. for 64-bit SBCL that's a 63-bit unsigned integer because it uses one bit as a tag. Unsigned fixnums are used for most minimum sizes, which means at most you get 2 less than the word size in bits, or 62-bit for SBCL.
14:25:42
aeth
So if I'm doing this correctly, then for a 16-bit implementation that uses the absolute largest fixnum like 64-bit SBCL does for 64-bit you get this as your largest non-bignum integer (= (- (expt 2 14) 1) 16383)
14:26:01
aeth
At most 16383. Some implementations might be less, and that doesn't mean that your largest array has 16383 elements because it depends on e.g. how its tagging works.
14:27:02
aeth
The minimum value for array-total-size-limit is 1024. It's definitely possible that the DOS Common Lisp you find does actually have this value. That means some docstrings are too large.
14:32:05
aeth
If you use a 64-bit CL you basically never have to think about limits and this is esoteric knowledge. If you use a 32-bit CL, you might hit certain limits if you're working with e.g. images or video. If you use a 16-bit made-for-DOS CL, you have to change how you write programs to work around certain limits. It doesn't sound like it would give people a good impression of the language at least imo.
15:18:09
edgar-rft
lionrouge: there's an XLISP-PLUS interpreter from 2016 that still runs on MS-DOS at the bottom of the page -> http://www.almy.us/xlisp.html
15:53:49
jackdaniel
do you have opinions about data-frame concept in general? is there some good CL library implementing the abstraction? if not, would people find it useful?
15:55:24
jackdaniel
(data frames are basically arrays with named columns and rows where you may select particular columns and/or rows depending on what you need, used i.e in statistics or in ggplot2)
16:55:57
dlowe
I've made ad-hoc data frames and associated functions, but I never put it all into a library
16:59:24
grewal
I've never used a data frame, but if I needed that sort of abstraction, I'd probably just use an array of structs
17:01:44
dlowe
datasets too large to mess with by hand but still fitting comfortably in a corner of memory
17:08:42
[6502]
Hello... in a toy lisp interpreter I'm playing with I "mark" environments that are captured in lambdas (and I follow up the environment parent chain until the global environment or a marked one is found)...
17:09:00
[6502]
...When executing a function call I check if after the body evaluation the environment has been made reachable by a lambda capture and when this is not the case I recycle it immediately instead of leaving the job to the gc...
17:09:21
[6502]
...Are there reason for which this trick shouldn't work? it saves me a LOT of consing.
17:09:46
dlowe
[6502]: this is a forum for Common Lisp. I think you want ##lisp which focuses on the lisp family
17:15:13
Bike
there's no reason for it not to work. most of the time you don't even need to allocate an environment.
17:34:02
jeosol
jackdaniel: are you planning on writing or working on dataframe? I think it will be useful. This was brought up here a while ago, and I recall someone had something in CL similar to python pandas.
17:35:06
jackdaniel
jeosol: I wrote a working prototype of polyclot (mcclim application to plot data) and now I'm rewriting it into something with arms and legs
17:35:34
jackdaniel
and data-frames are very convenient as a way for mapping dataset to the aesthetics
17:36:28
jackdaniel
(so I'm apparently writing a barebone implementation which will serve these needs)
17:47:30
jmercouris
I do (flexi-streams:make-flexi-stream ...) from a file I get, I do this twice, but you can only read a stream once
17:49:17
jeosol
sjl: it's possible it this one but if my memory serves me right, the one I was talking had functionalities to allow panda-like manipulations, some of which jackdaniel alluded above
17:50:36
sjl
jmercouris: once you read from a stream, that's it. that's how streams work. copy-stream isn't what you want (that's for piping one stream to another)
17:50:54
jmercouris
sjl: well, I have a CSV that I am trying to go through twice with two different functions
17:51:25
sjl
and you don't want to (with-open-file (...) (do-thing-1 ...)) (with-open-file (...) (do-thing-2 ...)) ?
17:51:43
jmercouris
sjl: I can't say I do, this is the upload to a server, and so I get a stream from the web framework
17:52:34
sjl
By default Lisp (probably) won't save the whole contents of a stream... if someone updates a 100gb file, the whole point of using a stream is to not have to hold it all in memory
17:53:40
sjl
Yeah, if it's small enough to keep in memory, read it from the initial stream into a buffer and then work with that.
17:54:02
aeth
jmercouris: What I'd consider doing is use something like a pipe e.g. https://gitlab.com/zombie-raptor/zombie-raptor/blob/17eb01a05e3f2b8ac6edab8c7592fe03df7e5b49/util/stream.lisp
17:54:22
sjl
then use flexi-streams' make-in-memory-input-stream twice to make two streams you can give to the CSV parser
17:54:29
aeth
jmercouris: But under the hood, which you can even see there, the pipe is just going to either (a) read into a buffer or (b) read into a /tmp file (I go with a, many go with b)
17:55:54
sjl
actually if you want to use the flexi-streams stuff on top, you definitely want the byte vector version
17:56:19
aeth
jmercouris: It's just a trivial use of trivial-gray-streams, probably subtly incorrect because I haven't used it enough to hit edge cases
17:57:14
sjl
the flexi-stream docs for make-in-memory-input-stream specifically says "the octets in the subsequence"
17:59:58
jmercouris
sjl: interesting errors: https://gist.github.com/jmercouris/21b9dcf5f18b984c00c0251ad14c9273
18:02:51
jackdaniel
(let ((string (a:read-stream-content-insto-string stream))) (w-i-f-s (s string) (deactivate-targets s)) (w-i-f-s (s string) (do-csv (row s) …)))
18:03:08
aeth
with-output-to-string combined with with-input-from-string seems like it might work if it's small enough and it doesn't have to be used interactively
18:08:04
jmercouris
re-uploaded: https://gist.github.com/jmercouris/de6fadd66cf5b77b628acc6fef36ac2b
18:09:27
aeth
Well, you're probably getting UTF-8 and you need to translate that into the internal format of the implementation, which is probably UTF-32. Unless the library is already translating UTF-8 to UTF-32, in which case you just need to CODE-CHAR it.
18:10:00
jmercouris
aeth: what if I do not get UTF-8 though? what if a windows user uses the application?
18:11:23
aeth
Especially all of the legacy ones that look like extended ASCII with special characters in the upper half.
18:14:26
aeth
jmercouris: the thing is, being naive about encodings will work fine for characters 0 through 127
18:17:39
jmercouris
I however want to be able to write to the echo stream, and then read from it... no?
18:18:37
aeth
Well, you can make your own stream with http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html via https://github.com/trivial-gray-streams/trivial-gray-streams
18:20:57
aeth
You could probably add some logic that defaults to UTF-8 but also attempts to detect if it's using whatever Windows's default format is instead.
18:21:54
aeth
It's probably not to hard to do utf-8 on Windows since almost the entire web speaks utf-8 now.
18:33:49
aeth
jmercouris: So your issue is you need to pass a stream from caveman into a CSV library twice, right? The simplest answer is to put it into a string and then with-input-from-string twice if it's small enough, right?
18:35:44
aeth
well, if do-csv takes a stream and with-input-from-string makes a stream from a string, then there's no issue
18:37:22
aeth
with-output-to-string is the easiest solution, if it's a bidirectional character stream
21:43:15
Xach
kenu: systems provided by quicklisp will always be stored in the quicklisp directory in a certain structure.