freenode/#lisp - IRC Chatlog
Search
0:03:47
fiddlerwoaroof
didi: EVAL-WHEN sounds a bit scary, but there's only really one form that you'll find yourself using in most circumstances: (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)...)
0:04:59
cl-arthur
pjb: cheers, several interesting ideas there! Will comb through more carefully tomorrow :)
0:36:23
Josh_2
how can I go from a list like (list *header* *index-body*) to just *header* *index-body* so I can pass the arguments of an unknown length list to a function like append
0:39:07
Josh_2
(cl-who:conc who:*prologue* "<html>"(first (mapcar #'cl-who:conc list-of-html-vars))) "</html>"))
1:13:06
comborico1611
Does LOAD allow a form calling a function before that function is defined in a compiled file?
1:14:12
jasom
comborico1611: define "calling". You can define functions that call functions that have not been defined. Actually calling the function as a toplevel form is unlikely to do what you want.
1:15:30
comborico1611
jasom: (some-function 'whatever) [then on next line] (defun some-function ....)
1:16:14
jasom
comborico1611: yeah, that's not a good idea; I don't know off the top of my head if it's allowed (assuming some-function is already defined before you call LOAD)
1:17:41
Josh_2
jasom: https://plaster.tymoon.eu/view/1232#1232 so I have *index-body* and *navigation* both evaluate to strings but I want to stick the value of *navigation* into the macrobody and get it to evaluate Q_Q
1:19:53
Bike
some forms may be evaluated at compile time to support that, like macro definitions, but most things aren't run
1:20:19
Bike
i'm not sure what you really want here - not having to worry about order makes sense if it's not a sequential list of things to do, but if it's not a list of things to do putting a (some-function 'whatever) call at top level is nonsensical
1:22:16
comborico1611
This cart-before-the-horse ordering is mainly to aid in reading code by zooming out of details.
1:23:13
Bike
i mean, and i just want to reiterate this, (defun foo () (some-function 'foo)) (defun some-function ...) is fine
1:27:40
jasom
cl-who:str puts a string directly into the output without escaping. cl-who:esc does the same, but escaping things (so e.g. < becomes <
1:30:06
jasom
Note however, that I usually compose with functions, as that allows for more dynamicism; it's not needed for your example, but here is me doing it gratuitously: https://gist.github.com/jasom/4d6d8aa38204f3c80db974cb20140aec
1:32:11
Josh_2
I was just use defparams while I messed around and got a grip with cl-who but it appears to have been an hinderance
1:33:16
jasom
you can actually completely omit the optional outstream argument if you just want to always use *html-outstream* but I find it easier to pass a stream as a parameter than to bind a special when I'm doing quick checks of what functions will return at the repl.
1:34:58
jasom
e.g. you could call (navigation *standard-output*) at the repl to print the output of just navigation.
1:42:32
Josh_2
jasom: https://plaster.tymoon.eu/view/1233#1233 when I run (index-page) I only get <html></html>..
1:42:44
jasom
and for many (most?) real world examples I use &key rather than &optional because I have kwards
1:44:16
jasom
if you really want to build strings for each intermediate chunk you would want to do e.g. (str (header)) rather than just (header)
1:59:31
Josh_2
now I have to create a stream handling function for hunchentoot, so I can output that stream to my webpage
2:04:13
moldybits
is it possible to do something like this without defining a block first: (defun foo () (when bar (return)) ...)
2:09:27
Josh_2
jasom: I used (make-string-output-stream) and then (get-output-stream-string) and that worked
2:16:59
jasom
though IIRC that might be a binary stream, so you might have to make a bivalent stream on top of that
2:17:31
jasom
(send-headers) on hunchentoot returns a binary stream that you can write the response to
9:25:29
heisig
What does #lisp think about having an extensible defclass macro? Or is there already such a thing?
9:26:07
heisig
The idea would be that the metaclass can decide what clauses are allowed and how they are handled.
9:27:46
heisig
For example, one could define default methods for (:metaclass structure-class) that expand the entire thing into a defstruct definition.
10:02:58
heisig
shka_: I know. But how do I pass additional arguments to my custom metaclass? By not using defclass?
10:06:48
shka_
ok, so you want to pass extra options to make instance called on your metaclass, right?
10:09:19
heisig
But I am not sure whether that is a sane thing to do. The spec doesn't allow it, so I guess there must be a reason.
10:09:35
shka_
well, i think that passing additional options in usual place in defclass may be portable enough
10:16:43
shka_
maybe you can simply add your own initialize generic function and simply call it manually
11:08:05
heisig
jackdaniel: Yes, shadowing CL symbols is not a wise move. I will either call it define-class or defclass*.
11:29:05
akater
Does SBCL do “translation to C” at any point to produce native code for ANSI CL? (I believe it's not but I'd like to make sure.)