freenode/lisp - IRC Chatlog
Search
23:14:03
axion
With drakma, if I query a URL with a 301 redirect, how would I get the url it is going to redirect to without actually connecting?
23:16:02
axion
I purposely construct a URL that redirects to a non-existent domain, and drakma will try to resolve this, even if I tell drakma not to redirect with :redirect 0, making usockets error.
23:17:12
axion
I will instead get Condition USOCKET:NS-HOST-NOT-FOUND-ERROR was signalled, because drakma attempts to resolve the 301 target
23:20:13
phoe
Is it some kind of generic function call? Perhaps you can write an AROUND method that hijacks the call if some dynamic variable is set.
23:22:41
phoe
You might actually want to make a Drakma PR that, in that place, signals a custom condition, whose slots contain the URL information.
23:24:18
axion
You can try it yourself with a url i made: (drakma:http-request "https://is.gd/ESNHyV" :redirect 0)
23:37:24
Bike
mainly i'm surprised that it signals an error instead of just returning, like it does for 404, say
23:46:11
axion
the `trivial-http` library doesn't error and shows the url in the returned header. Just very irksome i'll be using 2 http clients in this project
23:52:20
phoe
Geralt had two them swords for different use cases and you're complaining about two HTTP clients
23:52:57
axion
It's just a pain because it doesnt support keep alive, and i'll be doing many urls at once
23:59:15
phoe
well, there's your motivation to actually update drakma's HTTP-REQUEST with Yet Another Keyword Argument™
23:59:44
phoe
(drakma:http-request "http://foo.bar" :redirect 0 :return-url-on-redirect-exhaustion t)
0:04:58
axion
tbh i'd much rather see this in dexador, because lots of drakma sucks. but i have bug reports from years gone unanswered by fukamachi. I try to avoid his software for this reason, but some of it is too nice
0:05:41
marvin2
I kind of like clojure's concise way of defining a lambda: #(fun % 1) would be the same as (lambda (x) (fun x 1)). is there a way to write something similar to that (doesn't need to be exactly the same syntax)?
0:09:04
aeth
marvin2: you might be looking for alexandria's curry and rcurry (although it's not fully positional, it's just right or left) e.g. (rcurry #'fun 1)
0:09:28
aeth
And it's not a major dependency because practically any large program will have some dependency that already uses alexandria.
0:14:21
marvin2
it is different than # though, and doesn't always replace it. positional-lambda seems to be closer (virtually the same). I am tempted to write a macro λ that just expands to plambda
0:16:31
aeth
Careful about using the unicode lambda... A lot of us replace "lambda" with it through emacs configuration.
0:17:17
aeth
You'd probably want to make it #λ and use this: http://www.lispworks.com/documentation/HyperSpec/Body/f_mk_dis.htm
0:18:30
marvin2
is that some sort of convention, to start all user defined reader macros with '#' sign?
0:22:05
Bike
marvin2: not exactly a convention, it's just kind of convenient. you could use the lambda character if you want.
0:24:38
JuanDaugherty
by the time i would get around to determining the matter of fact, it prolly will
0:26:35
Bike
like, you wouldn't accept a symbol with only one character in it, or you wouldn't accept the use of only one symbol incorporating hanzi?
0:27:09
JuanDaugherty
i wouldn't accept that I freely code using hanzi, but at this point think it would have a good shot
0:40:59
Bike
something weird happened when i tried to define factorial, but it might have been that i was blindly pasting curse words
0:45:38
JuanDaugherty
yeah, that must have a non expletive meaning the radicals are too common, wiktionary says it's cantonese
0:47:03
JuanDaugherty
lil wierdness is OK but more than that is the gap I had in mind between just accepting a symbol and freely coding
0:49:36
malice
During quickloading I get an error "illegal function call". Can I somehow learn which function call is illegal?
1:07:55
axion
Yes, you could, but the question was about quickloading so I gave an answer closer to that usage.
1:20:52
axion
Why would you want to do that? If you are writing it to disk, you wouldnt use a namestring, but a pathname
1:26:39
malice
Yes, that's what I'm currently using. I was curious whether there was some better alternative.
1:31:54
malice
As I said, I will receive some string from the internet, so I'm not sure what it will contain. I want to use this string as a filename - so I want to write it to the filesystem.
1:33:08
axion
Then you'll have to encode them in some encoding that works best for your application. Most web stuff is base64 encoded. You can use cl-base64 for that. It accepts a string, octet vector, or stream as input
1:34:27
axion
Or you could just write a binary stream to disk. It really depends what you are doing with these files once on disk.
2:07:43
zulu_inuoe
Is it allowed & kosher to use #+ and #- reader macros in an ASD file? I'd like to load certain components on different platforms
2:10:59
axion
zulu_inuoe: Many many projects do this. https://github.com/rpav/fast-io/blob/master/fast-io.asd#L15
2:12:29
Bike
https://common-lisp.net/project/asdf/asdf/The-defsystem-grammar.html#Feature-dependencies
4:46:59
vtomole
I've heard somewhere (here :https://gist.github.com/chrisdone/516489f4f27846712225#file-anintro-md), That it is hard to write a self intepreter in a statically typed lisp. Is that true?
4:58:47
vtomole
That is different from using type declarations? Type declartions catch type errors at compile-time?
5:18:46
pillton
The standard doesn't specify. Some implementations do catch type errors at compile time.
5:22:00
vtomole
I figure thats the reason type declarations exist. What would be the benefit of an implementation catching errors at runtime with type declarations?
5:23:48
vtomole
Oh and if lisp can catch errors at compile-time, then the amount of misinformation out in the wild is insane (ex. "I don't want to use lisp cause it's dynamically typed")
5:29:33
pjb
vtomole: no, type declarations in Common Lisp is to let the compiler avoid doing any type inference or type checking. It is you being smarter than the compiler!
5:29:33
pillton
Well it is often hard to do since you can call (setf (fdefinition 'my-func) #'new-func) at any time.
5:29:40
White_Flame
and a compiler that really screams loudly if there's any possibility of putting the wrong type somewhere
5:32:37
pillton
I'd rather see a second compiler which sacrifices interactivity for improved analysis.
5:33:20
White_Flame
or even just a manual "bake" and "unbake" user command once you think the system is stable type-wise
5:43:56
edgar-rft
vtomole: the amount of nonsense about lisp can be significantly reduced by listening to sufficiently intelligent people :-)
6:00:03
dmiles
i almost need to take the work "inference" off my irc highlighting expecially now that 95% of the time it is the opposite of interesting :)
6:06:59
pillton
Why is it not interesting? There is nothing stopping an implementation for performing inference/optimizations in code using operators in the CL package.
6:09:58
pillton
Perhaps a CDR could be written to allow for users to create their own immutable packages?
6:14:37
Zhivago
Well, there are some things limiting it -- like which things can be dynamically changed.
6:51:48
malice
Hi! Is there some universal way of protecting against unknown errors? I'm looking for something to wrap the place which is most prone to errors.
6:52:37
malice
Right now I got some error which I could correct by myself(and rewrite the code so it does not happen again), but because I forgot about that, I only have an option to reevaluate slime request(which is basically "start from the beginnning" or killing the thread
6:53:40
pjb
Notice that to be effective, you have to provide the restarts close to the source of the error.
7:08:48
otera
Is there a standard way or library of converting a nested data structure in lisp (could be any or all of plists, alists, hashtables or CLOS objects) into a nested dict in javascript? I'm using parenscript, but it is not a prerequisite.
7:09:17
jackdaniel
minion: memo for knusbaum: try (clim:accepting-values (t) (setf *config-name* (clim:accept 'string :prompt "Config nname:"))
8:15:42
phoe
(car (cdr cons)) - you get the cdr first to get the second cell, then its car to extract the element
8:26:37
axion
I can't find anything in the spec that says this should be possible, but I just stumbled on it accidentally: (format t "~b~%" #(121 33 43)) => #(1111001 100001 101011)
8:27:32
phoe
~B binds *print-escape* to false, *print-radix* to false, *print-base* to 2, and *print-readably* to false.
8:28:32
phoe
from 22.3.2.2 Tilde D: Decimal: "If arg is not an integer, it is printed in ~A format..."
8:30:55
jackdaniel
if you want nth element in the list, use (nth n my-list) where elements are indexed from 0
8:31:24
jackdaniel
if you are making your own lisp, then providing function nth is much simpler than adding all caaddaaaar alternatives
8:32:56
pjb
axion: indeed, the argument "should be an integer", but all implementations (I have on this computer) behave this way.
8:54:09
some-user
how to make run-program to respect my PATH? (run-program "ls" '()) doesn't work because it fails to look into $PATH
8:56:19
pjb
some-user: notice that when using the shell, it will in general load some profile (eg. .bashrc when using bash), and the PATH can be reset in this profile.
8:56:53
pjb
some-user: so if you changed the PATH or just want the one inherited, you may have no other choice than calling fork/execvp yourself.
8:59:14
jackdaniel
some-user: function is described in detail in sbcl manual here: http://sbcl.org/manual/index.html#Running-external-programs
9:00:45
jackdaniel
I don't, you never know when it'll break its api, it's not even documented (unless someone considers docstrings being documentation)
9:06:47
some-user
"(run-program "ls" '() :shell t" - unkown keyword :shell, "(uiop:run-program "ls" nil)" - odd number of key args
9:09:49
jackdaniel
the problem is that uiop instead of making distinction between program and arguments does split by itself
9:13:07
jackdaniel
some-user: regarding update, you may use a library created by Anton for that: https://github.com/avodonosov/ql-asdf-chooser
9:14:06
jackdaniel
(some incompatible changes were introduced, like enforcing using make-operation instead of make-instance to assure singleton objects)
9:15:58
some-user
jackdaniel: got it, thanks, will do as readme says most likeley and update asdf manually
9:22:14
some-user
https://common-lisp.net/project/plexippus-xpath/examples.html#id53256 where can i get (stp:make-builder) from?
9:30:20
Shinmera
Sure, it's less powerful than Xpath, but I find it's more than enough in the vast majority of cases.
9:34:11
clintm
I'd probably dislike it a lot more if it wasn't the only way to get a cross platform gui.
9:34:36
Shinmera
I dislike it because of exactly that. Being forced to use a particular tech is irksome.
9:37:55
phoe
<cons><car><symbol package="COMMON-LISP-USER" name="HELLO" /></car><cdr><cons><car><symbol package="COMMON-LISP-USER" name="WORLD"/></car><cdr><symbol package="COMMON-LISP" name="NIL" /></cdr></cons></cdr></cons>
9:38:00
Shinmera
clintm: Well Qt is a toolkit that's already done, so this is new. It's for my game engine. Doesn't need to be super complex for that, fortunately enough.
9:39:56
clintm
Maybe I need to revisit qt and the associated tools for cl. The last time I tried, it always seemed to blow up in unexpected and frustrating ways.
9:46:27
loke
There was an abomination coming out of that... Sit thee down, for 'tis a borrible story.
9:47:29
loke
Or, kinda sorta XML. Because apparently as long as it was like XML it was great. Or something
9:48:05
loke
anyway... the language was called "water" and there is very little information available on it these days. Buthere's a snippet:
9:48:45
loke
The guy was very bullish on his creation, saying that it was going to be the best thing ever, blah blah
9:49:36
loke
Now, after a while, this thing seemed to just disappear, and there were no more updates (I had been casually following it for years, just to see how long it would last)
9:50:03
loke
Then I figured out why the project died, since I recently decided to search for the guy's name to figure out what he was up to now:
9:50:42
clintm
I vaguely remember the huge tech bookstore in portland having a whole wall dedicated to books on UML because it was the future.
9:51:46
Shinmera
ACTION 's "Software Engineering" class this semester required us to model stuff with UML
9:52:42
phoe
clintm: you know what's worse? there's this language called Java with all its spinoffs like SOAP...
9:52:59
Shinmera
In the very least the class also showed formal verification and static analysis, which is actually useful.
9:53:07
loke
After the dotcom company I had been working for for a few months had to fire everybody (this is back in 2002 or something) I interviewed joined a company implkementing a new system. They sead they were heavily into UML, so while waiting for my first day at work, I bought a UML book to learn what the hell it was all about... Well...
9:53:10
jackdaniel
not that I'm saying that languages without macros make sense, but for some syntax macros doesn't ,)
9:54:05
Shinmera
Design patterns are when you don't understand your problem and start out thinking you can fit it into a premade solution, only to realise it doesn't fit, and have to warp it into a monster of crap as time goes on.
9:54:19
loke
Turns out that the cuonsolutancy company who had been doing the implementation of the system (I was hired to bring the project in-house) had designed an object model in UML (rational Rose, I think). The model was based on EJB 1.0. And they they hired some interns to implement stubs for aveenrthing in C++
9:55:40
clintm
I got a job at <large, huge, online retailer that you almost certainly have heard of and probably have used> and no one on my team ever wrote code outside of work. I mean, it's their time to do with what they want, but it was still a bit shocking to me.
9:56:07
loke
Shinmera: Probably because the lead developer didn't know Java, but he had heard about the gratness of EJB
9:56:24
Shinmera
clintm: Most of the students I've met at uni don't really code in their free time either.
9:57:56
loke
So instead of doing new Foo() and call a method on it, you had to look up a session home, instantiating it, and call a creation method on that to generate some kind of object or whatever. I don't rememebr, it was just too insane.
9:58:20
loke
So you had kinda-sorta the calling sequence of Java EJB 1.0, with none of the benefits.
9:59:11
loke
phoe: He had no Java experience. If he had, he'd ahve known EJB 1.0 was an absolute clusterfuck.
10:00:41
loke
He also implemented the application in 4 distinct "layers". And even though the classes for all of them were available everywhere (it was all compiled into a single monolithic C++ application using VS anyway), he still created these "session objects" that did nothing but to call the next function in the stack.,
10:01:37
loke
So he had thousants of stub classes implemented by these interns who had just been manually copy/pasting the class definitions. None of the classes had any implementations behind them of course, and these classes were just things they had designed in Rational Rose without any imput from the domain experts.
10:01:49
clintm
(trying to keep from writing a simple parser for Water... I best just close the tab)
10:02:27
loke
So you had objects representing hardware devices with a .PowerOn() method... How to send a command to an unpowered device? Hell if I know....
10:11:24
clintm
ah, ok, qt4 et. all has finished installing, so I can distract myself with qtools, etc. closing the tab...
10:11:45
Shinmera
qtools install its own version of the qt4 libraries. No need to install anything manually.
10:13:19
loke
clintm: If you want a bigger insight into the mess which is that language, have a look at this: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.199.9060&rep=rep1&type=pdf
10:19:55
clintm
Huh. Should (ql:quickload '(qtools qtcore qtgui)) work out of the box? Maybe I've done something to my sbcl and ccl installs. Or, maybe I need to read the docs and this time pay attention.
10:24:11
clintm
what's the shortcut in sbcl for a backtrace in the restarts prompt? I seem to have forgotten it.
10:31:00
Shinmera
linux / osx / windows only for the moment. With all the different bsd flavours I wouldn't even know where to start.
10:31:12
Shinmera
Should put in a better error message for unsupported systems though. I thought I had done that.
10:33:14
clintm
Supporting bsds requires building all of the libraries, correct? Not exactly a trivial job.
10:34:45
Shinmera
But, since I never put in any support for BSD, I first need to fix up some of the lower level stuff.