freenode/#lisp - IRC Chatlog
Search
21:40:08
Shinmera
What I think is actually neat is: clx' automatically generated protocol functions based on the X spec.
21:43:24
Shinmera
Also neat: Baggers meticulously translated the GLSL spec into a machine-readable format, which is then used to generate functions in his compiler.
21:45:25
LdBeth
So maybe I can grub Intel 64 manual and auto generate instruction sets for assembler
22:00:54
LdBeth
Well it’s a little hard without an exact name. And search ARM’s ASL Specification Language gives me little results.
22:03:56
slyrus1
is there an easy way to get a type of a string -- without the length? e.g. (type-of "foo") gives me (simple-array character (3)). And I want (simple-array character *).
22:10:37
verisimilitude
If you need the particular list, (SIMPLE-ARRAY CHARACTER *), simply build it with these in, say, a backquoted expression.
22:12:09
slyrus1
I have some code that's building some cxml-stp data structures and I occasionally run into corner cases with rod/rune types, etc...
22:15:21
mfiano
(type-of "foo") gives 4 different results across 6 implementations. It's not guaranteed to give a portable result.
22:18:25
mfiano
Sure, but that's a bit out of context. However, Edi Weitz mentions in his book to not ever use it programmatically.
22:19:36
verisimilitude
Now, arrays have all of these specialized functions for dealing with them, but that's not a good reason to disregard TYPE-OF.
22:25:10
aeth
Well... a typed cons is still necessary, so you can tell just by type checking the car the type of every element in a list
22:25:44
aeth
I don't think you can do that with the existing cons, since a cons could hold anything
22:26:37
pierpa_
you can declare a variable to hold a (cons integer list) then it's your responsibility to ensure this is true
22:27:35
aeth
Or you could have a struct called kons where kar is of type foo (e.g. fixnum or integer) and kons is of type (or kons null)
22:28:30
aeth
Unfortunately, implementations are wildly inconsistent on struct type checking. Afaik, SBCL always checks, but one of CCL or ECL only checks in the constructor and one only checks in the setter.
22:31:26
pierpa_
the following is not working (deftype integer-list () '(cons integer integer-list)) /me wonders why...
22:31:57
aeth
pierpa_: That wouldn't be a good idea, though. That would be O(n) checking if it worked.
22:33:32
aeth
And if it's a struct, SBCL and possibly others will efficiently allocate the typed cons where it's possible, e.g. the double-float members will be unboxed.
22:36:39
verisimilitude
I never bothered to look, but I'd figured a CONS would usually be implemented identically, regardless of type, even in SBCL.
22:46:56
aeth
Of course, you would have to override the accessors and constructor on an implementation-specific basis to get the desired behavior, inserting check-type's and the's where needed
22:47:36
aeth
You'd also probably want to write a typed-list as well as some list related operations, such as do-typed-list
22:48:58
aeth
I'm probably going to use a variation of that in one of my programs because it turns O(n) type checking into O(1), and there isn't much more than type checking done to items of the list.
22:52:46
aeth
The accessors are wrong, too. Atm they're fixnum-cons-fixnum-car, but that's just a simple (:conc-name nil)
23:20:51
rpg
phoe: I think so. On my way out of the office right now. I'll try to remember to do that when I get home.
23:21:59
phoe
minion: memo for rpg: could you submit an issue with a proposal for making that function generic?
0:11:52
minion
rpg, memo from phoe: could you submit an issue with a proposal for making that function generic?
2:03:13
slyrus1
I'm still thinking about this closure-common rune thing and trying to figure out a good approach.
2:03:43
slyrus1
The problem is that the assumptions about rods/runes don't seem to be (always) true in current SBCL.
5:09:05
White_Flame
is there any name or notion for currying that can happen in any order? it always seems difficult to me to use currying, because it's not guaranteed which of the parameters I'd want to predefine
5:35:29
theemacsshibe[m]
ACTION sent a long message: theemacsshibe[m]_2018-04-13_05:35:29.txt <https://matrix.org/_matrix/media/v1/download/matrix.org/tbWgwDVOXjtwtfcslaGQxbDS>
5:42:01
White_Flame
I mean, given (lambda (a b c) ..), maybe you want to set b first, then c, then a, or whatever, as separate steps
5:42:23
White_Flame
but yeah, if you (lambda (b c a) (funcall thing a b c)), then you can curry the outer per ordering you want I guess
5:43:26
phoe
because then a programmer will know that the order in which you bind these variables matters
5:43:54
White_Flame
"setting" as in holding on to a partially applied function, except choosing which parameter to apply first
6:13:21
johnnymacs
So what confuses me about lambda calculus is that everything in the program is stored inside of a single function all of the time
6:14:01
johnnymacs
So if the current function is a list it can't really do anything else to be a list
6:14:18
johnnymacs
I need some combinators that will help me actually store multiple things at once and reference them