Search
Monday, 27th of February 2017, 6:30:40 UTC
8:50:37
antoszka
There's nothing wrong with 'ciao' here ;)
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)
10:02:17
arduo
ok I'll add it to my autoconn list so we'll meet there
12:57:52
phoe_
this whole damn DEFSTRUCT PAGE is done for now
13:15:48
phoe_
I have only three dictionaries left for CLUS
13:34:58
beach
A symbol can have any name.
13:35:33
phoe_
Because I'm adding examples to SYMBOLP and KEYWORDP.
13:35:40
phoe_
Namely, for |12| and :|12|.
13:36:01
lieven
but :12 is unspecified by 2.3.1.1.3
13:36:08
lieven
so :|12| is ok but :12 is not
13:36:30
specbot
Couldn't find anything for 2.3.1.1.3.
13:36:51
specbot
Potential Numbers as Tokens: http://www.lispworks.com/reference/HyperSpec/Body/02_caa.htm
13:37:35
Xach
sbcl is not an oracle of correctness
13:37:43
beach
jurov: I think we want to know what the Common Lisp HyperSpec says.
13:37:56
Xach
ACTION is reminded of brucio's investigation of the semantics of RANDOM
13:38:20
beach
lieven: The idea is that it is a symbol, not a number or a potential number.
13:38:24
jurov
ok ok :) just foind it interesting
13:38:39
Xach
beach: but see clause 3 on that page...
13:38:59
lieven
source code is passing through read
13:40:30
beach
Right. See it now. Thanks.
13:41:53
lieven
CL syntax is a bit of a mess
13:41:55
beach
phoe_: Conclusion: :12 is unspecified.
13:42:11
lieven
see also 256 is a number whereas \256 is a symbol
13:45:02
beach
Yes, depends on the radix doesn't it.
13:45:09
ogamita
lieven: (setf *read-base* 2) (type-of '256) --> symbol
13:45:12
beach
... whether 256 is a number.
13:45:24
ogamita
perhaps you meant 256. ?
13:45:45
lieven
assuming default read-base. And I don't mean 8
13:46:01
ogamita
Don't assume, dot your decimal integers!
13:46:24
lieven
last time I looked at this stuff I was working out how to recover from (setf *read-base* 26)
13:46:59
ogamita
(|SETF| |*READ-BASE*| 10.)
13:47:58
lieven
(multiple-value-setq (*read-base*) (+ 1 1 1 1 ...))
13:50:23
Xach
I wonder if that's why 10. was invented
13:51:04
lieven
I would assume people didn't make that mistake so often
13:51:40
Xach
my real guess would be a leftover from the octal transition
13:51:55
beach
As I recall, Maclisp already had the dot. And (again as I recall) the default base on Maclisp was 8.
13:52:17
beach
So it was probably a convenient way to get decimals without changing the read base.
13:52:31
beach
In fact, I don't even know whether the read base could be modified in Maclisp.
14:00:45
specbot
http://www.lispworks.com/reference/HyperSpec/Body/v_gensym.htm
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:46
specbot
http://www.lispworks.com/reference/HyperSpec/Body/f_get.htm
15:04:48
phoe_
(defmacro age (person &optional (default ''thirty-something)) `(get ,person 'age ,default))
15:05:15
phoe_
the (default ''thirty-something) is the style I've seen
15:05:30
phoe_
it would be more like, single-quoted, and the expansion would be `(get ,person 'age ',default)
15:06:01
flip214
then it can't be evaluated...
15:06:39
phoe_
but the double quote as default argument is really weird
15:07:25
phoe_
I need to provide a different default as (age *mary* ''forty-something)
15:07:41
phoe_
and the double quote is simply unnatural to me
15:08:00
phoe_
...actually why is this not a function?
15:08:07
phoe_
if we want to evaluate both PERSON and DEFAULT
15:08:39
phoe_
this is the page of GET - and this DEFMACRO smells of some ancient ways of defining accessors
15:10:24
phoe_
...oh, we'd need to defsetf then.
15:10:38
flip214
phoe_: why would (age *mary* 'forty-something) be wrong?
15:11:04
phoe_
flip214: there's ''thirty-something in the argum--
15:11:11
phoe_
flip214: it would be pretty valid.
15:11:22
phoe_
but if we want to evaluate all the args, why can't we use an ordinary function?
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:12:51
flip214
phoe_: yeah, a function would be better here. it's just an example, I guess?!
15:13:00
phoe_
flip214: I want my examples to be sane.
15:13:13
ogamita
phoe_: double quotes in default values for macro arguments is not strange, because macro arguments are source code!
15:13:31
phoe_
ogamita: yes, I got it after some internal brainwork.
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
flip214
phoe_: then just change that to a function.
15:13:48
phoe_
One quote is for evaluating the source code, second quote is for evaluating the function argument.
15:14:03
phoe_
flip214: looks like SETF will break this way.
15:14:21
flip214
phoe_: as you said, a SETF expansion would then be needed.
15:14:27
phoe_
so I need a clever defsetf or a define-setf-expander.
15:14:39
flip214
but having that as the only reason for a macro instead of a function? awww.
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:15:23
phoe_
flip214: yes, this macro sucks
15:15:34
phoe_
ogamita: it's some beautiful lisp that I don't understand
15:15:39
phoe_
I mean, I understand what
15:16:29
flip214
ogamita: with the macro as it is, DEFAULT will get evaluated always. just like with the function.
15:16:36
flip214
or did you want to make a different point?
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:18:00
ogamita
Damned I confused get and getf.
15:18:08
ogamita
s/get/getf/g in what I wrote.
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:20:05
phoe_
but SETF GET seems to expand into something sane.
15:20:40
phoe_
ogamita: yes, that was my point - why the macro?
15:21:18
ogamita
To spare the double definition defun and defun setf…
15:21:38
phoe_
I'd rather be clear than clever.
15:21:44
phoe_
*Especially* in the examples.
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:23:48
phoe_
this is not a tutorial on optimization
15:23:57
phoe_
this is a tutorial on how to use GET
15:24:21
phoe_
I want non-GET to be simple and as legible as they can.
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:24:37
flip214
and so I'm trying to find the implications
15:24:55
flip214
when things like these are being used in a real system
15:50:37
specbot
http://www.lispworks.com/reference/HyperSpec/Body/f_boundp.htm
15:50:45
phoe_
I'll need some help killing the toplevel setq here.
15:51:22
shka_
how time macro is able to present info on consed bytes?
15:51:29
phoe_
shka_: implementation-dependent
15:51:58
shka_
you don't take into consideration that somebody may know here?
15:52:14
shka_
i'm trying to figure out what exactly is consing memory in my function
15:52:36
shka_
it is kinda funny because i need to run in loop to see consing
15:52:51
dlowe
shka_: sbcl has a nice profiler that shows consing breakdowns
15:52:57
phoe_
shka_: https://github.com/sbcl/sbcl/blob/7644df292389a51a653dff68cc82d1cc121fd9b6/src/code/time.lisp
15:53:14
shka_
so i figured my exact function
15:53:30
shka_
i have vector that has dynamic-extent
15:53:45
shka_
(why it is even called dynamic-extent btw)
15:53:55
shka_
and it is typed for lists
15:54:19
shka_
i'm not sure if it is consing lists or something else
15:54:33
shka_
my best guess are lists indeed
15:55:00
shka_
but i don't know implementation details so i really can't tell
15:55:23
shka_
profiling calls to list and list* does not help
16:01:24
phoe_
shka_: can you show us the code?
16:01:38
shka_
i mean sb-profile:profile
16:02:18
shka_
i can't paste code know, i will try to eliminate list* calls and see what happens
16:03:14
phoe_
uh wait, AFAIK list* always conses except for trivial cases
16:04:43
shka_
well, i was under impression that (vector list) will hold cons cells inlined
16:06:24
shka_
not any expert here, just trying my best to write efficient program
16:14:34
shka_
well, now it runs about 10 times faster
16:15:59
phoe_
it can't hold cons cells inlined because
16:16:27
phoe_
I guess if you want inline cells, just declare a (vector t) twice as long
16:17:09
shka_
i was using list* to store just two elements
16:17:33
phoe_
"just two elements" is one cons cell
16:17:36
shka_
so my fix was to just add extra element
16:17:57
shka_
anyway, now it is cons free and reasonable fast
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:20:05
shka_
at the very least i could do that
16:20:05
phoe_
ACTION pushes chapter Symbols to CLUS
16:20:34
shka_
i am glad that lisp allows you to optimize memory allocation to a some extent
16:20:54
shka_
sometimes it can make huge difference
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?
16:54:29
Fare
ym: ask on #sbcl and/or on sbcl-devel
16:54:43
Fare
did you try the last known working sbcl for openbsd?
16:57:58
specbot
http://www.lispworks.com/reference/HyperSpec/Body/f_provid.htm
16:58:17
phoe_
and I'm done with the sysconst chapter
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:13:54
shka_
i don't have repository for it, but i can upload it pastebin
17:16:39
shka_
please, don't mind poor overall quality
17:16:47
shka_
i'm still working on this code
17:16:56
shka_
some things are clearly broken
17:16:59
shka_
http://paste.lisp.org/display/340118
17:19:56
phoe_
ACTION pushes System Construction to CLUS
17:23:06
phoe_
http://phoe.tymoon.eu/clus/doku.php?id=cl:macros:defstruct
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:26:56
beach
shka_: Why do you write ugly code?
17:27:24
shka_
it is side product of experimenting
17:28:55
shka_
besides it is mostly fine most of the time
17:29:54
shka_
insert-into-hash is probably the most awful piece of code here
17:30:12
shka_
but i will refactor it, eventually
17:33:47
adlai
shka_: theoretically '(simple-array cons (*)) could be unboxed, you could find out via upgraded-array-element-type
17:34:02
adlai
that would definitely be a pleasant surprise :D
17:35:04
adlai
ACTION once got very mad that (upgraded-complex-part-type 'rational) -> real
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:06:58
specbot
http://www.lispworks.com/reference/HyperSpec/Body/m_defpar.htm
18:25:35
phoe_
http://clhs.lisp.se/Body/t_fn.htm
18:25:47
phoe_
"Consider the following two declarations of ftype: "
18:26:09
phoe_
(and arg0-type1 arg0-type2) should be (and arg0-type1 arg0-type2 ...) I think
18:27:12
Bike
no, there's only two ftypes, so neither of them should have ellipses.
18:28:07
phoe_
"If two (or more) type declarations are in effect for a variable..."
18:28:15
phoe_
A variable? Not a function?
18:28:26
|3b|
variable containing a function?
18:28:29
phoe_
when it's TYPE and not FTYPE.
Monday, 27th of February 2017, 18:30:40 UTC