freenode/#lisp - IRC Chatlog
Search
13:44:48
makomo
there was a bug report on GCC's issue tracker where one guy was mad when GCC started making use of that optimization
13:44:52
_death
I don't understand why people suggest switching to a different language.. sbcl is sufficient here.. and if you still want more performance, just write your assembly routines in lisp :)
13:45:32
xificurC
_death: it feels natural when one is trying to get language X's behavior in language Y
13:46:38
beach
_death: You are right of course. But it seems kuribas is pouting because Common Lisp is not unsafe by default like other languages are.
13:47:06
_death
beach: I think kuribas did just that the other day as well.. and the answers were also similar
13:47:08
xificurC
shrdlu68: why are people under the impression writing good asm by hand isn't possible anymore? Make a few web searches
13:50:05
beach
_death: Oh, this one is a pearl: "<kuribas> I am not expecting anything in common lisp to be new or surprising..."
13:51:16
beach
And this: "<kuribas> you give up a large part of safety when programming in a dynamic language", especially given that kuribas now wants arithmetic to be unsafe by default.
13:52:56
jackdaniel
I think he means a compilation-time safety wrt types of function arguments. It can't be ignored as non-existent and CL indeed doesn't provide this kind of safety
13:54:22
_death
I don't see how modular arithmetic is unsafe.. it's just something you need to implement because + and * on integers use ordinary kindergarten arithmetic
13:55:57
jackdaniel
shrdlu68: type declarations give you nothing (they may be conformingly ignored), but you may do check-type. that gives you a runtime safety (you will be dropped in a debugger whne program runs and values of incorrect type are passed to the function)
13:56:06
beach
_death: And that is what so many programs in languages that use modular arithmetic seem to do, because I don't typically see any test for that situation each time I see an addition.
13:57:34
jdz
In missiles in general I've heard -- their justification being that the missile hits the target sooner than values get close to overflow values.
13:58:14
_death
beach: right.. but here the desideratum was modular arithmetic given ordinary arithmetic, not the other way around
13:58:33
jackdaniel
I've read about a bug found on a racket (namely a memory leak which lead to OOM after some time). racket was after expensive process of QA and other verifications
13:58:54
shrdlu68
jackdaniel: But your implemention can give guarantees, right? I mean, if an implementation does not ignore type declarations.
13:59:01
jackdaniel
so they have figured out what is a maximum memory usage taking into account this memory leak while racket is running (say max 30m) and they've added enough memory to the hardware
14:00:55
jackdaniel
shrdlu68: sure, that is possible, just as it is possible to have C compiler with some undefined behavior explicitly defined. either way, my point is that it gives you runtime safety, not compilation time, so it is somewhat weaker
14:01:51
jackdaniel
I'm not saying that this kind of safety is crucial for good applications or that it improves overall quality
14:01:58
White_Flame
kuribas: if your input numbers are declared or inferred to be, say, between 0 and 1000, then the output can be inferred to be between 0 and 3000, keeping it a fixnum
14:02:06
jdz
OK, today I've learned that I've been relying on type checking behaviour that's very specific to SBCL. I guess I'll have to use SBCL exclusively from now on, because I like this behaviour.
14:03:05
jdz
Yeah, I've been keeping my code SBCL/CCL agnostic, but it is getting harder as time passes by.
14:03:57
jdz
But I definitely remember CCL giving me errors when SBCL hasn't. Don't have a record of particular instances, though.
14:05:24
jackdaniel
example are :type declarations for slots, CCL given high enough safety enforced it when you were using accessors. I think SBCL started doing that recently too
14:21:29
specbot
Splicing in Modified BNF Syntax: http://www.lispworks.com/reference/HyperSpec/Body/01_daba.htm
14:24:52
makomo
a question regarding CLOS style -- do people differentiate between using :default-initargs and :initform? the difference is subtle and i haven't seen :default-initargs used that often
14:25:25
beach
You typically use :default-initargs in a subclass to initialize slots in the superclass.
14:26:33
beach
That way, the subclass does not care how the initarg is used. It could be to initialize a slot, or it could be caught by initialize-instance.
14:27:13
makomo
i.e. i'm defining a slot within some class for the first time and i have to choose between :default-initargs and :initform
14:28:28
makomo
i've seen it discussed in the CLOS book even, but the difference was artificial and served mainly to communicate intent (but i don't know how well it does that)
14:29:31
beach
If the library is well written, it only documents initargs and accessors, not the existence or not of slots.
14:30:13
beach
So, you then use :default-initargs in your subclass, simply because it is your only option if you want to use only publicly documented features of the library.
14:31:11
makomo
aha, since you have no knowledge of the superclass' slots and cannot duplicate the definition just to change the :initform
14:32:29
beach
makomo: Your questions (and your reactions to my answers) make me think that you will make fast progress, so I don't mind answering them.
14:33:12
beach
makomo: By the way, I can't remember whether I told you, the last Common Lisp HyperSpec reference about keyword arguments makes me think that an error should be signaled for you case.
14:35:18
specbot
Keyword Arguments in Generic Functions and Methods: http://www.lispworks.com/reference/HyperSpec/Body/07_fe.htm
14:37:14
Bike
what was the setup again? (defgeneric foo (&rest r)) (defmethod foo (&key c) ...) (foo :d ...)?
14:38:04
specbot
Congruent Lambda-lists for all Methods of a Generic Function: http://www.lispworks.com/reference/HyperSpec/Body/07_fd.htm
14:38:25
makomo
and as we said, case 4 shouldn't apply in this case, since the GF doesn't have a &key in its lambda list
15:22:45
xificurC
(let ((x '(1 2 3))) (check-type x ?)) to check if x is a list of numbers with unknown length
15:25:42
pjb
xificurC: (defun list-of-number-p (x) (and (com.informatimago.common-lisp.cesarum.list:proper-list-p x) (every (function numberp) x)))
15:26:04
makomo
pjb: what does it do? i just tried to use it like (check-type (name spec) symbol), where NAME is a reader function, and i'm getting warnings since CHECK-TYPE is expanding into (setf (name spec) ...)
15:28:35
_death
makomo: yes.. check-type sets up restarts that may modify place to have a value of the proper type
15:29:13
sjl
sure, use (alexandria:proper-list-p list) instead of listp if you want to enforce proper lists
15:29:37
pjb
Sometimes you want to implement your own I/O loop validating the type of the inputs (notably if you have to do some parsing or conversions), but in simplier cases, check-type is a great operator!
15:58:15
Xach
I like cerror and try to use it when I can. I didn't really think about it for a long time.
16:22:08
jeosol
I want to thank you and all the other guys who responded and helped with query regarding the Optimization Challenge I was participating in. I recently received notice (recently) that my initial results where accepted and I should send additional info
16:22:30
jeosol
this was a late notice because it was sent last month, and due to some mailing issue, i could respond.
16:23:19
jeosol
I'll need to get some AWS machines to run rest of the cases. Currently research how to replicate an initial EC2 because manual install is a pain. Not a cloud expert.
16:25:06
beach
Congratulations! Though I don't think I was of any direct help. At least, I can't find any trace in the logs that I was.
16:32:19
jeosol
I was getting the system to work in a stable fashion then, working with many threads, etc.
16:32:52
jeosol
I did actually get a lot of help initially with the folks at comp.lang.lisp before I got here, but that site got very toxic so I stopped going there, but still read the questions occasionally
16:35:14
kuribas
So I found out I can get similar performance as in haskell by using (unsigned-byte 56) instead of fixnum.
16:42:04
jackdaniel
is there a reason for that? also – where did you find my address? unless it is a virtual bottle…
17:21:29
ultimate_beginne
Would it be fair to say that C FFI is a lisp DSL for writing low-level operations? Woke up pondering the question.
17:31:47
ultimate_beginne
I guess I'm thinking along the lines of (defmacro low-level (...) (...dsl similar to loop macro but with keywords for pointers, volatile, restrict, etc...))
17:35:15
White_Flame
FFI gives you data access to low-level memory, and the ability to call low-level code. It doesn't let you write low-level operations directly
17:35:54
White_Flame
however, the native code Lisp compilers are written in Lisp, and can be extended
19:28:50
knobo
jackdaniel: does ecl garbage collect functions that is defined with a gensym as name?
19:30:08
knobo
jackdaniel: like this: (defmacro def () (let ((n (gensym))) `(defun ,n () (format nil "t"))))
23:23:55
Ukari
for example, (defmacro excute (&body expr) `(progn ,@expr)) (excute (print "foo") (print "bar")) and (eval (list 'progn (list 'print "foo") (list 'print "bar")))
23:57:17
White_Flame
defmacro will give your expr to be compiled at compiled time, and run at runtime
23:58:04
White_Flame
plus, since macros return source code that art part of a compilation unit, they're better tied to their surroundings than a standalone eval