<hashfunc569>
this returns an object of type PACKAGE.
<hashfunc569>
i explicitly specified that my slot should be of type STRING
<hashfunc569>
is specifying a type-specifier with :TYPE absolutely useless?
<hashfunc569>
i didn't even get a warning when setting the slot to an object of type PACKAGE?
<hashfunc569>
am i doing something wrong?
<Catie>
It depends on your implementation and optimization settings
<Catie>
SBCL largely ignores :TYPE specifiers in slots, but I think with low speed and high safety settings it might raise an error
Guest74 has joined #commonlisp
<yitzi>
Just use `:accessor` instead of read and write.
<hashfunc569>
Catie: it looks like it's only useful for checking the types in :INITFORM
<hashfunc569>
other than that it seems like it's ignored for the remainder of the program
<hashfunc569>
yitzi: why?
<Catie>
You could roll your own accessors that do type checking if you'd like
<hashfunc569>
Catie: yeah, i thought about doing some manual type-checking, and i suppose i'll have to now. or i'll just move the initial definitions of the slot into :INITFORM and out of INITIALIZE-INSTANCE
lisp123 has joined #commonlisp
igemnace has quit [Remote host closed the connection]
<yitzi>
hashfunc569: cause this is simpler `(name :accessor name :initform "" :type string)`
<hashfunc569>
yitzi: ok, i'll take that into account. thanks
<hashfunc569>
Catie: thanks for the help
<Catie>
hashfunc569: Absolutely, any time!
morganw has quit [Remote host closed the connection]
random-nick has quit [Ping timeout: 260 seconds]
lisp123 has quit [Ping timeout: 256 seconds]
zacque has joined #commonlisp
<yitzi>
hashfunc569: most lispers follow some kind of style guide regarding the order of slot options. Its not completely consistent in all code. There is some variation, but I personally use reader/writer/accessor, initarg, initform, type, documentation order.
<Catie>
Huh. I've always just done a free-for-all with my slot options. I'll look into that as well
<yitzi>
There some disagreements. That guide isn't the only one.
igemnace has joined #commonlisp
random-nick has joined #commonlisp
random-nick has quit [Ping timeout: 252 seconds]
asarch has joined #commonlisp
unixlisp has joined #commonlisp
X-Scale` has joined #commonlisp
X-Scale has quit [Ping timeout: 256 seconds]
X-Scale` is now known as X-Scale
<unixlisp>
Anyone uses beirc? It seemes not to work. Where is scymtym's beirc?
aeth has quit [Ping timeout: 252 seconds]
<Guest74>
last time I tried using cl-irc, which beirc uses, it had problems with how libera formats some responses.
<hashfunc569>
is there a general rule of thumb for when to use CONCATENATE 'STRING vs. FORMAT?
aeth has joined #commonlisp
rogersm has joined #commonlisp
<Catie>
FORMAT is usually more concise, I tend to prefer it
cosimone has quit [Quit: ERC (IRC client for Emacs 27.1)]
<asarch>
Using a sexp-template with my web app, if I want to "separate the logic" using CL-WHO with: (defroute "/elmyra" () (load #P"templates/form.lisp")) I get: The value T is not of type SEQUENCE
rogersm has quit [Ping timeout: 240 seconds]
<Catie>
I believe you want the defined route to evaluate to an HTML string, whereas evaluating a LOAD form will result in T or an error
<Catie>
Whoops, missed a paren there at the very end, hope you can forgive me
karlosz has quit [Ping timeout: 256 seconds]
<asarch>
(form) would belong to the global package, right?
<asarch>
I can use it in the REPL but not from the controller function
<asarch>
"The function MYAPP.WEB::FORM is undefined"
<Catie>
What package are you in in the REPL?
<asarch>
I don't know. How could I check it?
<Catie>
Evaluate *PACKAGE*
<asarch>
#<PACKAGE "COMMON-LISP-USER">
<Catie>
So when you defined the function FORM, presumably you were in the package COMMON-LISP-USER, which is why you can access it from within that package. You'll need to define the function in whatever package you're using for your web app for it to be accessible there
<asarch>
Bingo!: (common-lisp-user::form)
<Catie>
That's an option as well, though I can't say I'd recommend it
<asarch>
Oh :-(
<Catie>
As a general rule it's probably better to define all of your functions and variables in your own packages. Using the CL-USER package isn't strictly _wrong_ or anything, but you might get some weird looks for it
<asarch>
If I evaluate *PACKAGE* from both source code files, I get: #<PACKAGE "COMMON-LISP-USER">
lurker has joined #commonlisp
<Catie>
Neither of your files has an (IN-PACKAGE ...) form at the top?
<asarch>
No, they don't
<asarch>
Funny, isn't it?
<Catie>
Then where was "The function MYAPP.WEB::FORM is undefined" happening?
igemnace has quit [Remote host closed the connection]
<asarch>
In the controller code (defroute "/elmyra" () (load #P"templates/form.lisp") (form))
<asarch>
Which is in the src/web.lisp source code file
<Catie>
And that file has an (IN-PACKAGE ...) form?
<asarch>
No, it doesn't
<Catie>
Then I guess I'm not sure why it's in a different package. It sounds like you've got a solution you like though
<asarch>
I did (in-package :common-lisp-user) in the template/form.lisp file but it still doesn't work, just FYI
<Catie>
Does it work if you use your package instead of :common-lisp-user?
<asarch>
At least the sexp-templates does its work, its content is dynamically (I don't have to stop/restart the server for every change)
<asarch>
Let me see
<asarch>
No, it doesn't work
<asarch>
Funny, isn't it?
<asarch>
But, since this source file seems not to be part of the main package, I think all the "services" like database access and so on won't be available :-(
<Catie>
So okay, are you using multiple packages?
<asarch>
No, only the main package create by the helper
<Catie>
Setting up a project with the "Quickstart" instructions on that website, it looks like each file under "src/" has its own package defined specifically for that file, is that not the case for you?
<asarch>
D'oh!
<asarch>
You're right! I didn't catch that "issue"
<asarch>
(in-package :myproject.web) did the trick
<Catie>
Hey, perfect! And no worries, when you're staring at source it all sort of starts to become background noise
<Josh_2>
How do I jump in source to the definition of a function?
<beach>
`v' as I recall. My fingers know it, but not my brain.
<beach>
... from the backtrace I mean.
<beach>
Otherwise M-.
<Josh_2>
Thanks :)
<beach>
Pleasure.
wacki has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
beach has quit [Ping timeout: 240 seconds]
makomo has quit [Ping timeout: 256 seconds]
rogersm has joined #commonlisp
xaltsc has joined #commonlisp
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
shka has joined #commonlisp
zacque has quit [Quit: Goodbye :D]
nature has joined #commonlisp
Cymew has joined #commonlisp
notzmv has quit [Ping timeout: 252 seconds]
les has quit [Quit: Adios]
OlCe has quit [Remote host closed the connection]
les has joined #commonlisp
unixlisp has joined #commonlisp
amb007 has quit [Ping timeout: 245 seconds]
<unixlisp>
How to use cl-irc to send message?
<unixlisp>
Oh! I have sent a message using privmsg function of cl-irc.
unixlisp has quit [Ping timeout: 252 seconds]
Dynom has joined #commonlisp
amb007 has joined #commonlisp
s-liao has joined #commonlisp
amb007 has quit [Ping timeout: 250 seconds]
amb007 has joined #commonlisp
MajorBiscuit has joined #commonlisp
mon_aaraj has quit [Ping timeout: 240 seconds]
lisp123 has joined #commonlisp
MajorBiscuit has quit [Client Quit]
MajorBiscuit has joined #commonlisp
mon_aaraj has joined #commonlisp
s-liao has quit [Quit: Client closed]
akater[m] has quit [Quit: You have been kicked for being idle]
attila_lendvai has joined #commonlisp
dec0d3r has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
mgl has joined #commonlisp
OlCe has joined #commonlisp
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
dec0d3r has quit [Quit: Leaving]
rotateq has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
SAL9000 has quit [Ping timeout: 268 seconds]
kevingal has joined #commonlisp
SAL9000 has joined #commonlisp
cosimone has joined #commonlisp
notzmv has joined #commonlisp
worstname has joined #commonlisp
s-liao has joined #commonlisp
s-liao has quit [Quit: Client closed]
random-nick has joined #commonlisp
worstname has left #commonlisp [q]
s-liao has joined #commonlisp
Oddity has quit [Ping timeout: 256 seconds]
razetime has joined #commonlisp
razetime has quit [Remote host closed the connection]
kevingal has quit [Ping timeout: 256 seconds]
razetime has joined #commonlisp
mfiano has quit [Quit: WeeChat 3.4.1]
kevingal has joined #commonlisp
kevingal_ has joined #commonlisp
yewscion has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
aeth has quit [Ping timeout: 250 seconds]
aeth has joined #commonlisp
s-liao has quit [Quit: Client closed]
bru has joined #commonlisp
<bru>
hello, noob question. I want to define a macro that defstruct + defun a function that works on the just-defined struct. If I (defmacro (...) (defstruct ...) (defun ...)) then I only get the defun
<bru>
I've tried putting them in (values (defstruct ...) (defun ...)) (I only get the 1st one), (list ..) (illegal function call), (progn ...) (I only get the last one)
<jackdaniel>
macros transform code into code, so you don't want to evaluate the body - you want to return a list
<jackdaniel>
note the backtick - it is a quasiquote that prevents the evaluation of its arguments
<jackdaniel>
that said, if my advice is on point and you didn't know that, then you should probably read a little more about macros
<jackdaniel>
micro: tell bru about pcl
<jackdaniel>
minion: tell bru about pcl
<minion>
bru: look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<jackdaniel>
micro: sorry, tab completion
<bru>
Ok works, thanks. I did have the backticks (forgot to paste them here), but right in front of `(defun and `(defstruct instead of in front of the `(progn!
<edgar-rft>
micro-tab-completion :-)
<bru>
and I guess that makes sense: the macroexpander would only return either. While with the backtick in front it will return both, which end up at top-level and everything gets evaluated
dec0d3r has joined #commonlisp
<bru>
step2: If I do (defmacro (name &rest args) `(progn (defstruct name ...) (defun ... ;; here, how can I can the "make-$name$" function? I'm doing ,(intern (concatenate 'string "make-" (symbol-name name))) but there's casing issues: I get (e.g.) |make-FOO| instead of |make-foo|
<jackdaniel>
symbols in common lisp by default are upcased
<jackdaniel>
so the name of the symbol 'foo is in reality "FOO"
<jackdaniel>
you may i.e (concatenate 'string "MAKE-" (symbol-name name))
<bru>
Thank you again! So my issue wasn't with the symbol itself, but with my string literals being lowercase
<jackdaniel>
sure, that said I'm skeptical whether you should use macros
<jackdaniel>
usually you should start writing macros when you feel comfortable with the language
<jackdaniel>
(and not a part as a beginner excercise)
<bru>
but where's the fun in that?
<jackdaniel>
I personally find fun in understanding things (i.e not getting confused for no good reason)
lisp123 has joined #commonlisp
epolanski has joined #commonlisp
<rotateq>
and even more fun when you feel some more confident with the basics :)
lisp123 has quit [Ping timeout: 256 seconds]
kevingal_ has quit [Ping timeout: 240 seconds]
kevingal has quit [Ping timeout: 240 seconds]
livoreno has joined #commonlisp
MajorBiscuit has quit [Ping timeout: 252 seconds]
MajorBiscuit has joined #commonlisp
lispy has joined #commonlisp
OlCe has quit [Remote host closed the connection]
<pjb>
bru: a macro should return a single form, but its body can obviously contain several forms (since it has an implied progn). When you have several forms to generate, you can wrap then in any expression to make a single form. Eg. using list would be ok: (defmacro moo (…) `(list … …)) But in your case, you generate top-level forms, def… so you want the form generated to preserve the top-levelness
<pjb>
of the forms it contains, and only progn does that. Hence the solution in: (defmacro moo (…) `(progn … …))
<pjb>
bru: about the value returned by the generated form (by your macro calls), as you can see, defstruct returns the name of the struct, defun returns the name of the function. Perhaps you have a name parameter to your "defmoo" macro? (since it generates def… forms, it could be named defsomething or define-something). Then eyou can return this name. Or you could return the name of the defun, or a list of names. Whatever you
<pjb>
deem useful for the user.
<pjb>
bru: also, for defstruct, you can specify boa constructors, so perhaps you don't need a separate make-… function!
robin has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
orestarod has joined #commonlisp
<Guest74>
So I've made a large number of dexador requests and now I have too many open files to do anything.
<Guest74>
I'm trying out slynk, and it seems related. anybody know how to close all those files?
<_death>
try dex:clear-connection-pool
<Guest74>
thanks. I could have sworn I had that turned off in the request.
<_death>
well, did it work?
<Guest74>
yes, that's what the thanks was for.
<_death>
cool
<Guest74>
I've never checked slime, but slynk definitely seems to be opening a large amount of files.
cosimone has quit [Read error: Connection reset by peer]
cosimone has joined #commonlisp
lispy has quit [Quit: Leaving]
<_death>
back when I had that issue and before I got to analyzing it, I evaluated (sb-posix:close (random 65536)) and hoped for the best.. anyway my workaround back then was to clear the pool after each request (it's a long-running system, but doesn't make too many requests per hour, say).. since then (some years ago) I had no such problem
aeth_ has joined #commonlisp
aeth has quit [Killed (NickServ (GHOST command used by aeth_))]
aeth_ is now known as aeth
<Guest74>
I'll keep that in mind. Usually don't make many requests, but in this case I'm writing a bookmark thing and requested about 4k websites.
<Guest74>
which makes me wonder if there's a web cache in cl.
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
rotateq has quit [Ping timeout: 252 seconds]
amb007 has quit [Ping timeout: 260 seconds]
amb007 has joined #commonlisp
jmes has quit [Remote host closed the connection]
Lord_of_Life has quit [Ping timeout: 240 seconds]
Lord_of_Life has joined #commonlisp
Oddity has joined #commonlisp
lawt2 is now known as lawt
mgl has joined #commonlisp
aartaka has quit [Ping timeout: 245 seconds]
robin_ is now known as robin
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
rotateq has joined #commonlisp
cosimone has quit [Quit: ERC (IRC client for Emacs 27.1)]
cage has quit [Quit: rcirc on GNU Emacs 27.1]
Dynom has quit [Quit: WeeChat 3.4]
wyrd has quit [Ping timeout: 240 seconds]
wyrd has joined #commonlisp
hashfuncf39 has joined #commonlisp
tane has quit [Quit: Leaving]
morganw has quit [Remote host closed the connection]
wacki has quit [Quit: Leaving.]
nature has quit [Ping timeout: 240 seconds]
mon_aaraj has quit [Ping timeout: 240 seconds]
mon_aaraj has joined #commonlisp
tyson2 has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 252 seconds]
cosimone has joined #commonlisp
attila_lendvai has quit [Ping timeout: 268 seconds]
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 240 seconds]
igemnace has joined #commonlisp
shka has quit [Ping timeout: 240 seconds]
tyson2 has joined #commonlisp
yewscion has quit [Ping timeout: 252 seconds]
pjb has joined #commonlisp
bru has quit [Ping timeout: 256 seconds]
karlosz has joined #commonlisp
<hashfuncf39>
just curious. what's your favorite CL implementation to use?