freenode/lisp - IRC Chatlog
Search
23:53:42
asarch
I mean, it is much better than: (if predicate (lambda (...) ...) (lambda (...) ...)), right'
23:55:44
asarch
Besides (slot-value ...), (with-slots ...) and (with-accessors ...), is there any other way to access to a class' slots?
23:59:33
no-defun-allowed
It's rude and unCLOSy to access slots, but those are the only ways, yeah, and the latter two are probably defined in terms of SLOT-VALUE and some kind of MACROLET.
0:04:09
no-defun-allowed
It is possible that some class that has specialised methods doesn't actually read a slot. Maybe you have objects with colours, and you can have a colour blending mixin, then the COLOUR of that mixin-having object is computed and can't just be a slot.
0:35:05
dannyboy35
I am trying to get syntax highlighting working in emacs slime mode does anyone know how to do that?
0:39:56
no-defun-allowed
Seems people on duckduckgo suggest some variant of <https://stackoverflow.com/a/26050762> but I don't understand what is happening so I can't say for sure if it'd work.
1:24:20
dannyboy35
Does anyone here use slime? I need some help with it I’m I have no idea how to use it lol
1:41:29
pfdietz
About using slot-value instead of accessors: use of slot value enables one to bypass methods and method combinations on the accessor. This can sometimes be useful, although one can also define a "bare" accessor that doesn't have the extra methods.
1:44:14
pfdietz
One real use is for mostly read-only slots, where you don't want to provide a writer or accessor method, but might still want to update the slot. For example, if the slot caches a value computed from other slots. I wrote a method for slot-unbound that fills in the cache slot the first time it's read. and which saves the computed value by assigni
1:44:52
aeth
no-defun-allowed: huh? with-accessors takes the accessor function and doesn't have to do with the slot afaik. It's usually implemented as symbol-macrolet
1:46:02
aeth
pfdietz: another way to get "read-only" slots is to have ":accessor %foo :reader foo" and only
1:46:42
aeth
Someone who uses your-package::%foo anyway is probably someone who'd use slot-value anyway.
1:49:55
LdBeth
dannyboy35: read the manual, also the start up https://lisp-lang.org/learn/getting-started/
1:52:52
dannyboy35
Not really a fun a lot of it is for new programming so it goes into way too much detail on things I know already
2:08:45
seok
When (print ..) or (format *standard-output* ....) is placed in a function and such, why doesn't it print to my REPL?
2:15:04
Bike
https://github.com/fukamachi/websocket-driver/blob/master/examples/echo-server.lisp#L15 probably hereabouts
2:15:21
LdBeth
dannyboy35: if you already know programming, I guess the best way to learn a new language is go throw the language specification
2:48:00
pjb
seok: it's understandable that you may want to have access to the current server running. But you should probably do it from a function rather than a variable. Define functions such as (start-server) (stop-server) (current-server).
2:49:23
pjb
seok: in particular, what should happen if you do (progn (start-server) (start-server))? Should you not rather have a (current-serverS) returning a list?
4:49:41
mfiano
I just discovered that you can use a lambda form in the accessor-name position of WITH-ACCESSORS. Is this undefined behavior? (see Exceptional Situations)
4:59:19
pjb
mfiano: function name n. 1. (in an environment) A symbol or a list (setf symbol) that is the name of a function in that environment. 2. A symbol or a list (setf symbol).
4:59:44
pjb
mfiano: however, I have argued that lambda-forms were function names for those anonymous functions.
5:00:39
pjb
mfiano: there's however a problem with that: the lexical environment in which the expansion is produced, which may differ from one occurence to the other of the variable.
5:01:20
pjb
mfiano: try: (let ((x 1)) (with-accessors ((xx (lambda (foo) (declare (ignore foo)) x))) (list xx (let ((x 42)) xx))))
5:03:23
mfiano
This works, for example on SBCL: (with-accessors ((parent-transform (lambda (x) (fl:actor-component-by-type x 'fl.comp:transform)))) instance ...)
5:03:39
pjb
Sorry, try this: (let ((x 1)) (with-accessors ((xx (lambda (foo) (declare (ignore foo)) x))) (quote foo) (list xx (let ((x 42)) xx))))
5:04:38
pjb
Since it doesn't produce (1 1), you can see that you definitely should not, and it's bad that those implementations allow it.
5:12:14
mfiano
pjb: Curious how can you argue that lambda forms can by "function names" given that glossary definition?
5:13:21
pjb
( function-name args… ) === ( (lambda (parms…) …) args…) therefore function-name === (lambda (parms…) …) and args… === args…
6:49:25
afidegnum
ok, i m trying to build an interface which will have a drag and drop html builder, the html elements will be at the left side, droped into the web browser and render an html page
6:50:44
no-defun-allowed
though JSCL doesn't really have good FFI, especially when DOM objects are involved for some reason