freenode/#lisp - IRC Chatlog
Search
19:20:00
Bike
if you explain your problem in more detail, it's possible someone could come up with another solution.
19:21:13
kenster
the first argument is the class and the second the params you want to pass into make-instance
19:22:21
kenster
:content-file (make-instance 'hosted-content-file :id (b32c:b32c-decode content-id) :file-name filename))
19:22:53
Bike
Could you paste an example with-foreign-class form? If it's very long, on a pastebin site, please.
19:26:57
Bike
(defmacro with-foreign-class ((class-name &rest params) instance &body body) `(let ((,instance nil)) (unwind-protect-foreign-class ,instance (setf ,instance (make-instance ,class-name ,@params))) ,@body))) might be what you want?
19:27:30
Bike
You're the one doing quotation there, like in ',(second spec), but you don't actually want to, so...
19:27:50
Bike
oh, and then you'd use it like (with-foreign-class (hosting-session :id (gensym ..) :in-progress t ...) ...)
19:29:01
Bike
Anyway, the point is that you don't need to bind the params to a variable, or quote them, or anything.
19:29:18
Bike
If it gets confusing, try writing out a macro form you'd like to have, and then manually write what the expansion ought to be.
19:29:29
Bike
In this case, I think it's intuitive that we'd want a simple make-instance form like that.
19:30:03
kenster
I assembled the args like that because I didn't know about the args in the macro definition
19:31:07
Bike
you could have (defmacro with-foreign-class (spec instance &body body) `(bla bla bla (make-instance ,(first spec) ,@(second specd))))
22:12:23
AeroNotix
can the setf place be a variable? E.g. (setf (foo bar) value) where foo and bar are symbols which have the values of what I want setf to operate on?
22:13:21
Shinmera
foo must either be the name of a setf-expander, or constitute the function name (setf foo)
22:14:43
Shinmera
If all your possible foo places are implemented via functions rather than setf expanders you can simply instead do (funcall `(setf ,foo) value bar)
22:36:41
pjb
AeroNotix: the trick is to understand the basic feature of lisp which is taught in the 2nd part of the 5 minute introduction to lisp.
22:37:00
Shinmera
pjb: He means that foo should denote the place to pass bar and the value to, not foo being another variable to set.
22:37:03
pjb
That is: ALL lisp expressions are lists whose FIRST element is the name of the operator!
22:39:48
pjb
And finally if it's bound to the name of an implementation specific accessor, then you would have to use eval, which will be difficult.
22:44:14
pjb
random-nick: there's no difference between the terms form, sexp, data, lisp object, expression, etc.
22:46:12
no-defun-allowed
and atoms, yes those too. the only real difference between code/data is how they are used.
22:47:13
pjb
no-defun-allowed: I would even argue against that: (let ((x #(1 2 3))) (identity x) (eval x)) the same lisp object is being used as data AND as code!
22:48:02
pjb
no-defun-allowed: see it more like the dual nature of physics: particule & probability wave function.
23:39:11
White_Flame
even more literally: (defmacro defun-with-source (name params &body body) `(progn (register-source-code ',name ',params ',body) (defun ,name ,params ,@body)))
0:39:45
pjb
White_Flame: https://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/ibcl/index.html
0:55:44
White_Flame
I know there were some very simple Lisps for the C64; with that thing having much more ram it could have been more viable
1:08:28
v0|d
White_Flame: designing a board w/ more ram is painful w/o 4-6lyrs. Not sure they have the tech back in then.
1:17:42
White_Flame
I don't know the details of boad design that affects it, but I'll take your word there
1:20:07
v0|d
White_Flame: sry, I wasn't tryng to be right. Her eyou go https://www.youtube.com/watch?v=0YdLZAQSOa4
1:24:33
no-defun-allowed
just get this running in cc65 and you'll have half a lisp https://raw.githubusercontent.com/8l/openvmtil/master/lib/sl3.c
1:26:15
no-defun-allowed
i imagine you could pretend the c64 was a stack machine since there's few registers
1:28:36
White_Flame
I made my own 16-bit environment for the purpose: https://acheronvm.github.io/acheronvm/
6:36:02
asarch
One stupid question: Is SB-EXT:SAVE-LISP-AND-DIE the same with Smalltalk about the images?
6:37:04
beach
I don't know about Smalltalk images, but it saves the entire image into a "core" file that can then be used as an argument to start up SBCL later.
6:38:40
beach
People complain that it creates a big file, but that is a problem only if you are planning to create thousands of small applications, or if you have an embedded system with very little memory.
6:39:17
beach
Oh, and there is an option to create an executable file too, so no core file required in that case.
6:39:36
asarch
I studied the log from the other day (when I did a mess with packages) and I found what went wrong
6:39:40
zigpaw
they are close enough, there are some limitations you'll see more limiting in SBCL than in Squeak/Pharo, the "one active thread only" will prevent you from having gui app dumped to image, in smalltalk you get that taken care of itself.
6:40:46
asarch
Since I was desperate to make my example to work, I couldn't read that :clim cannot be used it directly
6:42:43
zigpaw
on the other hand, when learning sometimes it is good to do the not recommended, just to learn why it is so ;)
6:43:51
asarch
I found a working example at: /home/asarch/quicklisp/dists/quicklisp/software/mcclim-20180711-git/README.md
6:54:50
beach
But, in addition, it is recommended that you do not :USE packages other than a small number (I only ever :USE the COMMON-LISP package) that you trust not to change.
6:58:24
beach
Pretty much all I do from the REPL is to have ASDF compile a package, start an application, or run some tests.
6:58:31
zigpaw
when learning and writting throw-away code in repl, I think it is free-for-all if you know the rules/good-practices you are breaking ;-)
7:00:55
beach
And, yes, of course, you can't wait until you know all the rules before you start writing code.
7:08:29
aeth
I only :USE CL and my own libraries. If I broke something in the latter, I know it's my fault.