freenode/#lisp - IRC Chatlog
Search
9:17:54
MrMc
I am trying to use parenscript with the Chartist javascript library how do I get parenscript to emmit new Chartist.Line('.ct-chart', data);
9:20:17
MrMc
The challenge is that this is wrapped as a function returning new Chartist.Line('.ct-chart', data)
11:01:22
phoe
antoszka: I have no idea how postmodern works on the inside. Even if I use multiple threads in my code, they may block on a single connection for example.
11:02:10
antoszka
Well I'm sure you could easily find that out if you try (by even watching connections).
11:20:28
flip214
also, see https://www.quicklisp.org/beta/UNOFFICIAL/docs/postmodern/doc/postmodern.html#*max-pool-size*
11:41:52
flip214
I guess you should be using (with-connection (... :pooled-p T) body) and not ever set *DATABASE* at all.
11:43:35
flip214
phoe: and also be aware of potential problems if you (need to) give the database connection up, eg. because of multiple independent requests via hunchentoot
11:44:15
flip214
a SELECT FOR UPDATE will not work, because a) the old transaction might/will be aborted, and b) you might get assigned some other connection
13:44:21
schweers
is LAUNCH-PROGRAM a fairly recent addition to UIOP? I don’t have it on my machine.
13:44:42
schweers
As I’m running debian (read: ancient software) I suspect that I might need a newer version
13:47:52
schweers
so I don’t necessarily have to install a new version for the whole system, but can drop it somewhere where the installed asdf can find it?
13:48:27
svillemot
schweers: /usr/local/share/common-lisp/source should be the right system-wide path
13:49:53
shrdlu68
schweers: This may help: https://common-lisp.net/project/asdf/asdf/Replacing-your-implementation_0027s-ASDF.html#Replacing-your-implementation_0027s-ASDF
13:52:14
svillemot
my understanding is that schweers uses the ASDF from the Debian package, not from its implem, which is 3.1.7 in Debian "Stretch" 9
13:52:56
schweers
I’m not entirely sure whether asdf comes from the implementation (sbcl) or from debian. Is there a way to check which version is currently loaded?
13:53:22
schweers
It seems that the cl-asdf package from debian testing is new enough, maybe I’ll use that or build a newer sbcl from source
13:56:21
schweers
huh. I’ve installed the new version and I still get the old one in a new lisp image
14:34:24
schweers
It seems to me that the process dies in my program (where I do not care about the return value, other than the stream it contains)
14:39:02
schweers
I want to compress my output with bzip2. So instead of just opening the file (as I did until now), I create a bzip2 process. I give it as output the filename I previously opened directly and return the input stream, promptly forgetting the process-info value itself
14:39:36
schweers
flip214: my experiments on the REPL showed me that CLOSE on the input stream is sufficient, how is that wrong?
14:41:00
schweers
I get your point, but still: why do the processes seem to simply die? is it because the return value of launch-program is garbage collected?
14:42:26
flip214
schweers: do you call a shell with redirection, or pass the output filename to bzip2 as :output?
14:42:39
phoe
schweers: check all the output streams of bzip2, including stderr, for any data that might appear there.
14:45:32
schweers
seemed very dead to me. and simply using the bzip2 binary seemed to be the easier way
14:46:49
schweers
the thing is that I’m just working this into a somewhat complex program. so pasting the relevant bits isn’t really a straightforward process :/
14:52:27
schweers
is it possible that I’m not allowed to call LAUNCH-PROGRAM from a thread other than the main thread?
15:17:29
schweers
turns out that I am giving some wrong parameters in. I gave a broken pathname, gave :rename-and-delete (which is illegal), and :error-output t is also apparently illegal
15:19:50
flip214
ACTION waits for phoe to give a downward arrow, so that I can write something useful there
15:29:11
schweers
is there actually a good reason why sbcl does not properly work with pathname types like "tar.bz2"?
15:29:58
phoe
schweers: yes, there was one - when you have "foo.bar.baz" it has no idea whether the file "extension" is "bar.baz" or "baz"
15:31:32
rpg
schweers: this isn't really SBCL's fault -- the ANSI spec really isn't clear about how file types should be parsed, because it was written in a time of greater filesystem diversity than today.
15:31:42
phoe
(uiop:native-namestring (make-pathname :name "foo" :type "bar.baz")) ;=> "foo.bar.baz"
15:32:05
rpg
I am honestly a little surprised, though, that when you push a type in with MAKE-PATHNAME it doesn't do the right thing.
15:32:11
Xach
schweers: I suspect it is inherited from CMUCL, and the answer may be lost in the mists of time. or not!
15:32:59
phoe
rpg: the type is correctly set to be "tar.bz2" but NAMESTRING refuses to work with it.
15:34:11
flip214
The pathname #<PATHNAME ...> does not have a namestring because the :TYPE component contains a #\.
15:34:22
schweers
rpg: regarding your point that the standard doesn’t specify how to do this: I know that, but it seems like a language lawer move. It seems to me to be an insane way of handling this, but I might be wrong. Hence my question about the rationale for this way of doing things.
15:34:58
Xach
schweers: I think it is reasonable to say that the type is everything after the final "." and the name is everything before.
15:35:34
rpg
Xach: but surely if you actually push a value into type as in this case, NAMESTRING ought to report it back.
15:35:40
schweers
Does the standard require namestring parsing and printing to be a bijective relation?
15:36:20
Xach
rpg: if you parse-namestring you get a different object, and that's not what namestrings are for.
15:36:22
rpg
Xach: In that case, I think SBCL should raise an error in response to setting type in that way.
15:45:49
flip214
how about (CONCATENATE 'string filename ".tar.bz2") and avoid pathnames altogether?
15:46:37
Xach
If it were me, I would make a function that makes a new suffix like .bz2 by combining the existing name and type into the name and making the new suffix the type. There are many other options.
15:51:28
Shinmera
pathname-utils has functions to get the "real" type and name of a file, but nothing to push/pop types. Should probably add that.
15:51:30
Xach
ccl had an approach where the namestring had an escape character distinguishing where the name ended and the type began. i don't remember exactly how it was shown, but it meant you would see something like "foo\.tar.gz" or "foo>.tar.gz"
16:29:09
beach
jcowan: Maybe you missed it, but I told you that SICL and Clasp are very very different implementation.
16:39:39
beach
Yes. That part (Cleavir, the compiler framework) is working, and Clasp uses it for its main compiler.
16:40:56
beach
The first intermediate representation is AST. Then the AST is translated to HIR (High-level Intermediate Representation).
16:42:06
beach
HIR is pretty much a standard flow graph as in other compilers, except that only Common Lisp objects are manipulated by the instructions, so address calculations are not exposed at that level.
16:49:47
jcowan
But there is nothing wrong with the idea of writing a back end that outputs Scheme and invokes Scheme procedures that implement the primops.
16:50:29
jasom
jcowan: scheme isn't necessarily an optimal kernel language for CL, but it's certainly ported to everything.
16:50:43
beach
jcowan: Well, the entire compiler is written in Common Lisp, but if you don't mind having a Scheme compiler written in Common Lisp, then that's fine.
16:51:12
jcowan
It would be a Common Lisp compiler that generates Scheme (as opposed to C or C++ or LLVM), not a Scheme compiler.
16:51:57
beach
jcowan: Well, SICL has a similar backend already. It takes HIR and translates it into a very simple subset of Common Lisp.
16:51:58
jcowan
dlowe: Yes, but generating Scheme means you can use more capable Scheme systems than Guile
16:52:14
beach
jcowan: That way, I can execute SICL code inside a Common Lisp host, in this case SBCL.
16:53:52
jcowan
This is distinct from aeth's desire to have a Scheme compiler that generates Common Lisp.
16:56:49
phoe
...I just realized that if someone tried to make a Common Lisp successor and if they called it Uncommon Lisp, it would be pronounced like "uncle".
16:56:52
jcowan
Unfortunately aeth and I were discussing the two ideas at the same time, and I occasionally lost track
16:59:10
jcowan
Scheme has also been thought of an as an UNCOL (Universal Computer Oriented Language), or mechanism for translating between any two other computer languages
17:04:31
semz
rpg: Thanks for recommending CCL the other day. After a few hours of beating it with a stick it worked without any visible trouble.
17:14:32
semz
phoe: There were four problems. The first was the usual missing glibc-specific includes, <mcheck.h> and <fpucontrol.h>. Interestingly enough, fpucontrol.h didn't seem to be actually used anywhere.
17:15:05
semz
The second was a missing definition of struct _libc_xmm, or more accurately the fact that this struct has no name in musl. A somewhat ugly way to fix that was to define struct _libc_xmm in the same way in the source file
17:15:24
semz
The third was a glibc-specific function to get a version string which I just replaced with a placeholder
17:16:15
semz
Finally, the kernel would compile but segfault during relocation (do_relocs wrote to j_SPjmpsym which is readonly). This was fixed by disabling PIC though this might bite me later
17:16:43
jmercouris
I just assumed they made fasls and had a specialized "kernel" that could load their own fasls
17:17:11
phoe
we can compute everything computable by writing programs on punch cards or whatever, there's no point in making any other input device
17:17:37
jasom
jmercouris: they all have a runtime that implements things like GC, I/O and such, but when you compile a function it generates machine code that only assumes the existence of that runtime.
17:18:23
jmercouris
jasom: wow, it actually made asm on my screen with disassemble, very interesting
17:18:54
jasom
jmercouris: if you run a profiling run first than disassembly will also have instruction level profiling information
17:19:49
Bike
most compiled c programs do not run on bare metal either. there's no need for them to.
17:20:38
jasom
jmercouris: and when you save an image, it dumps all of ram to disk, including the compiled functions
17:21:01
Bike
do you know what a compiled c program looks like? you get an elf or a mach-o or whatever, which has code, and a bunch of other stuff
17:22:08
jmercouris
though I assume on embedded devices, for microlisp? ulisp? there is a way to make JUST the instructions that run the program, right?
17:23:13
jasom
sbcl does not currently have a working tree shaker (though there was a prototype one about 10 years ago)
17:23:54
jasom
This is odd because embedded devices now adays are much beefier than a mid-80s lisp machine.
17:24:46
dlowe
you have root objects that are always accessible. Those objects refer to other objects that must be kept live.
17:25:20
jasom
jmercouris: well actually it's a graph, but it's a directed graph with known roots. If you remove e.g. the common-lisp package from the roots, then any functions in common-lisp not referenced from your program will "fall out" of the tree. Hence a tree shaker
17:25:38
jasom
jmercouris: you have it backwards. All objects in CL are reachable from a set of root objects.
17:26:04
jasom
jmercouris: this is how garbage collectors work. any objects not reachable from the set of root objects are no longer in use, and thus freed.
17:26:52
jmercouris
okay, so there is no root object, but a set of root objects that all CL implementations implement?
17:27:23
dlowe
anyway, a tree shaker lets you specify, explicitly, which root objects you *actually* care about, and then prunes objects that don't have a reference to them.
17:28:31
jmercouris
let's not get into that, especially not when we begin talking about distributed systems
17:29:20
Bike
so as an example, in lispworks, you usually distribute images that don't include the compiler
17:29:30
jmercouris
okay, so let's say a given implementation, how do they decide what the root objects will be?
17:29:45
Bike
so the lispworks whatevermacallit shakes out the compiler functions and stuff that's dead if those aren't in.
17:30:34
jasom
jmercouris: everything reachable from the global environment. e.g. everything in all of the packages defined by the implementation (including, but not limited to the COMMON-LISP package)
17:31:02
specbot
The Global Environment: http://www.lispworks.com/reference/HyperSpec/Body/03_aaa.htm
17:31:35
jasom
For tree shaking, you just remove all of the non-user-defined packages from the root set, and then anything not used by user-defined packages is no longer reachable, and can be safely deleted.
17:31:52
dlowe
The after-tree-shaking image is not guaranteed to be a conforming implementation of CL. :)
17:31:55
jasom
It's actually somewhat trickier than that (the devil is always in the details), but that's the idea.
17:33:08
jmercouris
I have these nebulous images in my mind of the different components working together
17:33:13
jasom
if they try to convert strings to symbols at runtime (e.g. they are implementing an interpreter) it won't work right, but if you have an interpreter then you need the whole runtime anywas and shouldn't be using a tree-shaker.
17:34:04
jmercouris
does it free them from memory? is there some special process? is it tied to the implementation? is there a CL command?
17:34:43
jasom
jmercouris: It is not built into the standard, but almost all implementations provide it.
17:35:09
jasom
jmercouris: plus, most implementations usually run the GC implicitly before saving an image (Because it would be stupid to not to)
17:37:41
jasom
ECL with the boehm collector disabled would work; you can use free() to free the objects.
17:37:53
Bike
a system with manual memory management but without fixed addresses sounds pretty weird.
17:38:56
dlowe
you'd have to free your bignums, but you don't actually know when it stops being a fixnum without checking.
17:42:10
jasom
One day a student came to Moon and said: “I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons.”Moon patiently told the student the following story: “One day a student came to Moon and said: ‘I understand how to make a better garbage collector...
17:44:00
onion
[you are] missing [a] noun. i would really like the opportunity to organize and lay out my own memory and addresses, that was my favorite thing
17:44:06
phoe
onion: there's no way to refer to cycles *as* references without traversing the whole reference tree each time you modify a pointer.
17:44:25
phoe
because a single modification of a reference can either create a cycle or break a cycle or both.
17:44:35
onion
the reference count is just a number, starts at 1 on instance create, free object when its at 0
17:46:08
jasom
onion: #1=(A . #1#) <== this will never be collected because it will always have a reference count of at least 1
17:48:01
makomo
i added the quicklisp loading code into my .sbclrc but it seems i can't use any of ql's functionality directly after (load quicklisp-init) is evaluated?
17:48:41
phoe
makomo: are you using symbols from the QL package in the same form where you do the LOAD?
17:48:43
makomo
i wanted to add a few lines of code which would automatically push a path onto ql:*local-project-directories* and call (ql:register-local-projects)
17:50:16
phoe
onion: the problem of reference counting has been solved many times and there are no sane ways of turning cycle information into reference counts, which are numbers.
17:50:56
phoe
each time you modify a pointer, you have to traverse the tree and see what changed. so basically after every modification of a reference, you run GC.
17:54:50
sjl
http://www.cs.virginia.edu/~cs415/reading/bacon-garbage.pdf is a good read if you haven't already seen it
17:57:36
Baggers
the slime-repl code says 'This used to be the default REPL for SLIME, but it was hard to maintain' what is the default repl used in slime now?
17:58:53
Xach
Baggers: inferior-lisp, I think, is the default. my impression is that few go with it.
18:00:22
Baggers
Xach: Cheers. So the common case is probably still slime-repl then? I've just been using slime-fancy for ever without thinking about it
18:00:56
fourier
phoe: it is sort of solved via using different kind of reference counted pointers and by thinking about objects life time and ownership. to solve cycle problem you just have to think if the object is allowed to hold the life cycle of another object or not, and use weak pointer if not
18:06:28
jasom
fourier: weak pointers work for many useful types of data structures, but not for the general case
18:07:26
jasom
e.g. a tree with parent pointers, it's obvious that the parent pointer can be weak; a doubly-linked list, one of the two links can be weak &c. But if it's "I represent a bunch of nodes that may be a coset of other bunches of nodes, and they are directed" there is no solution
18:17:38
asarch
"A half abstraction is expressed in code by a manifestation of the pattern, you're guaranteed to have massive code duplication with all the normal bad consequences that implies for maintainability." —Practical Common Lisp
18:22:03
onion
phoe: okay, i see and didnt know that; havent come across many cycling stuff in my time of refcounted platforms
18:22:06
jackdaniel
patterns (in GoF sense) are considered unnecessary in CL, where you have macros which can capture such patterns in a good abstraction
18:22:35
jasom
jackdaniel: I gave a counterexample to that just a few lines earlier; the with- macro pattern.
18:25:25
jackdaniel
having plugins which could be loaded into existing system could be 'standarized' if we had protocol-oriented libraries for instance
18:26:28
jackdaniel
"avoid macros if you can express something as a function" is a pattern too (sadly some programmers doesn't follow it)
18:27:52
phoe
they are repeatable, in a way, but they definitely do not mean the same as design patterns in more javalike programming languages.
18:28:45
jackdaniel
design patterns are some clues how to arrange things to make them work. it would be suprising if same design patterns would apply to fundamentally different languages.
18:30:35
Bike
sometime i should actually flip through that book on architecture and see how it got so big on programming of all things
18:31:02
aeth
jackdaniel: I would say "if you can express something as an inline function" rather than "as a function". If people are doing macros for performance, the only persuasive alternative is inline functions.
18:40:51
aeth
Perhaps things like how to structure your with- macros, e.g. this article: http://random-state.net/log/3390120648.html
18:44:45
scymtym_
there are multiple kinds of patterns in the OOA/D space. general responsibility assignment patterns (GRASP) are more general guidelines like in jackdaniel's macro example, design patterns in the GoF sense are actually patterns with a name, problem statement, etc. and specific roles that match parts of the design model and architecture patterns are yet another thing
20:00:58
phf
what was the name of the project of implementing most of the Standard in portable lisp, that i believe beach was working on and that the c++/llvm lisp compiler is using?
20:08:07
onion
is it possible to.... link symbols, like a symbolic link in the filesystem? for eg 'this-symbol points to whatever 'this-other-symbol points to
20:13:20
jcowan
In particular, you can redefine standard functions provided that doing so does not impact other functions
20:13:37
jcowan
e.g. you can redefine car to do something else, but this must not affect the definition of cadr
20:17:07
onion
that would be quite the implementation to define the behavior of .. changing parts of CL =)
20:17:40
specbot
Constraints on the COMMON-LISP Package for Conforming Programs: http://www.lispworks.com/reference/HyperSpec/Body/11_abab.htm
20:18:04
onion
in smalltalk its totally cool, to change system stuff, undefined behavior is kind of assumed to do that stuff too. people are a bit self conscious when they find themselves changing system core guts ...
20:18:58
Xach
I like changing internal behavior in my favorite implementation but I don't expect it to work on anything but the version of the implementation I changed.
20:19:40
onion
jcowan: ah cool, so in scheme, the stuff that already "links" or refers/points to system builtins, they are still ok ?
20:20:19
phoe
onion: so it is permitted to tweak your implementation's internals - just don't expect any kind of support when you do so on your own
20:21:38
aeth
Clearly, the solution with a native code compiler is to recompile everything that uses car so that the desirable new behavior is used.
20:22:33
jcowan
and if car is redefined to return a newly created car object, the likelihood of the compiler continuationg to work after a pervasisve change is small
20:23:44
pierpa_
jcowan: I seem to remember that it is possible to redefine CAR. No standard function must change behaviour because of this change.
20:24:51
jcowan
In R6RS and R7RS systems, car is imported from a library, and that makes it an error to redefine it
20:25:27
onion
so for ex., i could modify the symbol lookup stuff a bit, hackish, and add my own little symbol list for lookup. not that symbol links/aliases have any practical use, im just curious
20:29:18
onion
CL especially being one of the least tempting runtimes to 'customize' considering its purpose. albeit general =)
20:30:17
oleo
yah, the when the runtime system says it's UBER it doesn't have to be UBER when you port your ideas....
20:43:45
pagnol
I'm looking for something that would allow me to verify that an s-expression has a certain structure in a declarative fashion
20:47:36
aeth
destructuring-bind and a trivial do-destructuring-bind macro are the way to go, probably. https://gitlab.com/zombie-raptor/zombie-raptor/blob/840ea66d8f264ddaa11d4c65ebb348febe8e77c6/data/shader.lisp#L43-47
20:48:40
pagnol
I would like to declaratively specify that what follows :depends-on should be a list of keywords, for example
20:49:41
aeth
you can combine destructuring-bind and the 5-line do-destructuring-bind to write a declarative macro that essentially combines them. Probably < 40 lines.
20:49:57
oleo
(defun isomorph-p (a b) (cond ((atom a) (atom b)) ((atom b) nil) ((isomorph-p (car a) (car b)) (isomorph-p (cdr a) (cdr b))) (t nil)))
20:50:12
|3b|
ACTION wonders if there are any better parsers available for lists than last time i looked. most of the ones i found only worked on character input
21:03:16
Xach
jasom: that seems to be a variation of what i said. (which does not bother me...just want to make sure i understand.)
21:04:58
aeth
Something like this is more idiomatic imo: (let ((foo `(+ 1 2 3))) (destructuring-bind (symbol &rest arguments) foo (check-type symbol symbol) (apply symbol arguments)))
21:05:16
aeth
destructuring-bind makes your assumptions concrete and that gives you more useful errors when they're wrong!
21:06:03
aeth
car/cdr/caaddr/cdddadr/etc. are just ways to get a random NIL. And in CL (car NIL) => NIL and (cdr NIL) => NIL so you don't know where the NIL was introduced, so you don't know where the s-expression was malformed.