freenode/#lisp - IRC Chatlog
Search
13:41:53
Shinmera
The only guess I have is if you didn't use in-readtable somewhere and rather setf the readtable. But if I remember correctly ASDF should take care of even that.
13:42:58
phoe
Also, (asdf:operate 'asdf:load-op :lparallel :force t) succeeds, and afterwards my system loads properly.
13:43:26
phoe
I am now tempted to open up a very clean Lisp environment, try loading Qtools, and then LPARALLEL.
13:51:11
mfiano
Xach_: I'm still waiting for him to get to this https://github.com/joaotavora/sly/issues/135
17:31:57
osune
Hoi, I want to dispatch by strings of the form "/cmd foo bar" where "cmd" can be any string. Currently I dispatch via cond and predicates returned by a cl-pprce match. Is there a better solution? E.g. In Python I would probably use a dict([('/cmd', cmd_handler_fn)]) to match and dispatch. The cond solution makes me uneasy because, if understood correctly, chls says it evaluates each test-form until one returns true. While the Python
17:31:57
osune
solution would be just a hash lookup. I'm sure I could do the same in CL with a hash table using equal as test. But I lack the experience to tell what the better style would be in CL or if I'm missing something entirely.
17:33:58
warweasle
osune: The has would work fine. You could extend the repl (meta-circular evaluator). Or you can use a stack to collect arguements and then evaluate when you have them all.
17:34:33
jmercouris
osune: Forget my first message, I understood what you were trying to do but express it improperly
17:34:59
jmercouris
What is wrong with me today, "Forget my first message, I understood what you were trying to do but expressed it improperly"
17:36:08
osune
jmercouris: I think you are assuming a more complicated problem. Think more of an IRC bot. Sorry, english isn't my native language either; so you meant I worded it improperly ?
17:37:21
tfb
osune: if you have a finite number of commands you know at compile-time (and if you don't want to do some incremental-reading thing) then interning them & CASE / ECASE might be enough
17:39:43
osune
tfb: It's finite. But I currently I don't know how many. So I would prefer a solution where I can in a central "place" easily add/remove dispatchers I guess. I'll take a look at the CASE variant.
17:39:52
warweasle
tfb: There's an old article which compares lists with hash tables. Lists are faster for around 8-12 entries, after which hashes are faster for lookups.
17:41:13
tfb
warweasle: Somewhere I have some code which does this benchmark for the implementation at compile time and then changes representation dynamically...
17:41:39
rpg
warweasle: I have heard rumors of implementations natively doing the optimization that tfb refers to.
17:43:02
tfb
warweasle: well, I think the main cool thing is that in Lisp you *can* do tricks like this, because you always have the language to play with
17:43:52
jmercouris
osune: I think you worded it just fine, english is one of my first languages, that's not why I'm having these issues :D
17:46:06
rpg
osune: many lisp implementations offer extensions to the standard for hash-tables that contain strings only.
17:48:29
osune
rpg: is this an "out-of-the-box" thing, if I use (declare ...) forms? Or something I have a look at the sbcl manual?
17:49:43
rpg
Bike: My impression is that EQUAL hash tables can be inefficient, because you can't exploit features of the data items in the hash function (or if you do, you end up needing some type checking at run time)
17:50:16
rpg
But yes, EQUAL is what you want for portable code -- but note that this is case-sensitive matching. If you want to match FoO and foo, you need EQUALP
17:50:26
Shinmera
Surely dispatching a command from a user facing side does not need to be terribly efficient in any case
17:51:12
Bike
though i'm not sure how much more efficient a more specific string= test would be anyway.
17:52:26
tfb
rpg: well, really, the test is how fast you can search compared to how fast your users can type
17:52:27
Shinmera
Now here's a question about data structures that actually requires performance: if you have a set of strings and would like to do fast fuzzy matching (find all strings for which a given string is a substring), what kind of data structure would be optimal for this?
17:53:23
rpg
Shinmera: I think it depends a lot on the nature of the strings. This problem arises in DNA/RNA sequencing, and I think there's an extensive literature on that. But those are long strings.
17:54:55
warweasle
Shinmera: If there is a "strcmp" function which returns (-1, 0, 1) then you could create your own tree from sexps.
17:56:40
Shinmera
warweasle: I don't know, I'm just asking. Given a set of strings, what data structure would be optimal to retrieve the subset that contains a certain other string.
17:57:47
Shinmera
osune: If your command list is an alist, you would do (funcall (cdr (assoc command command-list :test #'string-equal)) ..)
18:00:21
Shinmera
So you would compute a suffix-trie for each entry in the set and then just scan through them all?
18:01:17
Shinmera
I'm not sure if that would actually make it fast at all though, as the strings each are relatively short.
18:02:03
m00natic
@Shinmera, you'd use a single suffix tree (also look at the radix tree variant) and put all prespecified words in it - then use a single search
18:08:39
sjl
Shinmera: https://github.com/jhawthorn/fzy/blob/master/ALGORITHM.md might also be interesting
18:08:58
sjl
though it sounds like in your case you can do some precomputation on the data to be searched
18:09:27
Shinmera
Right. The set of symbols should not change frequently, and typically only ever grows.
18:15:18
Shinmera
While I'm asking off-topic datastructure questions: any suggestions for edit-distance algorithms for natural language? Levenshtein distance is awful for that, since by its metrics "pear" is closer to "apple" than "apple trees" even though you'd highly likely want the latter to score better.
18:15:25
sjl
some of these fuzzy finders cache results too though, so they may still have helpful things for you
18:16:53
Shinmera
Well, edit distance would be the wrong term for what I want, I suppose. More like similarity scoring.
18:21:34
pjb
Shinmera: sounds like the vector representation of words used in machine learning algorithms would be what you want.
18:22:34
rpg
Shinmera: I think there *are* such algorithms, but it's a tricky problem because, for example, you want to know about pronunciation (so that "too", "to" and "two" are similar). Maybe google for something in the information retrieval literature....
18:23:18
rpg
If you were going to do a vector representation, you might as well go ahead and train a NN.... But you would need a source of training data for closeness....
18:23:57
Shinmera
Context is commands in a bot with a list of "did you mean" suggestions when you type an unknown command.
18:29:23
Shinmera
Users are likely to: typo, use a synonym, or forget other parts of the full command (substring)
18:30:52
jmercouris
if you are interested, I can explain more, it will require your own implementation though, there does not exist a library for this
18:33:11
pjb
Nice NLP user interfaces should be able to ask questions back to the user to clarify requests where some ambiguity exist.
18:34:34
jmercouris
pjb: Another cool thing is using the context of the words around it for guessing, not just what they typed
18:35:06
pjb
Indeed, you can use the history of the user interactions (including a user model) to clarify things.
18:35:56
beach
pjb: I think that's right, and such a model would include the kind of keyboard layout is used.
18:37:24
jmercouris
it doesn't have to be a very complex or expensive model though, there are very lightweight ones you can embed into a user distributed application
18:37:27
beach
pjb: And a model of me would include the fact that I always invert the h and e in the. In fact, I have a global emacs abbrev to change "teh" to "the"
18:39:22
beach
It is not as though I do t <lesses, is that right, yes it is> e <now this then, maybe> h <ah, not right, lets do a C-t>
18:41:34
beach
It is more like "here is teh phrase I want to type <oh, dear, I inverted the e and the h a few words ago>
18:42:10
beach
So auto-correcting from teh to the saves a lot of time, and a lot of burden on the reader.
18:50:02
beach
1. inverting e and h. 2. Forgetting final period. 3. Using an article in the first place.
18:54:11
beach
Shinmera: My keyboard is acting up. The shift key seems broken. Time to change the keyboard. I have had it for more than a decade.
18:55:20
Shinmera
Okey, I meant to say that capitalising the first letter was another mistake in jackdaniel's sentence that you didn't list.
19:00:13
rme
The thought of a $5.86 monthly royalty is a great incentive for me to get to work on my own book.
19:04:11
warweasle
"Learn a programming language in 30 days to write a book in 180 days!" - my new book.
19:04:19
beach
rme: And it is 10 times better than the book in French that I wrote with my favorite coauthor that give around 2€ per year.
19:08:51
rme
Anyway, my proposed title is "Creative Common Lisp" or "Creative Computing in Common Lisp". If anyone writes it before me. let me know so that I can buy it.
19:14:22
beach
Now that I think about it, "Learn to program in Common Lisp in at least 10000 hours." is a great title.
19:30:37
dmiles
what i am trying to figurte out is if my macro's lambda list has &environment e in it and if the e is passed to macroexpand will that cause the same result if i had not passed it e
19:32:46
beach
dmiles: If your macroexpander needs to call another macro expander for a macro defined in its lexical environment, you might get the wrong answer if you don't use the right environment.
19:35:43
pjb
dmiles: a simple example: (define-symbol-macro s 42) (defmacro m (x &environment e) `(list ,(macroexpand-1 x e))) (symbol-macrolet ((s 33)) (m s)) --> (33)
19:35:53
dmiles
ok so the '&environment e' that my macro uses is the enviroment beelonging to whom.. the environemnt of my caller or the enviroment i would manipulate from labels?
19:36:13
beach
pjb: I find you much more helpful lately, and much less aggressive. Or maybe it's just my own aging that plays tricks on me. :)
19:36:16
pjb
or: (define-symbol-macro s 42) (defmacro m (x &environment e) `(list ,(macroexpand-1 x e) ,(macroexpand-1 x))) (symbol-macrolet ((s 33)) (m s)) --> (33 42)
19:37:42
pjb
We'll see. I need to find a new customer, I don't know if I'll be free then. I guess for 2 days I could do it.
19:38:33
jmercouris
beach: My impression of pjb has been that he's always been helpful, excpet that one time on #ecl where exploded on me telling me to RTFM :D
19:38:36
pjb
Of course, macroexpand-1 also expands normal macros (and macrolet), and other functions take an environment argument.
19:40:35
pjb
dmiles: there's an interesting application of envionment with CLOS: notice that find-class 1- is an accessor and 2- takes an environment. This let you define local classes!
19:41:12
jmercouris
beach: Yeah, hopefully I can make it to ELS and put some faces to names, would be nice
19:41:39
Bike
it allows for the possibility of local classes, except you can't give an environment to setf find-class.
19:43:46
dmiles
i been deciding to have a first class environemnt object be passed arround so that such uses can be used on an environments with indefinate extents
19:45:24
pjb
dmiles: even if it's not allowed to refer at macroexpand time to lexical variable in a local macro; local macros can still refer to surrounding local macros.
19:46:04
pjb
shka: if you leak the dynamic environment outside of the blocks where the local macros are defined, and use it, you could expand using local macros that are not active anymore.
19:46:35
shka
Shinmera: btw, i hooked docstring formatter into documentation-utils, i have few issues to sort out though
19:46:37
pjb
Also, you have to consider that local macros are defined and expanded at compilation time, while the dynamic environment is returned at run-time.
19:46:48
dmiles
pjb: heh, i think my impl of continuations is what inspired a willingness to do this with envs
19:48:05
pjb
dmiles: or to make it useful, you could expand the environments to include more. And letting an environment escape would be equivalent to returning a closure.
19:48:56
dmiles
actually yes.. the problem is as pjb points out is do i see function macros i *should* be seeing due to runtime extent or do i see what is overridden
19:50:39
pjb
for example, find-class modifies the environment at run-time. while defmacro provides a compilation-time environment, and assumedly macroexpand is used at compilation time too (but not necessarily). So you have the problem of transporting environment (and their enclosed bindings) from compilation time to run-time (possibly thru a FASL, so now you have to be able to write environment and load them!).
19:50:55
dmiles
oh yeah and about what pjb is saying.. this is kinda been a big issue.. i currently have to pass two envs to around
19:52:27
dmiles
i been trying to come up with a way to merge them somehow.. its not a big deal for my compiler.. i pass two arround.. i just trying to decide how that will be at runtime
19:53:50
beach
For what it's worth, environments figure more prominently in SICL. Most (all?) Common Lisp function that take an &optional environment argument dispatch to some SICL-specific generic function that dispatches on that argument.
19:54:08
pjb
dmiles: well, they should be merged anyways, because you can also macroexpand at run-time!
19:55:49
dmiles
pjb: yes .. it turns out the runtime env needs basically almost everythig the compiler env would have had
19:57:19
pjb
The thing is rather that the way clhs specifies it (that environment have only dynamic extend, without leaking them), let the compiler optimize out the local macros and symbol-macro, so they don't have to go thru to the run-time environment.
19:58:14
dmiles
yeah the whole of what dynamic extent is about ios letting one " optimize out the local macros "
19:59:59
dmiles
really what i meant it i dont feel comfortable with inlining a local macro that expects to not get what functions it will call overridden
20:03:39
dmiles
pjb: :( , that is why whatever i do i have to make sure i dont do something unexepected :)
20:09:55
dmiles
shka: i gensym (rename ) everything that everything that is not part of the global environment .. so continuations can be defined and found over a global namepace (i think this is how most impls would have done it) my compilation envinments job is to remember these names durring compilation.. at runtime i have lost all that info
20:10:34
dmiles
so i am trying to decide if i should not discard it.. i think pjb is talking me into not
20:11:04
pjb
If the environment is not leaked, you can discard it; if it is leaked, you need to keep it.
20:12:08
dmiles
yeah i think why i am considering leakjing it is to movtive mysself to wwrite the code arround keeping it
20:19:23
dmiles
the only difference between flets and labal in my code is in flets i delete the shadows at line 42 https://github.com/TeamSPoon/wam_common_lisp/blob/master/prolog/wam_cl/defun.pl#L35-L50
20:22:30
phoe
I will now try to spin up a brand new Linux container and try to reproduce this Qtools/Lparallel bug on it.
20:38:08
beach
s/perfect is/perfect it/ The full day cooking for my favorite coauthor, feeding her, and then working on our ELS submission related to partial inlining clearly had some consequences on my typing skills.
20:48:22
phoe
She won't attend. She'll stay in Poland - she had a car accident two years ago, and it still prevents her from travelling far.
20:48:45
phoe
KZiemian is my partner-in-CLUS though, and I thought that you had him on mind. He'll probably come to ELS with me.
20:51:05
beach
phoe: Sorry, "partner" is the current euphemism for "wife/husband/girlfriend/boyfriend/" I hate it, but that's the way it is.
20:55:50
beach
jmercouris: I consider a "partner" to be an administrative relationship, like me and my wife who married to avoid giving half of the house to our families, or like two people getting together to create a company.
20:57:02
jmercouris
beach: Are you listing an example, or are you actually saying you and your wife married for the purposes of not giving your property to other relatives?
20:58:49
jmercouris
Can't tell if you guys really like each other, or really don't like the relatives, either way, none of my business and off-topic :P
20:59:22
aeth
jmercouris: When I hear "oracle" I don't interpret the word as anything other than "give me all of your money, and pay per processor core"
20:59:32
beach
Sure. We do like each other. It is all relative to specific French rules. Nothing to worry about.
21:01:23
beach
jmercouris: I invite you to come visit us. You wouldn't be the first on #lisp do to that. And then you can find out for yourself.
21:06:21
jmercouris
Ah yeah, American culture is something complex, and I don't think a non-native can pick it up, because we are also very subtle
21:06:33
jmercouris
a huge part of the complexity arises from the mixing of so many cultures I think
21:07:45
jmercouris
I also have another theory, all of the most extreme types of individuals are in the US as those are the types of people that would leave their home country in favor of something new
21:09:51
rpg
it's worth remembering that the original model of the confederation was like the EU.... But if this keeps up we need to move to #political-science!
22:51:13
jmercouris
emaczen: here's what you need: https://gist.github.com/b0692ae85cfb9151d31e2ec690e51ef1
22:52:34
jmercouris
emaczen: for the sender you can use your content view (or really another view within your layout I think)
23:15:04
dmiles
the consequences of symbol-macroletting over a global variable is an error .. with-slot seems to symbol-macrolet.. i guess it is the case that there are typically very few global vars
23:15:18
jmercouris
emaczen: I have no idea, it is bound when starting the IDE and should be in your bootstrapping code for standalone
23:16:26
jmercouris
emaczen: if you look in my source cocoa/application.lisp you'll see where I setq *nsapp* as part of the bootstrap/startup of the standalone app
23:19:00
emaczen
jmercouris: I didn't really want to mess with it so I just figured out how to do it with cocoa...
23:19:52
emaczen
having to program a little bit with cocoa/objective-c makes me VERY thankful for common-lisp, there is some strange stuff out there
23:22:39
jmercouris
emaczen: You can also get access to the shared application via another function called like [sharedApplication] or something, I can't remember
23:33:47
asarch
PCL in chapter three says about some implementations compiles the code and other just interpret it
23:34:24
jmercouris
asarch: Yeah, but I believe SBCL does both, I'm not an SBCL user though, many people in this channel are though
23:35:38
dmiles
in clisp we have to ectually tell it we want a function compiled.. is that the case in SBCL>
23:38:01
Shinmera
I don't think sb-fasteval is activated on standard fancy builds, but that's the more recent and involved interpreter.
23:38:34
asarch
I remember quiet long ago that someone told me that God used Lisp to create the Universe
23:46:59
dmiles
i am calling WAM-CL a compiler since before i run a form at the repl i convert it to prolog source, then on several versions of prolog (especially the one i am using) code is compiled whenever it is called
23:50:16
dmiles
so (disassemble ..) calls clause/2 (which decompiles the Zip-WAM) and prints out what was threre
0:15:43
dmiles
what is neat is on YAP-Prolog it compiles to the Extended Andorra Model (EAM) https://arxiv.org/pdf/1009.3806.pdf
1:26:12
rpg
dmiles: compiling one high level language to another does seem a little perverted. But on the other hand, everyone's compiling stuff to JavaScript these days, so go figure!
1:27:15
rpg
dmiles: Once you get WAM-CL done, you can run Peter Norvig's Prolog-in-Lisp on it, which will almost be an MCEscher drawing!