freenode/#lisp - IRC Chatlog
Search
9:22:54
hjudt
paste this into a .ctml template and view it in the browser. then paste it into a html file and view it in the browser. notice what it does to the <b> in the javascript code?
9:24:16
hjudt
in a nutshell: r-clip somehow interferes with the jquery .html() so that it is no longer possible to add tags via javascript.
9:25:09
hjudt
actually i believe it not to be a problem with jquery but any strings that contain html tags in javascript...
9:27:00
hjudt
another minor problem: if i omit the xmlns as i am allowed to in html5, then firefox will show me the dom structure instead of rendering the page.
9:31:31
hjudt
actually this may not be a problem with clip, because manually processing it (clip:process-to-string...) doesn't cause this
9:33:07
Shinmera
hjudt: Plump by default serialises everything as XHTML. You need to emit the proper content-type header.
9:34:37
hjudt
if i download the file via wget, then all seems correct. if i load it in the browser, it doesn't work.
9:38:22
hjudt
yet omitting xmlns in the template makes the browser show the dom tree instead of the rendered page
9:45:07
Shinmera
I don't know what you mean by "notice what it does to the <b>?" It doesn't seem to do anything at all with it from what I can see.
9:46:20
hjudt
mistake on my behalf. clip works correctly, but when i view the page served by radiance in the browser, then the <b>...</b> does not get printed.
9:48:21
hjudt
however, if i use html entities <b>...</b> it works fine when served by radiance too.
9:49:15
Shinmera
It's not a fault of Radiance. The emitted page source is not transformed in anyway.
9:50:04
Shinmera
It seems that it does not consider sub-elements in script tags as part of the script.
9:52:52
Shinmera
Generally: 1. don't write inline JS 2. if you do, either escape special characters or use CDATA
9:54:44
Shinmera
If you output XHTML with the text/html standard content-type you'll run into other problems before long.
9:55:57
Shinmera
You either have to stick with XHTML all the way, or HTML all the way. Unfortunately, only XHTML is really supported by Clip/Plump right now.
9:57:16
Shinmera
The reason why you don't want to write inline JS is because it doesn't cache well. You'll also want to place your scripts before the closing <body>.
9:57:30
Shinmera
So that the DOM can start rendering and doesn't have to wait for your scripts to load.
9:59:06
hjudt
i am not sure if it is better to use html5 than xhtml. probably only if using some of that media stuff.
10:01:03
Shinmera
Anyway, if you want to use JS files with Clip, just place the file in the static/ folder and use <script type="text/javascript" src="../static/foo.js" @src="/static/my-app/foo.js" />
10:12:18
hjudt
maybe clarify this in the tutorial? when i started using your tutorial, i did not go with your plaster example but with my own project. i only used the tutorial as guidance. perhaps other people have a similar work flow, then it would help them to know about these things. your mileage may vary...
10:27:35
pillton
jasom: I wonder how that "minimizes the difference between compiled and interpreted programs"?
12:57:49
tfb
pillton: because both compiled and interpreted code must make the same assumption (ie it's not the case that this restriction is true just if you have compiled a file)
13:00:48
Bike
and it's in there in the first place so that compilation can do, like, anything. if you can't assume definitions are stable you can't really do any analysis except on CL: functions.
13:01:57
tfb
Bike: yes. I was going to say that it would be possible to make the opposite assumption (you can never assume a function is what it looks like it is) but that would make it stupidly hard to have a good compiler
13:20:29
knobo
If I have a usocket stream, does alexandria:read-stream-content-into-string read everything until socket close, or do I have to run it in loop?
13:36:08
Shinmera
"Sequence is destructively modified by copying successive elements into it from stream. If the end of file for stream is reached before copying all elements of the subsequence, then the extra elements near the end of sequence are not updated."
13:37:37
whoman
like Shinmera put your mark over alexandria:read-stream-content-into string then press M-.
14:24:02
whoman
got some inspiration from another channel to look at experimenting with languages, parsing and evaluation. a cs field i never got completely into directly myself, is compiler technologies
14:28:11
whoman
is it mcclim backend stuff ? if i had any self-management at all, i would have a project to organize all my project ideas so im not frozen and suffocating with inspiration =P
14:29:06
beach
Not this time. Because you mentioned compiler technology, I was thinking more about SICL and Cleavir, but I really don't have any project already thought out.
14:29:09
whoman
curious though! ive got many ideas but not enough brain memory or consistency with current personal life to commit to one or two
14:29:36
minion
whoman: Cleavir: A project to create an implementation-independent compilation framework for Common Lisp. Currently Cleavir is part of SICL, but that might change in the future
14:34:45
beach
mazoe: That is where we discuss a lot of the SICL and Cleavir stuff, since Clasp is slowly turning into a SICL system (SICL generic function dispatch, Cleavir compiler, SICL first-class global environments, etc.).
14:37:00
minion
whoman: SICL: SICL is a (perhaps futile) attempt to re-implement Common Lisp from scratch, hopefully using improved programming and bootstrapping techniques. See https://github.com/robert-strandh/SICL
15:09:15
beach
whoman: If you want to learn about compiler technology, I recommend the book by Muchnick: Advanced Compiler Design and Implementation
15:10:25
beach
whoman: The book is good in that it summarizes research into each domain. However, the algorithmic language in the book is really bad. So I typically go to the source (usually a published paper) for the details of some technique.
15:13:41
beach
The problem with most books that pretend to be about compilers is that they handle most of the uninteresting topics in depth (like parsing) and then they become very skimpy on the important part (like code optimization).
15:14:41
beach
Now, granted, I haven't read the latest editions of the dragon book, so perhaps it is better than the one I read.
15:14:49
White_Flame
if you don't know how compilers work at all, it's good to know how the heck this "magic" actually does its thing
15:16:04
beach
Yeah, you are probably right. I wrote my first compiler in 1976, so I have probably forgotten the difficulties by now.
15:16:50
White_Flame
yep, like experts saying that a wikipedia page covers everything, yet is totally opaque to learners
16:03:25
beach
He adapted a few things, but it is basically just McCLIM, the listener, the inspector, Climacs, the "debugger", etc.
16:09:38
whoman
beach, hmm, i am alright jumping into advanced topics, learning is no-issue for me, but i learn best by doing and experimenting, getting my hands dirty
16:16:55
phoe
minion: memo for shka: the plots are gnuplot, but he says it will be replaced by McCLIM some time.
16:17:19
phoe
and I really love his arrogance here, where he seems to separate everything into Lisp, UNIX and ALGOL
16:21:27
vtomole
Is there a way I could download clhs so I could open it up in emacs when I need to lookup something?
16:30:15
emaczen
I want ot find the total size of a class object, so I would need to find the size-of each slot
16:31:17
Bike
sizeof in C is an operator. it doesn't work on runtime information. and obviously it doesn't know dick about lisp classes.
16:31:19
whoman
im following the line of questioning. wondering what he is doing with it - may as well do that in C
16:31:27
emaczen
I'm going to write a tree structure to a file and I would need to know the number of bytes to be able to write a search method that seeks through the file
16:32:45
phoe
define some way of serializing stuff, then define some way of finding out what is the required size for the serialized objects
16:33:00
phoe
preferably by serializing them and finding the length of the serialized representation
16:36:03
phoe
you really don't want to serialize Lisp objects as they appear in memory because you'll run into issues with everything, including restoring them to memory in the first place and dependencies on other objects in the second place
16:55:28
jasom
Anyone have a link to a blog article about memory usage on sbcl when running a service? Their solution was to manually invoke the GC periodically, and this caused the memory usage to stabilize sooner and at a much lower value
17:05:40
jasom
minion: memo for emaczen: you don't need to know the size of anything for searching a B-Tree; you only need to know the position of the child nodes.
17:11:11
gendl
Hi, using net.html.parser:parse-html on some utf-16 input - external-formats seem to differ in each Lisp I am trying to use:
17:11:55
gendl
and with SBCL, it is retaining the BOM from the beginning of the file (not so on the others).
17:12:48
gendl
Should I expect to have to conditionalize for SBCL to throw away that first character? Or is there a way to have it auto-detect the BOM and throw it away as the other Lisps apparently are doing? or should I ask this in #sbcl?
17:19:41
jasom
gendl: though if net.html.parser isn't set up to use babel than you may need to modify it or use something else
17:21:32
gendl
jasom: yeah, without overhauling what I'm doing, I think all I need is a portable mapping for :utf-16 external-format - i.e. a parameter *utf-16-ef* which maps to the correct keyword depending on the host Lisp -
17:22:00
gendl
my understanding is that Babel is both overkill and not applicable for that simple purpose... is that right?
17:23:03
gendl
... but i would have to retro-fit net.html.parser to call through babel rather than directly reading stuff, right?
17:23:36
jasom
gendl: correct, and it's been a while, but babel does have some code for handling BOM
17:26:55
jasom
gendl: I just checked and babel will decode any string specified as :utf-16 and starting with a BOM correctly
17:29:10
gendl
well then... looking at my code, maybe I can use babel in conjunction with net.html.parser...
17:29:35
gendl
the external-format is specified on the (with-open-file (in file-name) :external-format ... ) ... )
17:30:49
gendl
so i'm not sure if babel can be used in lieu of the standard with-open-file, or somehow in between the with-open-file and the parsing...?
17:30:51
jasom
gendl: so you can use babel-streams then, assuming your HTML fits reasonably within memory
17:32:25
jasom
gendl: so yeah, if you slurp the file into an octet vector, you can use babel's with-input-from-sequence
17:34:25
gendl
it looks like with-input-from-sequence is a flexi-streams thing rather than a babel thing.
17:37:44
jasom
ACTION needs to finish up his portable unicode stream reading library. UTF-8 is within 20% of the speed of a bare stream on sbcl (sbcl wins only because it generates a conditional move where I generate a branch; I haven't figured out how to massage the compiler there).
18:12:05
ecraven
does slime have a command to copy the output of the last command? I can clear it, but there seems to be nothing to copy it to the kill ring?
18:15:54
pjb
ecraven: you could write a command that would move the point to the previous presentation and use slime-copy-presentation-at-point-to-kill-ring.
18:26:25
rpg
When I copy stuff into the REPL in SLIME sometimes I get errors where a list is mistakenly treated as a funcall...
19:06:04
Xach
Hmm, is there a sly repl command to search for previous input in history? I use M-r for that a lot in slime.
19:29:25
didi
In SLIME, can I limit the number of elements of a sequence it will print? If my sequence has many elements (> 1 M) my slime lose the connection to the inferior process. Emacs also consumes lots of RAM in the process.
19:37:24
Bike
i usually just set it to 20 or 50 or something. not like i'm gonna get much out of longer lists or strings
19:37:38
pjb
The thing is that you may want a different *print-length* in the normal REPL, the slime REPL or C-u C-x C-e in buffers.
19:41:29
mtl_
anyone here remember how to define progn as a macro? Just trying to explain it to a friend, but I'm too rusty(haven't touched any code in months) and tipsy to remember
19:42:49
Xach
mtl_: there are many ways, but (defmacro .progn (&rest forms) `((lambda () ,@forms))) is one option
19:44:04
mtl_
again not for serious programming just to illustrate a point to a friend who's learning lisp
19:44:26
Bike
you can do pjb's, or you can do like (defmacro progn (&body body) (cond ((null body) nil) ((null (rest body)) (first body)) (t `((lambda (x) (declare (ignore x)) (progn ,@(rest body))) (first body)))))
19:46:38
pjb
(defmacro progn (&body body) (cond ((null body) 'nil) ((null (rest body)) `((lambda () ,(first body)))) (t ((lambda (x) (declare (ignore x)) (progn ,@(rest body))) ,(first body)))))
19:47:32
pjb
Here we have a recursive call to the macro body, so the total macro expand is like (lambda (x) (lambda (x) … (lambda (x) last-body-form) …) first-body-form).
19:48:55
Bike
what this relies on is that lisp is call by value, which is kind of interesting, but kind of far away from progn
19:49:02
pjb
Bike: Sorry, I'm sleepy. I thought you were defining .progn, not progn, and your recursive call was cl:progn instead.
19:55:20
mtl_
was just a bit rough to jump straight into recursive macros after not touching lisp for months(or any programming in general)
20:01:57
Bike
(defmacro progn (&rest forms) (let ((s (loop for f in forms collect (gensym)))) `((lambda (,@s) (declare (ignore ,@(butlast s))) ,(first (last s))) ,@forms)))
20:02:14
Bike
saying that progn can be a macro basically amounts to saying other parts of the language have sequencing
20:05:16
mtl_
well I'm not getting into the gritty details, just trying to illustrate the power of macros to my friend
20:07:48
pjb
You probably need to insert this nil in your lambdas too to disable declarations in the body.
20:11:29
phoe
you could dig ppcre and trivia. they both generate complicated code at macroexpansion time to save up on cycles during runtime
20:13:25
pjb
Sure. You can implement everything in lambda calculus, so you can expand everything to lambdas.
20:13:34
Bike
in scheme let is a macro in terms of lambda. it's more difficult in lisp due to declarations and speciald and stuff.
20:14:16
mtl_
yeah you can turn it into a lambda function call with all the names being arguments to the lambda
20:31:53
minion
emaczen, memo from jasom: you don't need to know the size of anything for searching a B-Tree; you only need to know the position of the child nodes.
20:35:23
phoe
emaczen: for very implementation-specific stuff, implementations have their own channels.
20:38:45
Bike
sizeof is implementation specific in C (which is why it exists), and C has a lot more restrictions on memory than lisp does
20:40:31
emaczen
Bike: Is it completely unreasonable for language designers to enforce memory restrictions in their standards?
20:42:57
Bike
it's not completely unreasonable, but imposing perfect restrictions of "this object takes up N bytes" wouldn't be very reasonable either, for almost all applications.
20:44:28
Bike
first off it's usually pointless, and secondly the language would be obsolete as soon as a new system with differently aligned loads or something appears.
20:45:08
Shinmera
Plus forcing memory constraints eliminates a good class of potential optimisations an implementation could do.
20:46:04
Bike
like what, "a word is some implementation defined number of bytes, and a cons is two words"?