freenode/#lisp - IRC Chatlog
Search
8:43:07
jackdaniel
if you hadn't left I'd tell you, that usually you may pass array as a pointer and vice versa, but it is not conforming C code
9:10:53
dim
I think they call it “flexibility”, used to say it's a very good portability feature of the standard, all those non-conforming areas, and now they brag about optimisation opportunities
9:14:49
flip214
dim: only if you use(d) something you can really discuss pro and contra. Else you're just repeating hear-say.
9:20:33
rme
I was making a joke by alluding to an old paper Brian Kernighan wrote, titled "Why Pascal is not my favorite programming language".
9:26:25
dim
and I picked the “not my favorite” phrase because I knew it was charged with some history, only I don't know nearly enough about it
11:03:45
borodust
Xach: sorry for bothering: a couple of libraries are fail to build for a few days straight because the system i mentioned later in a comment is still not added. Are there any problems with this particular system (`cl-muth`)?
11:04:23
borodust
Xach: link to the failing build: http://report.quicklisp.org/2018-02-26/failure-report/cl-flow.html#cl-flow_tests
11:05:01
borodust
Xach: link to the comment https://github.com/quicklisp/quicklisp-projects/issues/1445#issuecomment-367437114
11:16:03
pjb
jackdaniel: read-line doesn't always read a line: when it reaches end-of-file, it may read a partial-line (a line without a newline), or nothing, returning the eof-value.
11:16:56
pjb
Very few CL functions are specified to always return something! (In general, they can make non-local exits, in case of errors or otherwise).
11:17:46
jackdaniel
reads as in "performs read, which may fail or whatever, but it doesn't try to read a character, or to read multiple number of lines". given context I think that above answer was perfectly fine
11:18:22
jackdaniel
without adding, that if you put integer in place of a function it will signal an error. if you put vector in place of a list it will signal an error. etc
11:19:14
pjb
Yes, but I would like programmers to be more unbiased vs. the various possibilities. We have to take into account all the cases.
11:20:30
jackdaniel
pjb: mentioning all the cases (including irrevelant ones) just clouds the message and makes it not understandable, so I strongly disagree
11:21:34
loke
I like checked exceptions, and I feel that cases where they programmer is not in control _should_ be documented. I.e. READ failing is something the developer always have to take into consideration. There is no way you can program in such a way as to not have to deal with it.
11:21:45
jackdaniel
you do not consider the very special case of explaning things: the reason why you do explain
11:36:43
pjb
unix (and then posix) is not civilised. Multics tried to. But unix recognized that there were "The facts of life."
12:34:21
shka
(print (postmodern:sql-compile `(:order-by (:select * :from "pac_paths") epi_id stay_begin_dt)))
12:40:50
dim
what about having .sql files in your repository instead? I find it way easier to manage
12:41:24
dim
you could even go as far as https://github.com/krisajenkins/yesql ; certainly there's something to that effect in CL?
12:41:53
Xach
I find I like to use html templates rather than constructing it from cl-who or similar...
12:45:03
dim
Xach: yes and no, you shouldn't find any loop constructs and such, it should feel like writing a CL function in SQL, not like preparing a textual data
12:47:16
fe[nl]ix
the readme of yesql makes me think the author never had to programmatically build a query from fragments
12:47:30
dim
shka: yeah I'm not offering practical-now advice, just… consider that SQL is code and that long term you might like to have .sql files in your source tree, that make things easier
12:48:07
dim
fe[nl]ix: I'm highly dubious of building a query from fragments being something you need rather than something you've been used to
12:48:55
dim
shka: I think we agree, or should I use other wording than “consider”, ”you might like to”?
12:49:43
fe[nl]ix
dim: I've had to do that quite often, e.g. adding joins and filters based on a user query
12:51:12
dim
when you have say 3 lisp functions that does almost the same thing but not quite and you want to sometimes inject variations/filtering in the inner-loops, would you have a macro that generates the variants at run-time?
12:51:25
shka
dim: besides some people like to write bad code, and should be allowed to do so if it makes them happy ;-)
12:52:31
dim
fe[nl]ix: on more practical grounds, when things don't run like intended in production and you need to fix one of the queries, but not the others, it's a big problem where it should be a simple patch to the .sql file
12:53:09
dim
having been dev & dba a lot in previous jobs, building query from string pieces in the code is something I loathe nowadays, it's only going to cause maintenance problems down the road
12:53:42
fe[nl]ix
the were cases at the Lisp conferences where the presenter spoke highly of being able to turn an HTTP query into a lambda to cl:compile then funcall
12:54:35
fe[nl]ix
dim: and 3 functions is very little, I've had cases where 5 tables would have lead to a total of 31 join combinations
12:56:05
dim
“but it is generic and we allow the user to search for anything anywhere, we can't know what he'll be interested into” --- yeah, you didn't do your job
12:56:42
dim
anyway, it's just my opinions for having had to deal with that as not be allowed to tinker with the code, and then see developers trying to fit my SQL fixes/improvements back into their code
12:57:02
dim
and refactoring huge portions, or refusing to fix production problems because it would be too much of a change, all for just a SQL query
12:57:17
fe[nl]ix
as a user, I'd hate to use an application that is unnecessarily constrained just because the programmers want an easy life
12:57:32
dim
I'm saying any of you guys fall into that misthinking, but SQL is code and needs patching to ensure good production behavior, just as the rest of the code
12:58:44
fe[nl]ix
where I work, once a backend is goes GA, the data model basically never gets changed
13:00:07
dim
I'm failing to find a nice humouristic illustration of the point I was trying to make, blah
13:02:20
jdz
I agree with dim, coming from Rails and Django, where they use fancy SQL-building DSLs, which I've always found lacking. Mostly because of the inability to use nice SQL features.
13:18:09
Xach
Working with Lisp has made me appreciate the "living system" model of SQL servers more.
13:19:03
Xach
Also, I would like a more query-oriented way to get data from the running Lisp system.
13:19:45
Xach
system data, that is, like "show me all functions with both &key and and &optional" or "all packages without a docstring" and things like that.
13:20:08
Xach
I know there are ways to get that info "manually", but it would be interesting to me to have a more uniform query system/syntax.
13:24:27
AeroNotix
Xach: is it possible to wrap the def* type forms with something that creates a database of what you need?
13:28:04
Xach
AeroNotix: most systems already keep that data around anyway. that's how slime gets its arglist info
13:31:16
p_l
Xach: I think it's something that is really missing from *Common* Lisp, all the extra details on introspection or detailed organization of memory that were provided in systems it derived from
13:31:46
Xach
p_l: my general feeling about "missing" features is "well, they had to stop somewhere"
13:32:28
p_l
on one hand, yes, on another there are some cases where IMO they concentrated too much on "we have enough pages as it is"
13:33:41
Shinmera
My thought is I don't really know what you mean by it. Do you mean retrieving the original documentation forms?
13:34:05
Shinmera
Okey. In that case you could just store them however you like in your custom formatter, no?
13:35:34
Shinmera
So far I'm leaning towards not wanting it as it seems like storing the original format isn't needed for a lot of cases, and those where it is letting them handle their own storage seems smarter as they can decide exactly how to do it.
13:36:28
Shinmera
I can see an angle where primitive formatters might want to just store the original expression, but that seems like a small case that possibly just hinders most cases.
14:22:19
pjb
Murii: also, if your language supports unicode, it may not be the best choice to make strings vectors.
14:23:01
jackdaniel
technically string is a set of symbols from a specified alphabet, no vector required
14:23:18
pjb
Since the properties of unicode strings are so strange, vectors of glyfs, vectors of code-points, or vectors of characters are all inconvenient. Some argue that even having characters is inconvenient, when you use unicode.
15:07:19
TMA
hajovonta: if you restrict yourself to English the intuition is fine. but for more complex languages you soon run full speed into a wall with it
15:09:48
Shinmera
Often times a unicode string will be taken as a vector of code points. Unicode allows you to compose characters through multiple individual code points, where the order does not necessarily matter. Thus, as a representation of a "character string" different vectors represent the same thing, but are no longer identical.
15:10:13
TMA
because the properties of sequences no longer hold -- if you concatenate sequences you would probably assume that the resulting length will be the sum of lengths
15:12:01
hajovonta
we have several strange characters in our language (Hungarian) like á, é, í, ú, and ö, ő, ü, ű
15:12:35
hajovonta
but, when I write "árvíz" and concatenate "tükör" then "árvíztükör" is a sequence of 10 characters
15:13:16
Shinmera
Unicode has code points for just the ticks, so you could write a+tick, as two code points, which would be a string of length 2 in most implementations.
15:13:44
TMA
hajovonta: say that you concatenate 'hajov' and 'onta' in a CV sylabic script ... the first has 3 characters (ha-jo-v) the second has 3 (o-n-ta) ; but the concatenation has 5 not 6 (ha-jo-vo-n-ta)
15:15:22
hajovonta
but it doesn't matter how many code points make up a character. We can just count the characters, can't we?
15:17:58
TMA
hajovonta: why yes. sometimes. in other times what constitutes a character is hard to tell. ... IIRC, in Spanish ll is a single character though two codepoints. ch is a single character in Czech
15:19:35
TMA
hajovonta: so when you see the string "chill", you do not know how many characters you have
15:20:35
dlowe
generally, when you want to know the "length" of the string, you want to know a) how many bytes does it take up or b) how many pixels will it take to render this string, both of which have satisfactory answers.
15:21:28
dlowe
A perverse mind might want to know it in order to find the maximum valid index of a character.
15:23:03
hajovonta
15:23:02 - jackdaniel: technically string is a sequence of symbols from a specified alphabet, no vector required
15:24:04
hajovonta
based on jackdaniel's definition, a string is a sequence of symbols from a specified alphabet
15:24:08
jackdaniel
characters are symbols of "text" alphabet, and that's what usually languages implement
15:24:16
pjb
hajovonta: unicode strings are decomposed in glyps, that are defined by a sequence of code-points of variable length.
15:24:29
hajovonta
I agree that the number of characters can be different when using different alphabets
15:24:46
pjb
hajovonta: the notion of string as a sequence of character would imply that a character is an object of variable length.
15:25:26
pjb
hajovonta: no implementation implement characters this way, because it makes for very complex objects, compared to the usual single byte for C char, or 32-bit word for unicode code-point.
15:26:21
jackdaniel
(what I meant, that one glyph is element of the alphabet, not its code-points, so it is irrevelant to the definition)
15:26:29
pjb
There's also the problem of normalization, such as the various unicode representation of á, or the problem of ligatures.
15:26:58
pjb
jackdaniel: ok, you're implementor. I dare you to implement ecl characters as variable-length sequences of code points…
15:29:00
pjb
hajovonta: by the way, even without going full unicode, just with ascii, you have the distinction between characters or ASCII control codes.
15:29:14
jackdaniel
yes, and when you say (nth *string* 18) it won't take 18-th code-point, but 18-th character
15:29:34
pjb
hajovonta: usually implementations make strings vectors of characters, with virtual characters corresponding to ascii control codes, which has no meaning.
15:30:39
jackdaniel
right, the only important thing is that the sequence is finite, alphabet may have infinite number of possible symbols
15:30:43
pjb
hajovonta: so far, even with unicode, it's finite (and way bigger than 2^21), but just let the user combine the code-points without limiting the number of combinaisons, and you get an infinite number of characters!
15:31:28
pjb
hajovonta: in any case, your question is irrelevant: it could indeed (and should IMO) be done that way, but it is not done in practice by implementations!
15:33:20
dlowe
which makes it impossible to both support the notion of a unicode character and the CL spec.
15:36:05
dlowe
pjb: sure, but you'll need some way to access them without decomposing them on the fly.
15:37:25
hajovonta
but a character can be anything, like "djshfkjdhskh". In a hypothetical alphabet, this can be one character.
15:38:11
pjb
basically, IIRC, you can have up to ten combining code-points following a non-combining code-points.
15:39:32
pjb
This would have the advantage, that you could represent most common characters as fixnums.
16:30:45
flip214
pjb: fixnums are awfully large... even the 32bit character on 64bit machines hurts, if you need to store some larger text body
16:36:10
pjb
If you have large anything, you need to consider your own data structures and algorithms.
16:36:28
pjb
And indeed, the sequence of character representation of large body of text is not often the best one.
16:36:52
pjb
See for example, lisp source code: it's read and not represented as strings, but instead as sexps!
16:37:22
foom
The problem is that it's not the best representation for a small body of text either, except where "best" is defined as "works within existing standard".
16:37:29
pjb
If you had to read wikipedia, probably you'd start by storing words instead of characters… And they perhaps you'd even try to store relationships infered from the sentences…
16:38:51
foom
What you really want is to store the text as utf8, and provide APIs to iterate over encoded bytes, codepoints, grapheme clusters, words, etc.