freenode/#lisp - IRC Chatlog
Search
9:37:21
dmiles
(defun fib (n) "Naive-recursive Fibonacci number function" (if (or (= n 0) (= n 1)) n (+ (fib (- n 1)) (fib (- n 2))))) ;; example
9:43:20
rtmpdavid
Sounds like something that would cause a lot of that late-night debugging, honestly.
9:44:32
beach
It would be contrary to the model of calculation that Common Lisp gives the programmer.
9:45:58
dmiles
in the case of if was to write : (defun fib (n) (setq foo 'bar) (if (or (= n 0) (= n 1)) n (+ (fib (- n 1)) (fib (- n 2))))) ;; memoization would defiantely be wrong
9:47:03
scymtym
i can imagine the #sbcl questions "why is fib(1) 10 times slower while fib(30) is 10 times faster compared to ccl?"
9:48:27
dmiles
rtmpdavid: *nod* right that is what i meant.. it might not be considered sneaky in the case of the non setq version
10:10:38
scymtym
beach: i was thinking the memo-cache would have been switched to a hash-table at 30 distinct calls, but you are probably right in that 10 times is way off. i guess it also depends on whether we are looking at a cold cache. i'll drop the topic now
12:00:48
Shinmera
ACTION pictures a dystopian future where the "Garbage Collector" is some kinda Terminator-like thing.
12:05:08
knobo
Would be nice if the gc could go back in time and remove the class before I was able to create instances of it.
12:49:48
Shinmera
In other news, I wrote another small webapp over the weekend. Allows you to schedule events and deals with TZ / date repeats and that kinda guff. Here's an example for my Treehouse Sunday event: https://events.tymoon.eu/1
12:53:00
easye
Hmm. Trying to chase down non-Quicklisp resources for Clath <https://github.com/BnMcGn/clath>, but seem to not be finding through the usual search engines a source repository for the 'ps-gadgets' system. Was this part of Garnet?
12:56:03
Xach
easye: one trick i've learned is that if i can't load github.com/user/foo due to missing bar, check for github.com/user/bar
12:57:07
Shinmera
Programmers hate him! Local hacker discovers how to find missing dependencies easily. How? Click here!
13:24:59
shka
but how can I know which one I can actually use, which one have reasonable UI support and so one?
14:14:57
Bike
symbols are a subset of atoms. numbers are not symbols, and there are other atoms that are not symbols.
14:16:26
beach
Some people would probably limit "S-expression" to have only Cons cells, symbols, and literals such as strings, numbers, and characters.
14:18:06
beach
But since just about everything is an atom, like a class, an array, a hash table, etc., those are technically S-expressions as well.
14:19:28
beach
SaganMan: There is some confusion about this terminology. Some people call the sequence of characters in source code S-expressions. I personally don't.
14:19:38
Bike
as beach said, it's not a term defined by the language itself. we just kind of inherited it in a vaguer way
14:20:36
Bike
common lisp text is more complicated than the SEXP := '(' SEXP* ')' | SYMBOL kind of picture
14:20:37
SaganMan
the other lisp like languages make it even more weird by using the same terms of cl to completely different meanings
14:22:53
beach
SaganMan: I advice you to use "expression" and "form" to mean the objects created as a result of READing some source code, and avoid using "expression" for a sequence of characters in a stream or a file.
14:24:10
beach
SaganMan: Though it is common to hear such things as "That's a LET form" by someone pointing to the source code. But that is an abbreviation for, "when that sequence of characters is processed by READ, an LET expression is created".
14:24:26
beach
jmercouris: That may have been what you were looking for, but using it is often a bad idea.
14:25:37
jmercouris
beach: This is for explicitly loading a set of symbols when using a foreign package, it's the only place in the codebase I do it
14:26:31
jmercouris
I thought about prefixing literally every function call, and I had a commit like that, but it was just too messy in the code
14:26:40
jmercouris
beach: This is actually part of some advice you gave me a long time ago about separating the GUI from the actual core of the program, which I've now done
14:26:46
beach
Why not just use :USE in your package definition then? Though that's usually a bad idea for the same reason.
14:27:39
jmercouris
when you load a specific file, aka a specific backend, only then should you load those symbols
14:29:15
jmercouris
hmm now you are making me second guess myself, maybe I should just include all of the items in the prefix..
14:29:17
beach
Then you can't refer to those symbols in your own package either. It sounds like a terrible way of organizing the software. But maybe I am just not understanding it.
14:29:17
jmercouris
I mean, include the package identifier as a prefix for all of the function calls
14:29:47
jmercouris
beach: I'll write a short document explaining it, give me a few minutes, I'm sure there's a better way to do what I'm doing
14:32:25
pjb
In either case, you need an indirection. If you can have only one backend loaded at a time, you can have each backend export the same package and the same symbol, and use that in your clients. If you want to be able to load multiple backends at the same time, they need to have different packages, and then you need a registration mechanism, with a backend object to be passed to or found by the client.
14:32:52
jmercouris
pjb: I don't need multiple at the same time, I only need one, and they should probably export the same symbols
14:33:39
beach
I am wondering whether two backends may define a different set of functions and types. If so, they should not all define a package with one and the same name.
14:33:40
jmercouris
I am trying to abstract the two backends as much as possible so that my core code doesn't have to change
14:33:49
beach
If they export the same symbols, then the package definition should exist before the code is loaded.
14:34:13
jmercouris
Okay, scratch that, I will not write the document because I think the understanding here is pretty clear
14:35:49
jmercouris
Alright, so, to make sure I understand, I will do something like (defpackage :backend (:export #:functiona #:functionb))
14:36:06
jmercouris
and then within any other packages I want to invoke that code, I'll do something like (backend:quit)
14:37:01
jmercouris
Okay, now what about the other situation, in which the backend code needs to call the other code
14:37:52
beach
Yes, a package is a unit of abstraction, so you export the symbols that are part of the interface of that abstraction.
14:37:52
pjb
That said, using the same package for all backends, while quite easy, is a severe case of Singleton pattern. It's probably to be avoided. Reifying the backend into a CLOS object let you specify attributes and provides a more definite interface.
14:37:56
jmercouris
Tangibly though, what are the benefits of packages other than avoiding namespace collisions?
14:38:49
pjb
jmercouris: the question is whether you can resolve the names at compilation time (read time actually), or if more indirection is needed or wanted.
14:38:51
beach
The functionality defined by the exported symbols of a package should form a unit that can be understood by itself.
14:39:38
jmercouris
pjb: I'm not sure I get it, if I took the backend and turned it into a CLOS object, is that not also a singleton?
14:41:16
beach
jmercouris: I am with pjb. I always think in terms of a possible LispOS, so that several backends are present in memory simultaneously. Then each one is represented by some object, and the processing function become generic functions that dispatch on that object. Each file would then contain methods on those generic function with one particular backend being specialized on.
14:42:09
jmercouris
Alright, I finally understand what you mean, there would be a superclass called "interface" or something, and all backends would inherit from it
14:42:15
beach
jmercouris: For example, the Cleavir compiler framework takes a "system" or "client" parameter that my code specializes on, but that can also be overridden by client code.
14:42:47
beach
jmercouris: Yes, and the functions in each file should become methods that specialize on the subclasses.
14:44:22
beach
jmercouris: This organization also allow more factoring. Code that is the same in two or more backends, can be factored to specialize on a common superclass.
14:45:05
jmercouris
Having said that, I don't think that these foreign systems could be run simultaneously
14:46:06
beach
Also, someone who wants to define a backend that is only marginally different from an existing one only has to redefine the methods that differ.
14:46:40
pjb
jmercouris: once you have a CLOS object, you can have multiple instances at the same time. For example, you can have a X11-backend (on my-screen.jmercouris.com:3.0) and two TTY-backend instances (on /dev/ttyp1 and /dev/ttyp4).
14:46:40
jmercouris
beach: Unfortunately there will be basically no code reuse beteween different backends as they are graphical libraries
14:48:03
beach
jmercouris: More generally, you should think about the ways in which CLOS allows you to improve the structure of your code.
14:48:59
jmercouris
I was thinking about interfaces before as well, (which is why we had that conversation about McClim), but I think CLOS is a cleaner way of doing this
15:27:40
rpg
Is there anything I could/should be doing to reset SLIME over time, so it doesn't misplace it's warning tool tips? These seem to start wandering around my buffers, away from their original target, over time.
15:28:38
rpg
phoe_: Sorry: I have completely forgotten what that was about. I've been traveling and off IRC for weeks now.
15:41:40
Shinmera
I'd like to write another paper for ELS, but I don't know if I'll have time this time.
15:43:16
jmercouris
Yeah, stuff like QT conference was 1500 for admission only, that's why I'm asking
15:43:57
Shinmera
Last year cost more due to the co-location, despite the co-location making everything worse than other years.
15:44:54
Shinmera
Should probably work on some of these too, sigh. https://github.com/european-lisp-symposium/els-web/issues
15:45:51
beach
Josh_2: It was decided from the beginning to try to keep it inexpensive. And students are subsidized by the regulars.
15:53:53
beach
Yes, and the attendance confirms it. Lately, there has been close to 100 participants.
15:59:41
larsen
I'd like to consider attending ELS 2018, but I'm not sure I would fit. Is it a grassroot conference in spirit (like YAPCs, if you know them) or more formal/academic ?
16:00:36
Xach
larsen: I found it to be a bit academic the last time I went, but it didn't matter much due to the value of the discussion and face-time with people I would otherwise never see
16:01:17
Shinmera
larsen: There's both kinds of papers being presented. Academic things and demonstrations.
16:01:38
Shinmera
The actual talks can be hit and miss, like with any conference, but getting time to talk to the other people in the breaks is usually what it's all about.
16:03:25
larsen
thank you. I'm not against the academic slant, of course, just afraid that *everything* is above my head. good thing you mentioned the "hallway track" (which is a thing I appreciate a lot in YAPCs)
16:04:18
beach
larsen: Xach and Shinmera are right. It is more about meeting the people and talking to them. You can be selective with the talks.
17:42:27
SaganMan
I can't use endp, I'm doing this lisp assignments of some uni which told what to use.
17:44:29
SaganMan
they said that you can only use fanctions, macros in first four chapters of winston and horn book
17:46:56
vsync
maybe the /topic should have dates and cities of upcoming conferences, along with implementation versions
17:50:07
vsync
ACTION does not say there should be one, lest he get volunteered..... but, there could be one and it would be nice
17:50:33
Xach
SaganMan: well, winston & horn 3rd edition is on ebay for various prices. sometimes it comes up for under US$20.
17:54:43
jasom
Rummage sales in university towns are good too... retiring professors selling off old books.
18:45:25
rpg
It's, of course, a big thing out here (MN), too. Someday I'll be old enough to be in Grumpy Old Men, the remake
19:05:16
emaczen`
even if I use a loop instead of read-sequence it doesn't get to the next form after the loop
19:07:00
emaczen`
After X bytes are read from the stream, then X bytes are written to the stream from the server
19:14:21
emaczen`
on my CCL server, I just loop over the number of bytes I have and do (format connection "~A" (ccl:paref ...))
19:16:05
Josh_2
Anyone seen this https://assets.toggl.com/images/toggl-how-to-save-the-princess-in-8-programming-languages.jpg my friend showed me today
19:27:36
mfiano
emaczen`: fast-io for buffered reads/writes. cl-conspack (which uses fast-io) for a superior serialization library
19:35:38
mfiano
anyway conspack allows storing circular sequences etc and a lot of cool features like indexing for reduced size
19:40:33
Shinmera
My only experience with conspack has been that I tried to make it work for Plump and couldn't for whatever reason. Just kept on blowing up in my face about the back references I had in the DOM.
19:43:15
rpg
Does anyone know about the status of the 'FOO-PACKAGE::(...bar...) syntax? It seems to work happily in all the lisps I have available, but not in Clozure CL. Is that an experience anyone else has had?
19:44:52
rpg
Bike: thanks. OK, I can probably make it go away for greater portability. I didn't realize it wasn't standard, because it works on SBCL and ACL, which I use most often.
19:49:21
Shinmera
I never quite understood the rationale for having the BYTE thingy instead of just having another argument more on ldb/dpb
19:55:34
mfiano
an octet is 8 bits. a byte is the smallest amount of addressable memory for an architecture, which is usually 8 bits.
19:57:43
emaczen`
Okay so the integer 4 is all 0 for the first 3 bytes and the last byte is 00000100 as bits
19:59:36
mfiano
the 1 means the second position from LSB, which is 0. 8 means 8 bits in size to the left from that point, which equals 00000010
20:03:33
emaczen`
(ldb (byte 8 2) 4) -- I'm taking the 2 to mean the third position, which is 0. 8 means 8 bits in size to the left which is 00000100 = 4
20:07:48
mfiano
Yes. a bytespec of 8,2 means, starting at the third position from the right, which is 1, read 8 more bits.
20:10:51
mfiano
emaczen`: LSB/MSB can mean either most/least significant _bit_ or _byte_. there is a notion of bit and byte endianess, so be careful how you word that next time.
20:15:12
SomeoneCool
Hi to all! Can anyone give my an advice, how to get better syntax highlighting while usesing emacs + slime? Looks like this two can not recognize and hightlight my fucntions :(
20:16:31
Shinmera
If you don't get any highlighting at all, make sure your buffer is in common-lisp-mode.
20:18:53
SomeoneCool
I have some highlighting but not enought for me :) It does not know that char= is a function, for example. But some keywords like defun is hightlighted
20:21:31
SomeoneCool
also slime does not highlight my functions after definition. When I use them it display like simple text
20:22:36
Shinmera
Only macros are highlighted, because those are important as they influence semantics.
21:00:30
mfiano
Well that's the standard way to load bytes. It can also be setf'd. Then there's depositing bytes with DPB, extracting, masking, etc.
21:01:35
mfiano
If you're noty writing octet aligned bytes to a stream, perfromance is going to be slow.