freenode/lisp - IRC Chatlog
Search
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
21:47:01
TruePika
If I open a stream via SOCKET-MAKE-STREAM, what issues can arise if I never CLOSE it?
21:47:44
jasom
I would guess that the underlying socket never goes away, but would have to look at the code
21:48:02
TruePika
"If auto-close is true, the underlying os socket is automatically closed after the stream and the socket have been garbage collected."
22:49:33
Bike
values types as they are are pretty bad, but at least they make sense conceptually. keys would not
22:53:10
fouric
...would anyone happen to know why my cl-launch script can't find lisp-stripper, even though i added its path to asdf:*central-registry* ?
22:57:03
fouric
TruePika: wait, did you mean the ASDF *system's* name or the name of the ASDF itself?
23:09:57
fouric
now i just get#<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {10001CEF83}> fell through ETYPECASE expression. Wanted one of ((OR NULL PATHNAME) STRING).
23:18:20
phoe
I'll most likely be showcasing the completed dictionary (in its beta state) and opening CLUS for contributions and reviews.
23:29:59
fiddlerwoaroof_
fouric: I really like using net.didierverna.clon for writing commandline utilities
23:30:38
Fare
I'm very happy using uiop, inferior-shell, cl-scripting, cl-launch, command-line-arguments for scripting.
23:36:23
Fare
and I don't know how/where you set it, but by default cl-launch won't read personal initialization files.
23:39:42
fouric
Fare: well, i managed to get the script to load lisp-stripper by putting it in ~/.local/share/common-lisp/source/
23:40:37
fouric
Fare: all i'm trying to do is execute the first example at http://cliki.net/cl-launch
1:17:33
akkad
ACTION hunts for any examples of emacs lisp calling out to sbcl repl to crunch data and return to display in emas
2:09:01
drmeister
Bike: I'm getting a lot of apparently spurious warnings on global variable accesses that I think happen on global variables that aren't bound when the forms that access them are compiled.
2:14:57
drmeister
Uh - it's not unbound variables I should be warning about but undefined variables.
2:18:20
drmeister
What is it checking? Is the reader signaling an error that the compiler is catching and reporting that the variable is missing?
2:18:53
drmeister
Whoops - this latest example is what SBCL does. I'm trying to figure out what Clasp should do.
2:22:02
drmeister
I'm getting a couple dozen warnings the first time I ran with the code enabled - maybe it's my code.
2:24:31
drmeister
But I've never had anything in place to check - so maybe it's catching problems that have been there for a while.
2:27:43
drmeister
The first three complaining about SIZEOF-UINTPTR_t are proper warnings and would signal an error if the code that accessed them were ever evaluated.
2:29:55
drmeister
make-load-form is not defined yet. We are bootstrapping out of the primordial ooze.
2:30:40
Bike
what's calling it then? and yep, looks legit https://github.com/drmeister/clasp/blob/testing/src/lisp/kernel/cmp/cmpobj.lsp#L41-L42
2:30:54
Bike
imagine, a compiler that warns when you when something won't work. incredible technology
2:34:09
drmeister
ACTION suffers C++ Stockholm syndrome. segfaults are C++'s way of saying "slow down" (paraphrased from Terry Pratchett RIP)
2:34:44
Bike
what are you talkin bout, c++ gives all /kinds/ of ten line template unification impossibility warnings for your convenience
2:43:36
drmeister
So to extend asdf/quicklisp systems to support Clasp, I'm (1) forking them (2) putting them in quicklisp/local-projects (3) hacking clasp support into them and (4) pushing them back to my fork.