freenode/#lisp - IRC Chatlog
Search
8:12:22
asarch
One stupid question: is, the binary from SBCL, fast enough as any binary from any C/C++ compiler is?
8:38:56
aeth
asarch: You can expect a 3x to 5x slowdown at the worst case, probably for code that a C compiler would heavily optimize, e.g. vectorized code. You're also going to use a lot more RAM (at least 10x as much) and you have different performance tradeoffs with a garbage collector active.
8:40:23
aeth
(Obviously using more RAM won't be 10x as much if you e.g. load a 1 GB PNG file or something. It's not constantly 10x as much.)
9:03:30
dmitigr
Is it possible to specialize a generic (define a method) in the package other than where the generic is defined?
9:05:43
no-defun-allowed
say you're me writing magrathea and you have a method you're specializing on magrathea-acceptor for hunchentoot:acceptor-dispatch-request
9:06:02
no-defun-allowed
i'd write (defmethod hunchentoot:acceptor-dispatch-request ((acceptor magrathea-acceptor) request) ...)
9:07:43
dmitigr
I'm asking about the way to specialize it in the another one, for example, "cl-user".
9:08:48
schweers
dmitigr: the code no-defun-allowed just pasted can be executed from any package. that’s the point. He is defining a method (from, say, CL-USER) on a generic in hunchentoot.
9:09:11
no-defun-allowed
well, if you're in package A and you're trying to specialise package B's FOO, you'd defmethod B:FOO
9:11:05
no-defun-allowed
you are defining a method in a package other than where defgeneric happened
9:11:20
dmitigr
no-defun-allowed: so, the specializations will go to the package where the generic is defined?
9:11:34
schweers
dmitigr: (in-package "A") (defgeneric foo) ...) (in-package "B") (defmethod A::foo ...)
9:11:57
no-defun-allowed
(note A:FOO /= B:FOO, so you'd need to use-package B which i've heard is bad nowadays or write B:FOO)
9:13:27
dmitigr
schweers: (defmethod A::foo ...) says : "define a method foo of A in A" or "define a method foo of A in B" ?
9:14:34
schweers
I think you are confusing something. The symbol used to name a generic function or a method is what belongs to a package. Neither the GF, not the method do. They have nothing to do with packages.
9:15:14
schweers
so if you’d call the GF as A:foo, you can also define a method as (defmethod A:foo).
9:27:58
beach
dmitigr: It helps to understand what packages are about. They contain no definitions, no generic function, no methods, no classes. Only symbols.
9:29:02
beach
dmitigr: If you want to write a method on such a generic function using DEFMETHOD, you must use the correct name of the generic function, so you have to use the same symbol that was used in the DEFGENERIC form.
9:41:54
schweers
dmitigr: I think most of us had to unlearn some weird patterns from other languages.
9:46:13
schweers
Yeah, I don’t know of any other language that does this. I must say that I really like this approach.
11:14:59
Odin-
ACTION notes that this peculiarity is one of the things on full display in the Lisp 1.5 manual he got somewhere.
11:22:55
Odin-
It seems to me like Lisp's use of symbols stems from the way eval and apply were the basis of defining the language.
11:44:52
dtornabene
I'm getting weird compilation errors from ironclad, I see that my installed release is one dot version behind, whats the best way to update it?
11:46:43
jackdaniel
compilation errors from ironclad may be a result of (i.e) changing your implementation internals
11:47:11
jackdaniel
please try to update your sbcl and see, if the newest ironclad compiles fine with it
11:47:52
jackdaniel
I think that ironclad uses some sbcl internals which were recently chagned, so ironclad got broken, and newest release has been fixed to use these new internals
11:49:06
jackdaniel
error may also result from the fact, that bye default ironclad uses 64 bit seed for something (fortune (?)) and earlier it used 32 bit, so you may need to update your sources
11:52:01
jackdaniel
also you may download precompiled version which you could simply install in /usr/local/
11:52:25
Odin-
jackdaniel: From what I see in the "LISP 1.5 Programmer's Manual" the meta-language wasn't intended to have direct access to symbols. Constant values are also referred to as "atomic symbols" in that.
11:53:14
jackdaniel
oh, and I was just about to make my first pun today (poking at stable machines being better than unstable ones), but daniel left ;(
11:54:02
Odin-
jackdaniel: The need for QUOTE arose because when working with s-expressions to feed into the evaluator you needed to be able to have data objects for both the object being referred to and the name being used to refer to it...
11:54:22
jackdaniel
dtornabene: even if you are back, my joke wouldn't have much impact now when I've spoiled it
11:56:21
jackdaniel
and tries to figure out what's a big deal with clx refusing to work with pixmaps as clipping masks
11:56:24
Odin-
unstable is plenty stable for workstation use, and it usually has recent software. :D
12:13:26
schweers
concerning symbols in ruby: as far as I know, ruby only has (something likewhat) we would call keyword symbols.
12:25:00
schweers
So yes, the fact that Common Lisp has first class symbols means that hardly any language out there could have adopted a similar package system.
12:40:22
dtornabene
:jackdaniel thanks for the suggestion, I grabbed a binary, nuked the system sbcl and setup (some of) the links and lo and behold ironclad loaded
12:45:34
ogamita
Yes, there is a Symbol class in ruby, but there's nothing ressembling homoiconicity.
12:52:39
heisig
I am working on a portable type inference library for Common Lisp. Am I reinventing someone's wheel here?
13:03:20
heisig
Furthermore, I intend to simplify the type specifiers first. My simplification library is here: https://github.com/marcoheisig/simplified-types
13:05:22
heisig
Now I am working on a library that essentially allows one to write (restrict #'+ '(double-float double-float)) to obtain a funcallable instance with a lot of metadata (including return values).
13:08:45
heisig
These restricted functions also have an auto-generated function name, as well as an fdefinition and a compiler macro.
13:09:18
heisig
My goal is to use it for code generation, but it might also be useful for type checking.
13:10:04
dtornabene
i've been interested in doing something along those lines since discovering rosette
13:16:36
scymtym
heisig: in simplify-type-specifier.lisp, separating the syntatic simplifications form the approximating transformations could be useful
13:23:16
heisig
scymtym: That is probably a good idea. But I am not sure how to separate these issues. Maybe I should just return a second value indicating whether the simplification is precise or not.
13:32:46
dtornabene
its written in typed racket, which I suppose isn't necessary to play with a toy reimplemenation in common lisp
13:33:07
dtornabene
cymew its also not an especially google-friendly name, sorry, should've dropped a link
13:35:33
dtornabene
jdz: i have, haven't tried to use it yet for anything. I'm working on some sml/ocaml stuff at the moment, but when I'm done one of the things I want to dive into is constraint solving
13:36:37
jdz
Just playing around. I was pleasantly surprised when a combination-generating function using screamer was actually faster than my hand-rolled one.
13:37:46
jdz
I also wanted to see if I can solve this problem using Screamer: https://www.hillelwayne.com/post/minizinc/
15:37:55
ogamita
Odin-: you're wrong. The code written in M-expressions has direct access to symbols: cons[CONS,NIL] -> (CONS) atom[car[cons[CONS,NULL]]] -> 1
15:38:25
ogamita
Odin-: even more so than S-expressions in a way, since literals in M-expressions are written directly as S-expressions, without a need for QUOTE!
15:39:20
ogamita
Odin-: On the other hand, it's true that the symbol corresponding to cons in the M-expression atom[car[cons[CONS,NULL]]] cannot be accessed in any direct way.
15:40:24
ogamita
Odin-: you would need to call the M-expression parser, to obtain a S-expression sexp = (ATOM (CAR (CONS (QUOTE CONS) (QUOTE NULL)))) and then use car[cdr[cdr[sexp]]]
15:41:27
ogamita
usually, you don't use a symbol editor (cf. my sedit). you use a text editor such as emacs, and to obtain the S-expressions, we have to READ the text!
15:42:59
ogamita
So you can do the same for M-expression. Actually, while I implemented my M-expression as a parser, it could as well be implemented as lisp reader macros.
15:44:22
ogamita
or rather, you need quote here: (car (cadr (cadr '#M[atom[car[cons[FOO,BAR]]]]))) -> CONS
15:45:05
ogamita
So, it's more a question of having access to the reader (parser) than a fundamental restriction.
15:46:23
ogamita
The problem in C, scheme, etc, (but not in perl), is that their tools don't give access to their reader/parser.
15:47:18
ogamita
Odin-: well, they were rather well defined, given that all the examples in the LISP 1.5 user manual were written in it, as well as all the code in the papers about lisp until some advanced date (at least later than 1962 anyways).
15:49:09
ogamita
Note that you could by way of "pre-processors" give access to the source of programs of other programming languages. Imagine defining reader macros in C to read C sources! :-) (cf. elpp for example).
15:56:26
Odin-
ogamita: Well, yes. And I'm saying Lisp's use of symbols arose because the language ultimately developed around the internals of the evaluator, not entirely on top of it.
15:57:39
Odin-
M-expressions are defined to the extent required for a formalism. S-expressions were developed to the point of being a practical programming language.
16:09:09
ogamita
Odin-: but there was a purpose to all this: it was invented to write AI programs, and it was expected to be needing introspection and reflexion.
16:09:42
ogamita
So if JMC designed lisp around a reflexive eval, it's because he had this purpose for AI.
16:10:47
ogamita
And note that lists based on conses already existed: they were invented by NSS, and they had the FLPL fortran library to manipulate those lists.
16:11:03
Odin-
ogamita: It's a logical result of the design parameters, but one I don't think was directly intentional.
16:11:46
ogamita
"Linked lists were developed in 1955-1956 by Allen Newell, Cliff Shaw and Herbert A. Simon at RAND Corporation".
16:16:53
Odin-
The bit that I find most intriguing is the way the LISP 1.5 manual draws no distinction whatever between 'atom' and 'symbol'.
16:18:28
Odin-
That's conceptually still the case, but loses the name-versus-thing distinction that's the defining feature of symbols as used now.
16:31:49
p_l
Odin-: if you look at old source code, you'll see symbols used as primary data structure often
16:36:30
Odin-
p_l: Yeah, and I think that sort of thing is the reason a full and precise definition of the M-expression language never came to fruition.
17:27:00
pjb
Odin-: why do you say so? There's a 1-1 correspondance between M-expressions and S-expressions.
17:31:05
pjb
In some sentences they consider integers as symbols to (ie. the confusion between atom and symbol), but this was also stressed by the fact that numbers were not combined with arithmetic operators 42+33, but with lisp functions: (TIMES 42 33) and when you had it as data, it had nothing numeric, it is a symbolic expression, so TIMES, 42 and 33 are symbols like any other atom.
17:31:47
pjb
42 is not a number. It's the representation of a number. There are other representations of the same number: #b101010 for example.
17:48:20
Odin-
Given an M-expression and an equivalent S-expression, I find the S-expression easier to understand.
18:20:57
Bike
clos mop kind of question. reinitialize-instance isn't called on the generic function for every method definition, is it?
18:53:09
aeth
Odin-: The advantage to something like an m-expression isn't that it's easier to understand (although it could be easier to learn), it's that you could (well, with something similar, probably not exactly an m-expression) port existing code almost verbatim from another language.
18:57:30
Odin-
Except M-expressions were originally positioned as the main syntax, not a portability layer...
18:58:50
beach
Bike: REINITIALIZE-INSTANCE is called when you want to pass modified initialization arguments to it.
19:02:09
Odin-
On a completely unrelated note, though: Is there a go-to webserver aside from Hunchentoot?
19:09:13
sjl_
there's https://github.com/jasom/clack-tutorial/blob/src/pages/getting-started-with-clack.org -- no idea how up to date it is
19:10:14
sjl_
But, Clack is more like Python's WSGI or Clojure's Ring -- it's an abstraction over top of existing servers like Hunchentoot so you can swap them out, not really a server itself
19:13:25
Odin-
I noticed. That can be a benefit, but the documentation feels a little ... lacking. :/