libera/#commonlisp - IRC Chatlog
Search
20:30:56
Guest82
Hi, sorry for the incredibly late reply (I've had a crazy time in my life lately...) but: Josh_2 contrapunctus shka loke[m] etimmons and beach thank you so much for answering me! on the questions I asked on July 4th! :D Thanks for pointing out at the commercial uses of lisp for web apps and the help dealing with some issue. Cheers!
20:49:49
pl
Maybe worth job change I'll have the time to write some libs for a very commercial lisp use XD
20:59:32
phantomics
since you're back, Guest82: what were those commercial uses? Interested to see...
22:05:58
phoe
is there a portable way to get a type specifier that matches only something of type X and not its subtypes?
22:06:40
phoe
if BAR inherits from FOO, I'd like something that is (AND FOO (NOT BAR)), except obviously I cannot enumerate all subtypes in the NOT because new ones can be created at any time
22:32:21
pjb
the only case is when you can't insert a type between tyep type and NIL. eg (subtypep 'nil '(integer 42 42)) #| --> t ; t |#
22:46:24
moon-child
actually, since in common lisp types can be defined according to arbitrary predicates
22:46:35
Bike
yeah, common lisp types wouldn't work for curry howard so well. they define a naive set theory.
22:47:13
Bike
also, the standard literally defines types to be sets within the context of the language, just to make it clear
22:48:16
Bike
yeah, naive set theory. so things like "barbers that shave only those who do not shave themselves" are sets
22:51:45
Bike
(defun type-that-contains-itself-p (type-specifier) (typep type-specifier type-specifier)) (satisfies type-that-contains-itself-p)
22:52:32
Bike
and then marvel as a math thing from a hundred and twenty years ago leads to the practical consequence of needing to restart your lisp
22:54:47
Bike
e.g., (typep 'cons '(satisfies type-doesnt-contain-itself-p)) => T, (typep '(cons t) ...) => NIL, (typep '(satisfies type-doesnt-contain-itself-p) '(satisfies type-doesnt-contain-itself-p)) => hang
22:55:45
moon-child
Bike: yeah, lots of things are easy to express mathematically but not so much in code
22:55:50
Bike
i'm not talking about how to hang the type system, i'm talking about how types are sets.
22:56:50
Bike
satisfies is literally unrestricted comprehension. the lisp type system is set theory pre-russell.
22:58:06
Bike
an implementation accepting a function would be nonconforming, and i don't think any of them do
22:58:47
phoe
since type specifiers can already be unreadable, adding a function object in there won't break anything
23:00:46
_death
so the thing is, types are not first class objects.. you can only refer to them via type specifiers
23:00:58
Bike
more seriously i think any HFT of types would warrant some thought about what types are actually for. i thought about it once and came up with four uses pulling them in different directions, though i don't remember the fourth now
23:19:26
Bike
types are a predication DSL, used to describe constraints to the compiler for optimization, and used to describe storage classes for arrays and structures and stuff.
0:41:01
Guest82
ok, thanks... I'm trying now. I hope I will learn lisp but also be successful making an app haha
1:41:00
pjb
phoe: note that deftype is like defmacro. If you allow closures in satisfies, each time the type is expanded you get a different closure!
1:41:32
pjb
phoe: AFAICS, this is the reason why we're restricted to functions (that have to be defined in the compilation environment too, most of the time, so eval-when).
1:44:13
pjb
phoe: but granted, it makes it very difficult to define list-of (deftype list-of (element-type) `(satisfies ,(once-or-twice (eval `(defun ,(gensym) (object) (is-proper-list-of ,',element-type object)))))) etc…
1:44:39
pjb
in the current spec, you need to define a toplevel function for each type of list-of lists.
1:46:40
pjb
phoe: perhaps like this: (deftype list-of (element-type) (let ((predicate (lambda (object) (typep object element-type)))) `(satisfies ,(compile (gensym) predicate))))
1:47:00
pjb
I mean: (deftype list-of (element-type) (let ((predicate (lambda (object) (is-proper-list-of object element-type)))) `(satisfies ,(compile (gensym) predicate))))
1:48:22
pjb
Yes, that works, with eg. (defun is-proper-list-of (object element-type) (and (proper-list-p object) (every (lambda (element) (typep element element-type)) object)))
1:50:57
pjb
But as I said, this generates a new closure and a new toplevel function for each occurences of (list-of foo) (list-of foo) (list-of foo) -> 3 equal closures, 3 toplevel functions. So you want to manage a cache, which has the misfortune of having to live across the compilation-environment and the runtime environment. ie. you need to rebuild the cache at load-time or execute…
1:51:55
pjb
satisfies would have to do the same without necessarily knowing what keys to use for the cache, if it had to deal with closures itself. at least, when the user does it, he knows what he's doing…
5:34:27
hayley
I can't think of one, but nginx has worked fine for me. Is there anything specific you need from it?