freenode/lisp - IRC Chatlog
Search
11:17:37
lukego
I'm looking for but not finding information about how to make org-babel start SLIME session(s) by itself. I feel like I've seen this on the interwebs before though?
11:23:28
lukego
I mean that if I open Emacs, and open a .org file with Lisp source, and press `C-c C-c' to try and build it, then it complains that no SLIME session is available to evaluate the Lisp code. So I need to do `M-x slime' first. But I have the impression that org is able to manage one or more sessions on it own? (Or maybe it only does that with other languages, I don't quite recall.)
11:26:35
lukego
(This is not something important, I can easily live without, just had a memory fragment of having seen a HOWTO once upon a time and not finding it again now. Could have been for e.g. R rather than Lisp or something though.)
11:29:30
oni-on-ion
https://emacs.stackexchange.com/questions/26142/is-it-possible-to-open-file-then-load-slime-automatically ?
11:38:49
_death
you can change org-babel-lisp-eval-fn to your own function that starts slime if necessary
12:11:50
easye
lukego: RE: ASDF, I've been experimentally <https://github.com/armedbear/abcl/blob/master/ci/asdf-finds-abcl.bash> creating a DSL file for every ASDF system I want to access.
12:12:27
easye
Having everything on the filesystem allows me to quickly M-x ag introspect what is currently available by invoking ASDF:INITIALIZE-SOURCE-REGISTRY
12:13:40
easye
And for patches to Quicklisp, it is sufficient to git clone things into <file:~/quicklisp/localprojects/> <https://github.com/armedbear/abcl/blob/master/.travis.yml#L43>
12:38:23
phoe
http://www.lispworks.com/documentation/HyperSpec/Body/f_string.htm tells me nothing about this.
12:41:38
phoe
There is an ANSI-TEST that assumes that it must be fresh every single time, and it fails on CCL.
12:49:12
jackdaniel
assuming that the same string may be returned, what about (%f) (setf (svref str 0) #\d) (%f) ;?
12:50:00
_death
if the result EQ is expected to be true then it assumes the string is not fresh.. I don't think you can assume either way, so you treat it as if it wasn't.. same for COERCE
12:50:27
phoe
_death: ideally I'd want the passage from the spec that says that the produced objects must be fresh
12:50:45
phoe
because in theory #'COERCE could cache its results and return them if the objects need not be fresh
12:51:21
easye
Aren't strings implicitly static objects for implementations? It's true for abcl as they thunk down to java.lang.String references.
12:55:27
flip214
I'm trying to use named-readtables. In my code I have (let ((*readtable* (copy-readtable))) (named-readtable:in-readtable :mine) (ignore-errors ...))) but still that readtable is used in the next commands sent via slime - which breaks parsing, of course.
12:56:19
phoe
I've annotated this paste with one more. If you use (string #\a) that is not wrapped in a function call, then a fresh string is produced.
12:56:33
trittweiler
flip214, in-readtable modifies a slime variable associating a package with a readtable. It has a global side-effect that way
12:58:27
trittweiler
flip214, sly (https://github.com/joaotavora/sly) I believe has proper support for named-readtables. Which means it looks for a contextual in-readtable form (like Slime does for in-package) and makes sure to send that to swank when evaluating.
12:58:37
jackdaniel
literal objects are described as either quoted or self-evaluating, so it would not be conforming for stadard function to return a literal object, no?
13:00:36
jackdaniel
but you've got a point, there are functions which may return literal objects. but I'd expect their specification to have such warning
13:03:18
_death
phoe: (ok, I figured out deftest syntax..) note that in the other cases STRING can return such objects.. the string itself as shinmera noted, or the symbol's name, which as you note should not be modified.. so it makes sense to expect that the string (string #\X) should also be treated as such, given that there's no special wording to contradict
13:03:24
jackdaniel
also what symbol name returns is not literal objects but rather internal state of the symbol object
13:04:25
Bike
"literal" means it literally appears in the code, using it to mean "can't be modified" is confusing
13:06:13
jackdaniel
the thing is that spec doesn't say, that returned object from character is immutable, but when you mutate it function starts to return incorrect results
13:07:09
jackdaniel
phoe: see above ^ #'string may start to return incorrect results in code which is not non-conforming
13:07:27
phoe
but a FLET function with optimize speed 3 everything-else 0 that calls (string #\a) is constant-folded into "a"
13:09:03
jackdaniel
phoe: there is nothing in spec, that you can't modify result of (string #\a), so you are not forbidden to modify it
13:09:24
jackdaniel
when you mutate resulting string and subsequent call (string #\a) returns something else than "a", then it is incorrect result
13:10:06
_death
disagree.. since it doesn't claim the string to be fresh, you could have a compiler macro that expands to "X" on form (string #\X)
13:10:13
jackdaniel
seems so. I would be more unsure in case of symbol passed to string - should it copy the symbol's name?
13:10:28
jackdaniel
because it is not said it calls (symbol-name ...) hence there is no restriction on immutability
13:13:11
Bike
these kinds of issues are precisely annoying to deal with because without real cases of it coming up it's just abstract
13:20:49
phoe
one second though - is an implementation allowed to constant-fold something that is not constantp?
13:21:41
Bike
constantp isn't even sufficient to describe all the constant folding a compiler can do since it can't know about lexical variables that happen to be constants, etc.
13:41:56
pjb
phoe: check again: (flet ((%f () (string #\a))) (let ((x (%f))) (setf (char x 0) #\d) (list x (%f)))) #| --> ("d" "a") |#
13:43:19
pjb
(lisp-implementation-version) #| --> "Version 1.12-dev (v1.12-dev.4-4-gd9740256) Darwinx8664" |#
13:45:56
phoe
https://github.com/Clozure/ccl/commit/d2174411c72d9208f1c081632cce6996448bc68a#diff-7dbee25941139b1e1582d8f0c87f1b23
13:46:17
flip214
trittweiler: phoe: so I can't use named-readtables to programmatically read and parse text data? there's no WITH-NAMED-READTABLE, sadly.
13:48:43
phoe
_death: thanks for that link, this is the commit that states that #'STRING can always be constant-folded
13:48:55
trittweiler
flip214, (it's most likely preferable to use ensure-readtable rather than find-readtable)
13:49:25
flip214
trittweiler: well, the readtable is defined just a few lines above, so there should be no difference in practice
13:51:01
_death
phoe: what's strange is that sbcl has deftransforms for string/symbol case but not for character..
13:52:54
_death
phoe: it's strange to me that it doesn't have a deftransform returning a string literal
13:54:51
phoe
pjb: it doesn't also formally say that the consequences are undefined if that string is modified
13:55:29
phoe
jmercouris: because two different restarts have been established in various places of the stack
13:55:35
pjb
phoe: note that in the case of (string #1="x") it's #1# that is returned, not a fresh string (not a copy).
13:56:35
phoe
pjb: if we want consistency, then #'STRING may return non-fresh values and the ansi-test is wrong
13:57:26
trittweiler
which would be the upper one, assuming they are displayed by sorting top-to-bottom
13:59:46
phoe
my question by now is - since this tests succeeds only if #'STRING returns *fresh* values, where in the spec is it specified that #'STRING must return *fresh* values
14:01:34
pjb
phoe: that's the point; it's not formally specified. "fresh" doesn't occur on this clhs page.
14:02:24
flip214
I do (:syntax-from :common-lisp #\( #'<) so that the string "(1,2,3<") is correctly parsed as a list -- but the reader says "unmatched close parenthesis" there. How can I fake the end of a list then?
14:03:57
jmercouris
trittweiler: well, the strings are exactly the same, I can't exactly know without actually looking with the inspector
14:04:13
pjb
flip214: emacs will colorize the string so you can see what's inside and what's outside!!!
14:05:57
trittweiler
flip214, what phoe says. Define your own reader macro function for #\< which uses read-delimited listwith #\>
14:06:00
pjb
ok, in that case, I guess you assume that (:syntax-from :common-lisp #\( #'<) means define a reader macro on #\( to read-delimited-list with comma and #\<…
14:06:08
flip214
phoe: thanks; I could also have #\) as the list terminator, so I can't call read-delimited-list myself
14:06:39
trittweiler
yeah then you really need to write a function that does the parsing yourself :)
14:06:53
jmercouris
Save time, write a parser that writes parsers so you never have to write a parser again
14:06:53
flip214
pjb: I hoped that I can just "copy" the behaviour from #\) to #\<, but that's not so easy.
14:07:46
pjb
The trick of lisp is the Polish notation: the first character determines the syntax, the first symbol determins the semantics.
14:08:18
flip214
this is "parsing" the strace argument list; and so I have to handle "<... unfinished>"
14:08:23
phoe
flip214: you can't use READ-DELIMITED-LIST then since it expects a single closing char.
14:08:43
flip214
I was able to redefine , to be the delimiter character, and to ignore spaces after it
14:29:56
phoe
jackdaniel: the spec doesn't say that the return value is mutable and it doesn't say that the return value is immutable
14:44:26
jackdaniel
phoe: taking that line of thought renders string produced with with make-string foldable
14:45:15
jackdaniel
while I agree that it is not said whether it is a fresh object or not, there is no indication that modifying the result is an undefined behavior releasing nasal deamons
14:48:18
phoe
jackdaniel: you are correct, make-string is supposed to be the function for consing up new strings
14:49:31
phoe
so it seems that the only possible choice that doesn't conflict with (string #\a) returning "d" is to make #'STRING always return fresh strings for characters
14:51:19
jackdaniel
in case of a symbol name I would argue that it is necessary to return a fresh string
14:52:19
jackdaniel
it is not said, that it returns the same thing as symbol-name does (or that it calls symbol-name)
14:55:12
jackdaniel
specification: yyy returns "42". modifying string has undefined consequences. vs. zzz returns "42".
14:55:57
phoe
if we read it that way, it becomes obligatory that (symbol-name :foo) is NOT eq to (string :foo)
14:56:26
pfdietz
On the issue of strings in the standard: an implementation is allowed to turn string constants into strings with restricted element types. "foo" can be turned into a simple-base-string, for example.
14:56:26
jackdaniel
undefined consequences in symbol-name doesn't prohibit it from returing fresh string
14:56:54
jmercouris
let's say I am at a parenthesis and I want to jump to the corresponding parenthesis, how can I do that?
14:56:54
phoe
pfdietz: that's a different issue though, subtyping strings into more specialized strings
14:58:25
pfdietz
I forget, alas. It was in a test case where a string constant is copied, then a non-base-char is assigned into the copy.
15:01:29
_death
phoe: when I started using stumpwm I found it strange that it used C-t for prefix.. immediately switched it to C-z
15:03:47
pfdietz
Is there a library for exploding a set of functions into versions specialized on particular subtypes of the arguments? This comes up in some string handling code, where I want it to take advantge of some large string being simple and of a particular element type.
15:14:15
jackdaniel
pfdietz: few mcclim functions do sometething like (macrolet (thunk () ...) (typecase foo (a (thunk)) (b (thunk))))
15:20:27
jmercouris
I've seen the term used a lot, I've looked at the definition, and I still don't get it
15:21:42
_death
just something you jump to without thinking.. it's been "thunk".. or, a function taking zero args that usually delegates to another thing
15:23:26
jackdaniel
in sources I saw it is sometimes used as a macro name in macrolet to name something without a name
15:23:58
jackdaniel
(so strictly speaking in a snippet I've shared above it is not a function but a macro)
15:30:31
jmercouris
That sounds terrible, not sure why you wouldn't just use a defparameter or something if you need a compile time evaluation on the toplevel
15:31:45
pfdietz
I have actually had need for thunks in CL recently. The issue was redefining a function that was defined in a nontrivial lexical environment. To capture that environment, one creates thunks.
16:15:43
phoe
_death: that CCL commit is sadly not enough. (string #\a) still gets folded with STRING not on that list.
16:30:26
_death
you can find many omissions once you're looking for them.. I already gave my argument wrt STRING
16:31:40
_death
it's not the safer choice, it's "false sense of security" choice.. the safe choice would be to not assume it's a fresh string
16:32:16
phoe
the users who read this page do not need to assume that the consequences are undefined if the resulting value is modified
16:32:20
sjl_
As a random bystander, reading clhs STRING, I would not expect the returned strings to necessarily be fresh
16:33:48
_death
phoe: if a user modifies this string, whether it "works" or not on a particular implementation, it's not guaranteed to work by the standard, so it just gives a false sense of security.. and the cost is that you can't have a more efficient STRING
16:39:04
_death
so as a user, you'd go for the conservative choice: not modify the string.. as an implementer you can decide to return a fresh string, but it won't matter if the user makes the conservative choice
16:40:10
_death
but if the user goes wild and modifies the string, it will only work by chance - because the implementer chose to return a fresh string
16:40:44
sjl_
I'll reiterate: STRING is explicitly defined to NOT return a fresh string in some cases. So as a user, I wouldn't expect to be able to rely on it returning fresh strings in the rest.
16:45:11
sjl_
Now I'm confused. You say "asits return values for symbols and characters are required to be fresh." in the issue, which is the OPPOSITE of what I'm saying.
16:48:44
_death
so with this argument, whenever the spec doesn't say the structure is shared, you are required to return a fresh one?
16:51:17
phoe
it would be nice to have the spec say for every return value if it might share structure with anything else or if it is fully mutable
16:51:17
jackdaniel
in other you do not have to, because it is data supplied by user. i.e (string #\a) should always return "a"
16:52:47
_death
jackdaniel: earlier I mentioned the possibility of having a compiler macro for STRING that expands to a literal if the character is known
16:53:07
sjl_
I'm sure pjb probably said this in my missing scrollback, but an implementation that returns a single string for (string #\x) is a http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#conforming_implementation
16:53:51
sjl_
And a program that relies on (string #\x) being fresh is not a http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#conforming_program
16:55:21
phoe
4) reconsider my life choices and start making music again instead of digging into lisp spec issues
16:56:22
_death
I wouldn't expect to be able to modify the string returned by MACHINE-TYPE (if any), though the spec also doesn't say whether it's fresh or not
16:57:12
jackdaniel
it is not said that modifying string returned by (string foo) has undefined consequences; but I'm reiterating myself
16:57:44
phoe
_death: but that is the easiest way for your lisp image to go from 64 bits to 32 bits! just mutate "x86_64" into "x86_32" and you can load 32bit foreign libs just fine, trust me
17:15:12
phoe
I'd say that it is an implementation detail whether STRING returns fresh strings or non-fresh strings
17:19:51
phoe
so the test tests something that isn't a part of the spec or inferable from its wording
19:16:22
phoe
though it would be pretty insane to tell Lisp to make me a string and get a second-hand one that is already used in three other places
19:39:42
phoe
after digesting all of the arguments I am absolutely tempted to make a PR saying that this is controversial enough for :ANSI-SPEC-PROBLEM
19:39:59
phoe
since I think that we can all agree on one thing - the spec has a problem here and should have been much clearer on that part
20:55:12
rpg
Xach: Thanks. Seems like this will hamper use of CL for tasks that involve data analysis...
20:56:02
Xach
rpg: sure. if someone needs that to do data analysis and they want to use lisp, they will have to make it.
20:58:11
Xach
rpg: sometimes when i want something like that i fake it with run-program, e.g. (with-open-ssh-file (stream "user@host:path/blah") ...) it would just run scp and copy it to a local file, rather than try to do much fully in lisp.
21:00:29
phoe
so just call the proper sshfs commands in some sorta directory and then use logical pathname translations to refer to that temporary directory
21:02:09
Xach
I think logical pathnames are for when you have an enumerable set of literal pathnames embedded in the code, not for arbitrary translations with runtime variations
21:03:27
White_Flame
IMO, this is something the OS really should handle. The fact that all networking is bound to just a plain host:port is a massive weakness
21:04:20
Xach
I think it's a bummer that people start with the idea of arbitrary, configurable runtime pathname transformation and get Very Upset when logical pathnames don't do that, but I don't think that's fully the fault of logical pathnames
21:06:32
rpg
phoe: sshfs sounds neat. I'm with Xach though about logical pathnames -- I think there's too much danger that the filenames would break the LP rules, turning that into a mess.
21:35:25
rpg
Xach: I bet that's possible with ABCL, now that I think of it, but I'm not a JVM kind of guy.
21:47:03
rpg
phoe: Yes. Looks like someone set up an sftp file stream for python, but it's an add-on
21:49:47
jasom
rpg: just curious; I had a few documentation ideas and wasn't sure who to run them by once they are more complete
21:50:17
rpg
Please send them my way! I just got an idea for a new FAQ that I will try to put into the manual today.
21:52:23
jasom
okay. Will do. I'm going to go back through the mailing list and some reddit posts because things that have been obvious to me for years w.r.t. asdf seem to still be hangups for others.
21:54:07
jasom
The number of times I've seen some variation of "I wish I could just load an ASD file and then have my system be loadable" come up is rather stunning since the manual is pretty clear on not just "yes that will work but "We even hook into slime's C-c C-k so that you don't need to do anything special if you're using slime"
21:56:55
jasom
life is finally slowing down enough for me that I can possibly contribute to projects in places I've noticed I might be of assistence