freenode/lisp - IRC Chatlog
Search
10:01:05
larsen
arduo: if you're looking for an italian Lisp channel, I'd like to resurrect #lisp-it (currently no traffic, but it is not completely desert)
13:36:51
specbot
Potential Numbers as Tokens: http://www.lispworks.com/reference/HyperSpec/Body/02_caa.htm
13:46:24
lieven
last time I looked at this stuff I was working out how to recover from (setf *read-base* 26)
13:51:55
beach
As I recall, Maclisp already had the dot. And (again as I recall) the default base on Maclisp was 8.
14:44:04
knobo
varjag: cl-jpeg has a todo item to "Add progressive JPEG support in decoder". But how about encoding it?
15:04:48
phoe_
(defmacro age (person &optional (default ''thirty-something)) `(get ,person 'age ,default))
15:05:30
phoe_
it would be more like, single-quoted, and the expansion would be `(get ,person 'age ',default)
15:08:39
phoe_
this is the page of GET - and this DEFMACRO smells of some ancient ways of defining accessors
15:11:25
jurov
phoe_: i found this http://www.lispworks.com/documentation/HyperSpec/Issues/iss055_w.htm
15:12:11
jurov
which says about :number lol "Benefits: Programmer expectations that any useful behavior can be portably relied upon in this pathological case should be soundly trounced."
15:13:13
ogamita
phoe_: double quotes in default values for macro arguments is not strange, because macro arguments are source code!
15:13:47
ogamita
phoe_: on the other hand, the fact that it seems unnatural to you is a hint it should be written as a function, not as a macro. ;-)
15:13:48
phoe_
One quote is for evaluating the source code, second quote is for evaluating the function argument.
15:14:49
ogamita
(defmacro age (person &optional (default ''thirty-something)) `(get ,person 'age ,default)) (macroexpand-1 ' (age p (setf last-default-used 42))) #| --> (get p 'age (setf last-default-used 42)) ; t |#
15:16:29
flip214
ogamita: with the macro as it is, DEFAULT will get evaluated always. just like with the function.
15:17:01
ogamita
Reify the person! (defun make-person () (cons 'person nil)) (defun age (p &optional (default 'thirty-something)) (get (cdr p) 'age default)) (defun (setf age) (new-age p &optional default) (declare (ignore default)) (setf (get (cdr p) 'age) new-age))
15:19:16
ogamita
flip214: with (setf getf) can change a nil into a list. (defun (setf …) …) cannot do that, you need a define-setf-expander.
15:20:05
ogamita
phoe_: : on the other hand, with get, we have already an object, since get works on symbols, so there's no point in using the macro, (defun (setf age) (new-age p &optional d) (declare (ignore d)) (setf (get p 'age) new-age)) works nicely.
15:21:46
ogamita
Since macros are allowed, they tend to use them for setf, since a single form would define the while accessor.
15:23:11
flip214
I'm not sure about the effects on code size (because of inlining vs. being to optimize things away)...
15:24:24
flip214
phoe_: I'm trying to form an opinion whether using such macros in examples like this is a good idea
15:52:57
phoe_
shka_: https://github.com/sbcl/sbcl/blob/7644df292389a51a653dff68cc82d1cc121fd9b6/src/code/time.lisp
16:18:38
shka_
i wanted to get around 1/10 lookup performance of built in hash-table of sbcl, i got it, i am happy
16:37:41
d4ryus
Hi, is there a way to check how many bytes i can read off a stream (iam using usocket socket-streams)? because read-sequence blocks if my buffer size is bigger than the amount of available bytes.
16:39:02
d4ryus
I guess i could loop with LISTEN and read off one byte each time, but that sounds horrible performance wise :D
16:50:04
ym
Trying to build last sbcl from git on OpenBSD I get "./src/runtime/sbcl[1]: ELF: not found" and "./src/runtime/sbcl[2]: syntax error: `(' unexpected" messages. Google says nothing. Am I doing something wrong?
17:12:45
clintm
shka_: is the code you're referring to re. hash-table available somewhere? Sounds like I could learn a lot from it.
17:23:36
phoe_
aside from some minor styling issues and the obvious fact that this page is a moloch, I'm relatively satisfied with how this page looks
17:33:47
adlai
shka_: theoretically '(simple-array cons (*)) could be unboxed, you could find out via upgraded-array-element-type
17:49:55
jasom
It doesn't appear to be possible to declare an unbound special with documentation, is that correct?
17:50:02
jasom
I suppose I can do it in two steps (defvar, followed by either setting the documentation or makunbound)
18:32:32
d4ryus
yay, there is (usocket:socket-option socket :receive-timeout), read-sequence will throw a error when the specified timeout is reached, perfekt
18:53:07
drmeister
I'd like to run a webserver in Clasp Common Lisp that responds to http requests as well as websocket connections - what do people recommend?
18:59:36
clintm
I would have opted for fukamachi's websocket-driver-* packages, but there's missing support for the async lib in FreeBSD. It would seem that they are linux specific, though I didn't dig deeper since I'd already used hunchensocket a while back.
19:08:10
myrkraverk
Does Lisp have any kind of coding style genealogy? I just learned that my preferred fortran comment syntax is for compatibility with fortran66.
19:11:23
myrkraverk
Has the usual coding style (as laid down be emacs) remained the same from the 50s/60s? Or has it changed?
19:15:41
Fare
myrkraverk, there are documents on the history of Lisp that explain how much the style has changed from the 1950s to the 1990s.
19:16:53
myrkraverk
I'm fluent in elisp and cl; by extension, maybe maclisp too (which is what elisp emulated, I've read).
19:20:27
jasom
drmeister: there is a websocket extension for clasp, let me check which servers it supports
19:21:59
jasom
drmeister: websocket-driver works with hunchentoot wookie and woo, so hunchentoot should be fine to go with for now. I plan on adding mongrel2 support at some point, but I think I'm the only one using mongrel2 with lisp at all.
19:25:54
jasom
while we're talking history, anybody know the motivation for moving from the small-talk like SEND for objects to CLOS? I've seen a lot of non-lispers mention in passing that GFs are less ergonomic than small-talk style OO, which appears to mostly be due to namespacing when I've pressed them on it. Since at one point lisp's OO was more small-talk like than it is now, I'm curious if there are any artifacts of
19:27:57
jasom
Fare: To clarify, I have lots of reasons for liking CLOS, and I think the tradeoff is worth it; I'm wondering if there was any debate at the time about adopting multimethods that we have records of.
19:29:04
Fare
there was a lot of debate. But PARC style OOP was more than just multimethods. It was the rich universe of what became CLOS and its MOP.
19:29:29
jasom
In practice you see GFs named like tree-pick-fruit rather than pick-fruit to prevent symbol-name collisions, which doesn't happen with send
19:30:39
Fare
jasom: I've seen also pick-fruit for GF name, relying on packages to prevent collision.
19:31:38
jasom
this would also be less problematic with package-local nicknames, so you could use packages with short prefix names if/when you get name collisions.
19:32:19
Fare
I also implemented an asdf-package-renaming extension. But it was still cumbersome to use.
19:33:58
jasom
the one-package-per-file style helps somewhat as you have fewer imports per package, but becomes much worse when you need to use fully qualified symbol names
19:36:50
jasom
Is there any good rule for what the scope is of uiop? It's clearly more than the bare-minimum needed for ASDF at this point, but it also doesn't want to become a full-fledged OS & implementation abstraction layer.\
20:14:49
drmeister
How does multiprocessing work in Common Lisp? How is altering a global variable like (incf *foo*) handled? Is there a lock placed around the symbol-value of *foo* during the read/inc/write?
20:16:24
sirkmatija_
I am trying to ql:quickload :tcod, but I am getting an error: (CFFI::FL-ERROR "Unable to load foreign library (~A).~% ~A" LIBTCOD "Error opening shared object \"libtcod.so\": libtcod.so: cannot open shared object file: No such file or directory."). I have libtcod.so in /usr/local/lib, which I have pushed (together with one more directory which includes required file) to cffi:*foreign-library-directories*. Any ideas?
20:22:52
phoe
Did anyone get any mail from ELS detailing whether their submission was accepted or declined?
20:57:16
White_Flame
drmeister: the only difference between posix threads and CL "processes" in practice is that bindings of special variables are thread-local. On a threaded system, access often first checks TLS to see if there's a binding, and if not then it hits the global symbol-value. Data structures like built-in hash tables often aren't automatically atomically accessed, though there tend to be some options for that in some implementations
20:58:18
White_Flame
so basically it's all just trample town with raw multiprocessing, and libraries should be used for cleaner message passing, pure functional data structures, or whatever
21:00:23
White_Flame
oh, threading also obviously affects memory allocation and GC. Many have a slab of memory to allocate from per-thread, bumping a pointer, and only grabbing a lock to get more when that slab is empty. The easiest to implement GCs stop all threads (hopefully at a safepoint), waits for threads to stop, and then does whatever GC stuff it needs to with full control
21:06:16
phoe
(defun foo (string) (let ((end (length string))) (declare (dynamic-extent end)) (loop for i below end do (print "x")) 3))
21:08:09
Bike
more likely sbcl just only knows how to dx results of certain calls, like make-array and such
21:14:56
TruePika
phoe: SBCL doesn't appear to know (via your snippet) that STRING is a STRING; just any type of SEQUENCE
21:22:11
TruePika
speed 3 safety 3 debug 3, with (the fixnum (length string)) I'm also getting the unable to stack alloc
21:28:51
TruePika
On x86-64, declared ftype is (FUNCTION (SEQUENCE) (VALUES (MOD #.(- most-positive-fixnum 2)) &OPTIONAL))
21:38:58
jasom
ACTION think it looks better with every-other letter case-inverted rather than every-other character
21:39:36
Fare
jasom: well, launch-program support was there in hiding, and epipping revealed it and made it useful to everyone --- also squashing many corner case bugs and fixing the windows port on many implementations.
21:40:42
Fare
so I wouldn't really call it a new feature, more like a cleanup and polishing of the existing feature. It can also let me say that so many half-assed run-program libraries can be declared superseded.
21:40:48
TruePika
SOCKET-RECEIVE takes some :ELEMENT-TYPE, and SOCKET-SEND takes some :EXTERNAL-FORMAT
21:41:28
jasom
TruePika: are you discovering that usocket isn't very useful if you need to do more than very simple things with sockets?
21:44:47
TruePika
okay, :EXTERNAL-FORMAT is for sending a STRING; I presume the buffer otherwise needs to have (UNSIGNED-BYTE 8) in it