freenode/lisp - IRC Chatlog
Search
15:32:51
flip214
Xach: how about giving zpng an easy way to initialize a new image to white/black/transparent, directly via the MAKE-INSTANCE call?
15:33:17
flip214
"easy" as in "it's not required to calculate dimensions of an array, allocate and/or set it"
15:52:20
Josh_2
I have this sammich maker which I made for exercise 2.3 from PAIP https://plaster.tymoon.eu/view/1393#1393 I was wondering how I would make selection of specific types of fillings based on some rulesfor example if I have cheese then I don't want meat etc
16:17:46
gaze___
hey I think I'm misunderstanding something very basic about quoting. When something is quoted, does the reader go "inside" the quote and convert anything inside the quote into a reference to something, or is a quoted list just... a list of words and nothing else?
16:18:33
beach
gaze___: when the reader sees the ' character, it recursively calls itself to read what follows.
16:19:30
gaze___
if I have a (defun x (...) ...) ... (quote x), is there now a reference to x hanging around, or is it just the name "x" hanging around?
16:21:51
beach
gaze___: Read is going to create the symbol y in the current package, or return the existing symbols if it does exist.
16:22:03
Bike
(quote (x y)) will evaluate to a list of symbols. whether those symbols name functions is immaterial.
16:23:23
gaze___
okay I think we're getting closer to what I want to know... what exactly is a symbol then? does a symbol have to point to something or is a symbol just a name?
16:25:26
fivo
https://github.com/robert-strandh/Concrete-Syntax-Tree/blob/8d8c5abf8f1690cb2b765241d81c2eb86d60d77e/reconstruct.lisp
16:25:40
beach
gaze___: Common Lisp uses what I call "uniform reference semantics", which means that it is as if every object is represented by a reference, or a pointer.
16:27:11
fivo
Wouldn't it be somehow possible annotate R with the source locations before the macroexpand
16:28:52
beach
fivo: No, because the macroexpander takes a raw Common Lisp list, without any annotations.
16:28:59
fivo
I am not sure I make sense, but essentially annotate every subexpression of R with source location and then somehow do the macroexpansion
16:29:50
Bike
gaze___: whether it's quoted doesn't matter. (list 'x) '(x) (list (find-symbol "X" "WHATEVER-PACKAGE")) are all forms that return lists that refer to the symbol (so the GC would follow through)
16:35:08
beach
The main difficulty is that anyone can define a macro, so the body of the macro can't be turned into normal code, because then it would operate on raw Common Lisp expressions.
16:36:11
beach
So you would have to interpret or compile that code in a way that, when it operates on CONSes, like with CAR, CDR, CONS, it would instead have to emit the corresponding operation for the CST.
16:52:12
jgkamat
if any of you guys use the next browser, please update to the latest version, older versions had an RCE exploit
17:00:32
grewal_
A simple way would be to have, e.g., (meat-filling (cheese) (meat)). And then change your rules to choose one of them.
17:02:45
grewal_
Doing something like that quickly blows up the number of rules you have, so you might want to create a shortcut like (filling (2 *) (spread veg sauces herbs meat-filling)) where (2 *) means choose any 2,3,..., or all of the following items
17:09:48
_death
there's no need to constrain the specification to a "grammar".. you can just describe what you want in the most direct way and have an "engine" interpret it to provide the required outputs.. if performance becomes an issue you can then tweak the specification, add a compilation stage, etc.
17:10:35
_death
it reminds me of this post: https://groups.google.com/forum/message/raw?msg=comp.lang.lisp/-uoDKZeKBr4/qGgFy-M3mvoJ
20:34:26
rpg
It's a great idea, but I don't see any information about how to configure the Python process, and the docs are quite limited.
21:15:48
aeth
"trivial-left-pad — Ports the functionality of the very popular left-pad from npm. — MIT"
21:25:14
aeth
I mean, really, it goes full circle when someone ports that to Parenscript because it's more functional than the actual left-pad
21:26:26
aeth
no-defun-allowed: unfortunately, I can't just remove it from Quicklisp without warning once half of Quicklisp indirectly depends on it and instantly break everyone's code
21:28:33
aeth
It really does seem like a dead joke 3 years later. And in a few years, no one will get the joke.
21:32:51
aeth
It's a 3 years old April Fools project that got almost no attention on April Fools 3 years ago.
21:38:28
aeth
In 2017, I did a functional Brainfuck for April Fools, which I think is more useful than trivial-left-pad. I didn't do any jokes for 2018 or 2019 because I think the Internet has kind of killed April Fools Day in general. I didn't even go on the web at all last April 1st.
23:35:10
rpg
Does anyone know if there's a library that would do pattern-matching or unification specifically for hash-tables or property lists? I.e., structures with named components?
23:35:40
rpg
This does not seem like rocket science, but it seems like something someone might well have done before.
23:47:33
rpg
Bike: I imagine it could, yes. I'd like unification better than pattern matching, though, if I can get it.
23:48:26
rpg
cl-unification doesn't really do unification, because of its templates, so it's not a symmetrical operation like unification.
23:52:25
rpg
I'm really just looking for the ability to unify something that's like a hash-table, or a python dictionary...
23:53:17
rpg
that's a lot less demanding than trying to do unification for all of CL like CL-Unification.
23:58:45
White_Flame
yeah, it's not rocket science, but it is a bit more involved than matching positional lists/tuples, so it's a bit more rare
23:59:00
rpg
I think the trickiest bit is that one needs a path language for the results. E.g., if you unify a dictionary with no entry for :x with a dictionary that has an entry for :x which itself has an entry for :y, that is 'foo, then the resulting binding set must have a way of representing the path :x -> :y -> 'foo
0:00:55
White_Flame
the only difference with standard unification is that you need to do a set union+difference of the keys of the 2 hashtables
0:02:06
aeth
For those who want to follow along at home. https://en.wikipedia.org/wiki/Unification_(computer_science) https://gitlab.common-lisp.net/cl-unification/cl-unification
0:04:16
White_Flame
oh, and variable keys would need multiple results: unify {?:3 . ?} with {a:3 b:3 c:3}
0:07:13
aeth
I think the first thing this library would need to do is introduce the trivial HASH macro (or HASH-TABLE or whatever) that turns (hash :foo 42 :bar 43) into (let ((#:hash1234 (make-hash-table))) (psetf :foo 42 :bar 43) #:hash1234) because now we have a concise way to say (hash :a 3 :b 3 :c 3)
0:09:31
rpg
White_Flame: I don't need anything as ambitious as matching on values; just keys + values. It occurs to me that what I'm looking for is DAG unification (well, for DAGs with named edges).
0:10:05
rpg
aeth: One way to think about it is that unification solves equations over a particular kind of symbolic algebrar.
0:10:24
White_Flame
ok, then you just need a representation for an "entry". A cons cell probably suffices
0:11:06
White_Flame
are you always going to "unify" two hashtables where 1 is exactly 1 element shorter than the other?
0:11:40
rpg
White_Flame: The two tricky details are paths in the unifiers, and that the semantics is that if you don't have an entry for a key, then you match *any* entry for that key.
0:12:09
White_Flame
if there is a key whose value is another hashtable... then that entry is simply that key/value pair
0:16:27
rpg
So we extend your example to {x:?X} {p: foo x: { y: {z: bar}}} and we get a unifier that is ?X = {y: {z: bar}} and... I'm not sure what I do with p: foo.... In this case I guess it's the same as if there is an additional, implicit top-level variable -- ?TOP1 = {x: ?X}, ?TOP2 = {p: foo x: { y: {z: bar}}} and ?TOP1 = ?TOP2...
0:17:45
White_Flame
eliminating the keys adn converting them to positional slots, it'd be like trying to unify (?X) with (foo (bar))
0:17:47
rpg
White_Flame: Right; that's what's difficult about this case; the entries are extensible. That's why I was saying that the semantics are odd.
0:18:44
rpg
White_Flame: If this was prolog, I would make these things out of difference lists, like your {x: ?x . ?} -- these are data structures that are extensible.
0:19:16
White_Flame
prolog does have the equivalent of hashtables, with key/values and these sorts of operations
0:19:42
rpg
White_Flame: That's a neat idea, because I can treat these objects as always having a sort of &rest logical variable.
0:20:41
rpg
If I do that, then standardization (making variables unique) will solve my problem, because the logical variable for the "hole" will always end up with a unique name.
0:22:46
rpg
White_Flame: Your suggestion is really like difference lists; thanks for mentioning that -- it suggests a path to a solution.
0:23:22
White_Flame
I've thought about this a long time for our tools, and it actually ends up exacly the same a prolog's tools
0:23:28
rpg
The issue for me is that I want to have operations on something like a python dictionary, *but* I want to be able to backtrack over it, so doing the updates by something functional.
0:24:36
rpg
White_Flame: There were a lot of good ideas in prolog, but it never caught on.... I think for good reasons. But some of the ideas developed for programming it are quite clever...
0:25:02
White_Flame
my biggest problem with prolog is that there's too many imperative practicalities shoved into it, breaking its declarative nature
0:25:42
rpg
White_Flame: Yes, that's true. It's possible that what I need is simply a data structure with an undo-able assignment. More thought is required!
0:26:35
rpg
White_Flame, aeth -- thanks for discussing this with me. I have to go now -- there is a dog scraping at the door. Hope to chat with you again sometime soon. Good night!
0:29:16
rpg
I think homoiconicity requires something stronger -- something intuitively like "the syntax IS the abstract syntax tree."
0:30:36
White_Flame
or put differently, TCL's syntax is degenerate to a point underneath which homoiconicity is determinable :-P
3:27:24
oni-on-ion
anamorphic, something in here ? https://asdf-devel.common-lisp.narkive.com/MuXBBEpq/about-asdf-compile-file-failure-behaviour-and-its-value-on-sbcl