freenode/#lisp - IRC Chatlog
Search
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.
14:15:42
jjkola
my quicklisp update became partially borked and now some of the package are still using the old version even though the latest is available and installed
14:17:57
jjkola
when I connect to slime it says the version is 2.20, and also when I connect to other instance where the dists version is latest, slime complains that swank is 2.23 while the currently used is 2.20
14:23:10
jjkola
the reason it became borked was because when updating it complained that ubiquitous could not be found
14:25:29
Xach
jjkola: it seems to me like emacs is loading an old slime through some other means. where does emacs think the function slime-connect is defined?
14:26:33
Xach
Then you will be in slime.el and can check the path to the file with C-x C-f for example
14:27:01
polezaivsani
Hi! Does anybody have tips on what reference (or else) material is good for getting up to speed with subj for somebody having a basic grasp of scheme? I'm thinking to scratch an itch with sbcl planning to learn as i go/fall.
14:27:43
Xach
polezaivsani: first, forget everything you know about scheme when trying to learn how to use CL and SBCL effectively. second, there are many good books on the topic. i like practical common lisp and paradigms of ai programming.
14:27:53
polezaivsani
Bike, thanks i know that. i mentioned scheme to let you know that i have some relevant exp
14:28:15
Xach
i found scheme experience to be harmful rather than helpful, but your experience may vary
14:28:19
Bike
i don't think you have to forget _everything_, but it's definitely a distinct language
14:30:19
Xach
jjkola: hmm! the swank.txt file should point quicklisp-slime-helper to the 2.23 version. i don't know why it is not.
14:31:01
polezaivsani
Oh, i didn't thought of scm experience to pose an issue - i'll keep an eye out for it!
14:33:50
Bike
in lisp the same symbol can name multiple different objects in the same scope, unlike in scheme
14:35:09
polezaivsani
i too worry mostly about recursion, namespaces doesn't seem that big of a deal to me
14:37:15
polezaivsani
thanks for the hints fellows! i heard good praises about PCL and will prob stick with it for now
14:38:00
Bike
the tail recursion thing does imply actual restructuring of program logic more, though.