freenode/#lisp - IRC Chatlog
Search
12:06:38
phoe
I love that thing when I need to operate on some body of code, like, wrap every element of that code with a list
12:06:54
phoe
And I just copy it, jump to the REPL, do a quick MAPCAR, copy the result, paste it back into the code.
12:19:03
|3b|
similarly C-- C-x C-e evals last expression and saves result to kill ring so you can paste it elsewhere
12:57:49
pjb
phoe: I don't even go to the REPL, I do that in the lisp buffer in emacs, wrap a pprint around it, and type C-u C-x C-e
14:13:36
jackdaniel
afaik he is now busy with his game, you may track its development progress here: http://techsnuffle.com/
14:41:06
devon
Optima, Trivia and other pattern matching libraries have does-this-node-match-this-pattern but seem to lack find-a-match-at-or-below-this-node, am I missing some wild-inferiors or similar feature?
16:14:00
pjb
(destructuring-bind (car . cdr) '(a b (c . d) e f) (list :car car :cdr cdr)) #| --> (:car a :cdr (b (c . d) e f)) |# yep, it matches.
17:49:56
Josh_2
can someone tell me if there is a better way to do what I'm doing here. https://plaster.tymoon.eu/view/1100#1100 ?
18:07:19
Josh_2
_death: well it wasn't originally, it was always 4 but then I ran into issues where just bit shifting and logioring the values would work, until there were trailing 0's
18:07:51
Josh_2
if there were trailing 0's I'd get outputs I don't want as the bytes are being sent from a Java client
18:14:37
_death
from the transcript at the bottom I am guessing the issue is little endian vs. big endian
18:22:36
Josh_2
I saw this https://stackoverflow.com/questions/21973387/casting-8-bit-int-to-32-bit obviously C but still
18:24:25
Josh_2
Well it showed me the issue, because I do have to flip the order on 4 byte sequences like #(1 0 0 0) or I end up with huge numbers instead of just 1
18:25:34
Josh_2
or reverse it. And then when I get an input like #(0 0 34 45) it has to be #(34 45 0 0) not #(45 34 0 0)
18:32:45
Josh_2
then if I bytes-to-int it without stripping the trailing 0's I get 70778880 (27 bits, #x4380000)
18:33:54
_death
forget bytes-to-int.. first verify in the Java program that the array you get is #(56 4 ...)
18:39:04
phoe
in order to verify it, don't send it over the network, print it to console from the Java side
18:40:09
_death
Josh_2: are you saying that you printed the array in the Java program and it showed 4 as the first byte?
18:41:11
phoe
_death: I guess so. big-endian is the "natural" order of writing digits where little-endian is the inverse
18:41:27
phoe
so the number 123456 in big endian would be 123456 and in little endian would be 654321
18:42:35
Josh_2
usocket:socket-recieve requires that you either give it a buffer or a length of a buffer it will create
18:46:33
Josh_2
and the buffer you give it has to be a specific size already, you can't make it extendable so it'll fit just right
18:48:41
phoe
yes, bigintegers can be arbitrarily large so Java can send you something that is 9001 bytes long
18:50:10
phoe
if you want to go this way, then you'll likely never get a screen that's larger than 65535x65535
20:58:07
pjb
puchacz: you can put reader macros on [-+0-9] so that you can read 1_000_000 ; also on _, because I would admit _123_456.
21:25:15
no-defun-allowed
are there any fancy (human) language parsers like prolog-talk in quicklisp?
21:48:15
no-defun-allowed
i'd like to take some english text, make it into a parse tree, and possibly turn it back later
21:54:38
no-defun-allowed
is there anything on using cl-nlp? i found tokenizing but just doing apropos on variable names doesn't seem too efficient
21:59:35
fiddlerwoaroof
margaritamike: using lquery, it would be something like this: (lquery:$ (initialize "<html><!--foo--></html>") (children) (contents) (filter #'plump:comment-p))
22:00:17
fiddlerwoaroof
lquery is a little dsl wrapper around plump that makes traversing xml a lot nicer
23:27:39
djeis[m]
The trouble is that parsing of the whole file happens before evaluation when you use compile.
23:28:12
margaritamike
What should I use instead of defvar for my my variable to load up after quickload has finished importing the library?
23:28:27
pjb
Indeed. ql:qiuckload is a function. This form is evaluated only when the file is loaded, not when it's compiled.
23:30:08
djeis[m]
You need the eval when if you want the ql:quickload to happen at compile time at all, which you do want because you need to be able to refer to the drakma package. That's why we usually use a build system like asdf to manage load-order lol
23:30:29
fiddlerwoaroof
you can do something like sbcl --eval '(ql:quickload :dependency)' --load my-script.lisp --eval '(my-script-package::main)' --quit instead
23:30:56
djeis[m]
You need the quickload to be evaluated before you compile the rest of the file is all.
23:31:06
pjb
Then asdf can take care of doing the things that need to be done at compilation time, vs. load-time.
23:31:58
no-defun-allowed
cl-earley-parser seems good enough for what i need, i just need to write the grammar and scrape a dictionary
23:32:12
djeis[m]
If you use load directly that might solve the issue, because it might (I forget exactly...) evaluate each form before it even parses the forms afterwards.
23:32:33
djeis[m]
But compile-file needs to parse the whole thing, and it won't go about evaluating stuff you haven't explicitly told it to.
23:34:42
margaritamike
I just want to load a file into slime and have it execute what i tell it to sequentially. I don't want to have to learn asdf if it's not required right now. Still getting a hang of quickload and drakma.
23:36:30
fiddlerwoaroof
margaritamike: if you insist, you want to do this: https://fwoar.co/pastebin/3c2b5cd1ddb15117de83096eff495b3091ccc00d.lisp.html
23:38:10
pillton
margaritamike: You want defparameter instead of defvar if you want to continue working this way.
23:39:06
fiddlerwoaroof
You could also do this: https://fwoar.co/pastebin/cecc07593809dea7daeff8b0ad4a4bd4c8f2a02c.lisp.html
23:41:23
margaritamike
I just want a variable to reference and pass the response on to a parser to search the DOM tree for random junk
23:42:26
pjb
Even if you write a script, it's important to write functions, and to call the main function at the end, avoiding to do anything else at the toplevel.
23:43:01
pjb
This is because scripts are read by buffer load, and if you are editing the script when it's executing, then you will read broken sexps across buffer boundaries!
23:43:43
Jachy
fiddlerwoaroof: I'd add #-quicklisp in front of the load, no need to load it again if you didn't run it as a script...
23:43:50
margaritamike
Why was the compiler not smart enough to tell me any of this. I would not have figured this stuff out from the stacktrace it gave me.
23:44:34
fiddlerwoaroof
margaritamike: the problem is you aren't really working the way CL expects you to work
23:45:13
pillton
margaritamike: Ok. SLIME starts a single lisp machine with a global environment. This global environment is updated every time you compile and/or load a file.
23:45:51
Jachy
margaritamike: What is it you want the compiler to tell you? Admittedly it's confusing at first to understand setf/defvar/defparameter and when it's appropriate to use them at the top level...
23:46:40
pillton
margaritamike: The first time you loaded the file you pasted, a dynamic variable was created for *response* and the value returned by (drakma:http-request "http://lisp.org") was bound to the *response* variable.
23:47:44
pillton
margaritamike: The second you loaded the file you pasted, the binding of the *response* variable was NOT updated because DEFVAR was used instead of DEFPARAMETER.