freenode/#lisp - IRC Chatlog
Search
0:41:02
slyrus_
Ugh... My xml-foo is rusty. Are there any libraries for dealing with XML schemas (besides cxml-rng -- I want old school XML schemas not RNG schemas -- I think).
1:22:51
Josh_2
Something about if I'm using eval I'm doing something wrong Q_Q https://plaster.tymoon.eu/view/1230#1230 can someone please help me fix this.. it works but it doesn't seem right to do it this way
1:28:16
Bike
it looks like replacing (eval `(ps-to-stream ,stream ,x)) with (ps-to-stream stream x) should be fine
3:28:51
Josh_2
I can't have inline cl with hunchentoot can I, I have to generate my code dynamically using a library like cl-who and then output that with whatever modifications I want based on variables like cookies or post values??
3:29:32
no-defun-allowed
you can have inline CL, using FORMAT or the like, hunchentoot just wants a string
3:29:41
no-defun-allowed
but use CL-WHO cause it's really good and lets you use CL macros for templating
3:30:18
gilberth
Heh, same problem! APIs that tried to be clever by offering macros instead of functions :-)
3:31:44
no-defun-allowed
(define-easy-handler ... (format nil contents-of-file . args) or even just (define-easy-handler ... contents-of-file)
3:32:08
no-defun-allowed
gilberth: CL-WHO tries (and succeeds) to be clever because it generates calls to WRITE-STRING to emit the HTML
3:32:49
no-defun-allowed
and it has a very convenient DSL which lets you jump between s-exp HTML and CL so it has to do that, unless you want quasiquotation and effectively an "interpreter" of the DSL
3:34:54
gilberth
I like a more functional approach better: build some internal representation of the HTML and then dump that.
4:03:09
pillton
Josh_2: It is often better to write functions to generate the code you want first. Once you are happy with the result, define the macro function to invoke those functions.
4:10:39
beach
I am not so much here either actually. I am traveling with a dinky laptop. Very small and very slow. So it's not comfortable at all.
4:11:31
gilberth
Heh, but at least it seems to have a keyboard. So it is better than a smart phone for typing :-)
7:00:14
fiddlerwoaroof
e.g. if I want to type numbers like 1_000_000, can I do it by saying "ignore _" without re-writing the number reader?
7:11:48
fiddlerwoaroof
Hmm, I guess you could wrap the input stream to contextually suppress underscores
7:12:49
slyrus_
gilberth: do you know if anyone has extended cxml to work with XML Schemas (besides the cxml-rng stuff)?
7:14:14
fiddlerwoaroof
e.g. (let ((*standard-input* (underscore-ignoring-stream *standard-input*))) (loop (print (eval (read *standard-input*)))))
7:14:49
fiddlerwoaroof
where the wrapping stream would peek-char to see if there was an underscore waiting and, if so, not pass it along
7:16:03
gilberth
slyrus_: Sorry, I don't. Althrough I am the original author of cxml, I left it last century. Sorry about that.
7:17:37
gilberth
fiddlerwoaroof: You still want to be able --- in theory --- to read symbols like "foo_bar"?
7:18:24
fiddlerwoaroof
Even then, you could have a little state machine that detects <whitespace><number> and then activates underscore-ignoring mode
7:20:43
fiddlerwoaroof
While, the reason I'm asking is that I'm interested in thinking about the various sorts of incremental changes that can be made to the lisp reader
7:21:19
fiddlerwoaroof
And I happened to see a post about how Haskell has a language extension that lets it accept the Swift/Ruby style numbers with _ as a separator
7:21:21
lieven
good luck. I've always found the chapter about the reader with its constituent and non constituent characters etc one of the scariest in the spec
7:22:10
fiddlerwoaroof
lieven: interesting, I haven't written any really complex reader macros, but I've never found them particularly difficult to implement
7:23:03
gilberth
On the lisp machine the package prefix was a prefix. You could say FOO:(BAR BAZ QUUX)
7:23:28
fiddlerwoaroof
Well, for the first one, couldn't you copy-readtable and get a readtable that that worked for?
7:24:16
lieven
the lisp machine also had an extension for file syntax IIRC. where you could put Syntax: into the first line and it would load the syntax/readtable stuff for you
7:24:23
gilberth
OK. What you are up to? Do you want to serious experiment with new syntax, or do you just want 1_000_000 to work?
7:26:17
fiddlerwoaroof
what sorts of syntax changes it makes easy, which ones it doesn't help with and which it makes hard
7:28:36
fiddlerwoaroof
So, for example, here is your #x read-macro: https://fwoar.co/pastebin/2b5f2890b117d66c487933fdfaa954c6cd870c75.nil.html
7:29:04
gilberth
We can redefine a single character as reader macro easily, like, say, to read "?X" as "(? X)". What you want to do is to dig into the token reader, which is not accessible through the read table.
7:32:18
fiddlerwoaroof
Yeah, I don't mind this sort of problem all that much, though, because it's easy to fix (at the cost of some amount of mis-communication)
7:32:47
fiddlerwoaroof
Things like logical pathnames having an extremely limited character set are harder to work-around
7:34:56
gilberth
Heh, show me one CL implementation, which handles logical pathnames in any sane way anyway.
7:36:40
gilberth
If you want the "_" business: Rewrite the token reader. That is not hard only tendious.
7:37:44
gilberth
Install it to all the constien..., constent.., --- you know what I mean --- characters.
7:40:55
gilberth
fiddlerwoaroof: Take the hard tour. Rewrite the token reader. You only need to get the escaping rules right. You could pass everything, that is not a number to the default reader and be set.
7:44:10
gilberth
"|" and assemble a string. I'd check that for a potential number, strip the "_" and pass it along.
7:48:32
fiddlerwoaroof
Because I'm cheating: I just map over the list and check for any symbols like 1_000_000 and re-read them without the underscores
7:50:15
fiddlerwoaroof
The hard tour sounds like a job for sometime when I'm not about to go to sleep :)
7:51:36
gilberth
That is fine. But: As I said, you only need to get the "\" and "|" escaping rules right. That is not that hard. Assemble a string, check for it being a number, strip "_" if needed and pass the token to the default reader, perhaps by READ-FROM-STRING.
7:53:42
fiddlerwoaroof
What I don't understand is how I'd "activate" the new READ: bind it to all the constituent characters?
7:55:04
gilberth
I'd test it with just entering the new syntax with some random prefix character like "@" or "$", so you will not blow up the whole Lisp until you're set.
8:00:17
gilberth
Oh, and when you delegate, don't forget to install the default read table before calling say READ-FROM-STRING.
8:01:44
gilberth
Sorry, I am a bit passive aggressive right know. Let me correct that: Good morging, splittist. Sorry about that.