libera/#lisp - IRC Chatlog
Search
23:32:51
kagevf
pjb: "you can define your own namespaces" - did you literally mean "namespace" or were you using it as a synonym for "package"?
23:38:07
moon-child
kagevf: ^ above defines a new namespace for 'blubblers' (whatever those may happen to be)
23:40:21
pillton
moon-child: No. The operations FIND-BUBBLER and ENSURE-BUBBLER define a new namespace.
23:45:00
kagevf
so if I define a dynamic variable, and further define find-<variable name> and ensure-<variable name> I have a namespace??
23:58:55
pjb
kagevf: it doesn't have to be a hash-table. It can be any kind of mapping between a name and an object.
0:02:14
pillton
kagevf: ENSURE-BUBBLER installs a binding between a NAME and an OBJECT. FIND-BUBBLER retrieves the object for a given NAME.
0:05:52
kagevf
pillton: "installs a binding" - would that abstract the interaction with the hash table (or whichever key-value store we use)?
0:08:57
pillton
kagevf: That is right. A namespace is simply a set of name->object pairs. How the set is stored and mutated is irrelevant.
0:21:38
kagevf
I never thought (but by now I should've known) that you could create your own namespaces in CL
0:23:53
kagevf
I don't know scheme much at all, but could something like this be used in scheme to support multiple namespaces? or does it have some fundamental flaw preventing this from working? ... just curious ...
0:25:01
pjb
kagevf: then you can define a macro such as (color-let ((green (0.1 1.0 0.2))) (fill-rect (mix blue green)))
0:27:49
pjb
kagevf: but scheme likes to have a single namespace. So you'd have; (let ((f (lambda (c) (fill-rect (mix blue c)))) (green (color 0.1 1.0 0.2))) (f green))
0:55:40
mdhughes
And in my actual graphics library, I use a combination of symbols, which are keys in an application-specific palette hashtable, ints (decomposed as ARGB), and 4-vectors. SDL takes them as 4 args, so it has to be decomposed sometime.
0:56:53
mdhughes
And if I had a more modern color API, I'd need another way to represent HSL for HDR displays.
1:04:53
White_Flame
if your color names were symbols, then a plist entry on the symbol would be faster than a hashtable lookup
1:07:24
mdhughes
This is in Scheme, and in any case, probably not. A palette is just large enough to make hashtables faster than an alist or tree.
7:44:56
wasamasa
RRRRedEye[m]: this is #lisp, not #javascript, so your chances are abysmally low someone did that for fun