freenode/#lisp - IRC Chatlog
Search
0:36:54
nydel
hmm, i return to an old project depending on :USOCKET package and it seems the package function #'SOCKET-SERVER is not defined. is this my end? or has usocket changed?
0:43:50
nydel
Xach: thank you - i was able to ql:quickload that right away. is this package connected to :USOCKET?
0:50:59
nydel
odd, as far as i can tell, what used to be :USOCKET is partially in :USOCKET-SERVER even though slime-mode autocompletes some functions from the latter with only the former loaded.
4:01:55
aeth
You know what's cool about CL? You write something and 19 times out of 20 it'll work in SBCL, CCL, and ECL without having to work around various quirks.
5:01:36
forumulator
Hi guys. Need a little help. I'm trying to expand a lisp macro to product something like val(a)->val(b). However, `(,a -> ,b) doesn't give me the correct result.
5:09:46
beach
forumulator: They work on S-expressions. Spaces are just related to how things are printed.
5:11:43
forumulator
I could do a format, but it only outputs strings. How do I convert string to lisp code?
5:12:21
beach
If you are new to Common Lisp, that is definitely NOT something you want to do. You will get into all kinds of trouble with readtable-case and packages.
5:14:18
forumulator
beach: I dont' care about messy at this point, I've spend hours breaking my head on this. Lisp is a major programming language, and there doesn't seem to be sufficient macro documentation.
5:15:25
forumulator
There is some stuff, but I couldn't find advanced docs for the stuff I'm trying to do.
5:17:37
forumulator
beach: But yeah, university class. Everything's good except for this final part. Any idead?
5:20:26
forumulator
Please don't mind, taking help on an assignment is a bit sketchy. Even if they are ones like this.
5:24:09
beach
In a language like C, "enums" are used to associate compile-time names with small integers at run-time.
5:24:28
beach
But Common Lisp has symbols at run-time, so there is no great use for such a facility in Common Lisp.
5:25:42
beach
Basically, constants with names like planet->mass->mercury are pretty useless in terms of programming.
5:27:52
beach
In fact, if you have to construct that kind of symbol at run-time, you would use a hash table (that of the package) implicitly anyway.
5:30:28
forumulator
Got it. Have to go to school now, thanks for your help! I'll ask my prof the point.
5:30:30
flip214
well, I don't see a package PLANET with a symbol MASS and a property MERCURY as pleasing.
5:34:19
flip214
although, for a single-level hash table, emulating multiple levels via a _single_-character (so it's "trivial" to split [ie. in C to change to a NUL ;]) isn't unheard of
6:32:12
jackdaniel
phoe: common lisp doesn't give you weak data structures at all. as of compilers, usually you have hash tables with weak keys, values or both and for general structures you have a weak pointers
6:33:53
jackdaniel
that's why I've mentioned what some implementations provide. first part of the answer hints, that it was imprecise. if abcl provides weak heap, would that satisfy you if I'd said: weak heap is there too. ?
6:35:11
shka_
phoe: please note that in practice, weak pointers in garbage collected language have a limited use
6:35:42
jackdaniel
I'm curious what use do they have in a language, which is not(!) garbage collected
6:37:32
shka_
jackdaniel: i would not say so, most people think about tracking GC when they are talking about GC
6:38:18
jackdaniel
shka_: I'm very sceptical about this claim (especially in context of discussing data structures with weak references)
6:38:27
Shinmera
Refcounting helps in tracking garbage and disposing of it. It is a gc technique, whether people like it or not.
6:39:35
shka_
in tracking GC language, reference counting have limited use when compared to reference counting
6:40:31
Shinmera
shka_: a tracking gc still counts references and hence weak pointers have plenty of use.
6:41:57
Shinmera
anything where you aren't the one that is in charge of managing the object's lifetime
6:42:10
flip214
shka_: a big graph of structures with only a single entry point is less common than one with multiple entry points... n over k ;)
6:42:46
no-defun-allowed
"ooh! it's for realtime programs cause tracing isn't realtime!!! cause rc totally is deterministic!!1!!"
6:43:14
flip214
shka_: keeping identity across "foreign" objects (like ones loaded from a database).
6:44:09
jackdaniel
defending opinion just for a sake of defending it isn't a good way to manage ones time :) \o
6:47:42
flip214
now, whenever a thread loads object #1 from there, you want to return the same (as in EQ) object in memory
6:50:31
shka_
phoe: well, for me things are what they are because of how they behave, and not why they were created
6:51:20
shka_
so intermiediete layer that weakly stores objects and returns those when they are available is cache by definition
6:51:43
phoe
intermiediete layer that weakly stores objects and returns those when they are and is emptiable at any time*
6:52:23
flip214
shka_: but with a weak pointer it doesn't _cache_, as in "keeps it alive when nobody else is using it to speed up next accesses"
6:52:54
flip214
with a weak pointer it only "remembers that _this_ record is around to return identity"
7:08:17
jackdaniel
nobody claimed that weak references are a must in GCed languages. small remainder: original claim: "weak structures have limited use in GCed languages" followed by a question: "do they have *any* use in languages which are not GCed?". then discussion went south witch caches and refcounting classification
7:13:33
|3b|
weak pointers in non-gc language sounds useful to me. doesn't c++ have weak pointers now?
7:24:33
jackdaniel
|3b|: but shared_ptr gives you GC by reference counting in C++, and weak_ptr is part of this machinery, no?
7:26:13
|3b|
jackdaniel: though seems sort of useful to have it for same way we would use it in GC language, for stuff that wants to keep an eye on something they don't manage, without interfering with it
7:31:39
aeth
shka_: usually when a language adds a feature it's because some niches really, really need it, even if it's of "limited use" elsewhere
7:33:54
oni-on-ion
theres a saying "everything specified in the standard should be thread-safe" i just read
7:46:01
russellw
it is said that ;; should be indented with surrounding code and ;;; should be indented at the left margin. But are there any actual usages where these give different results? In other words, is ;;; ever used other than between top-level forms which are at the left margin anyway?
7:47:07
|3b|
you can put them where ever you want and indent them oddly, it will just confuse people used to the 'common' style
7:47:42
russellw
|3b| right, I'm asking about usage in practice, because I am writing a code formatter
7:48:21
flip214
in practice it comes up to the same thing. unless the human code writer accidentally put ";;;" within some s-expression.
7:48:49
jackdaniel
it was describing general flow of the algorithm I think (not code itself). I don't remember well
7:55:27
|3b|
ACTION also notes that "top-level" isn't always far left, for example eval-when and such, where you might wrap multiple definitions
7:56:20
russellw
|3b| true. In that case, should ;;; between such top-level definitions, still be indented at the far left?
7:56:26
|3b|
ACTION would still expect ;;; for the global definitions, even if inside eval-when or a closure, macrolet, etc
7:59:47
|3b|
code reformatter has been on my list of "things to maybe do one day" for a while, but never get to it
8:02:39
|3b|
ACTION thinks a bit more and realizes caring about comments implies source probably has newlines too :)
8:03:22
russellw
beach I was originally hoping to use the built-in reader, but eventually accepted this is not going to be possible and I have to write my own. So this is mostly done at this point https://github.com/russellw/lisp-format/blob/master/read.lisp
8:05:37
russellw
ah! checking it out, looks interesting. Oh well, mine is pretty much done now, so. More duplicate work indeed :)
8:11:35
flip214
and even if it werent you could just write symbols as comments as well … you only need to be careful about punctuation ".,'" ;) oh no, now the line is wasted!
8:11:49
|3b|
flip214: i mean if you still see comments, you were starting from characters and doing something like READ rather than just getting a list
8:12:51
|3b|
(or are getting list input from someone who parsed text input and is reasonably likely to have preserved formatting along with comments)
8:20:06
beach
LdBeth: I think it won't matter much. My hunch is that the I/O is going to dominate anyway.
8:22:51
beach
LdBeth: What is it that you are working on that requires this much attention to performance?
8:25:08
LdBeth
it's a macro layer used to parse documents into lisp code and TeX, which usesthe standard reader macro.
8:28:18
LdBeth
ACTION uploaded an image: 屏幕快照 2018-09-25 上午1.27.45.png (401KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/KTeVCaRkiuDLImpRaSyzATpo >
8:40:43
beach
No, I mean, I don't see a way in the Common Lisp standard to control the size of that hash table, so if you used the standard Common Lisp reader, I don't understand how you can test different sizes unless you use implementation-specific code.
8:48:25
beach
And you do this for the sole purpose of controlling the size, or do you have any other use for controlling this aspect of the reader?
8:51:20
LdBeth
It reads lisp into tokens so something like read time eval, comments, optional evals can be preserved
8:58:38
earl-ducaine
Does there seem to be a generally prefered thead portability library? I was looking at Bordeaux Threads but I'm worried the API (at least the ql) seems to have changed quite a bit.
9:00:11
|3b|
https://trac.common-lisp.net/bordeaux-threads/wiki/ApiDocumentation appears to be current docs
9:02:29
beach
Yes, except that address calculations are exposed and the objects manipulated may be machine data.
9:03:10
|3b|
so i can just start working on codegen from the HIR, since i probably wouldn't be changing much going to MIR anyway
9:04:35
beach
|3b|: Depending on the kind of HIR you generate, you will need to generate code for array referencing, CONS-cell referencing, standard-object referencing, perhaps fixnum arithmetic, etc.
9:06:36
|3b|
ACTION 's current test function needs to pass function arguments and a literal int to 2 native functions
9:07:36
|3b|
then i need to figure out how to specify that i'm compiling the function for the native calling convention, and assemble it into something i can put in an apk file
9:08:27
|3b|
(specifying the calling convention is one of the things where dropping user/implementation declarations came up)
9:09:41
|3b|
actually, i guess i can walk up the tree of environments to find it, so maybe dropping it isn't a problem after all
9:13:37
|3b|
and possibly using specialized arrays. i don't remember specifically which things that was for, but usually when i'm optimizing i want specialized arrays anyway :)
9:14:46
|3b|
(be sure to validate the declarations first if running on other lisps or running at safety 0)
9:17:43
|3b|
hmm, i guess i have one more step at IR level, need to distinguish whether i'm compiling for native or lisp
9:20:39
|3b|
anyone have thoughts on how best to represent java's super keyword in a lisp style? (super (foo this ...))? ((super foo) this ...)? (foo (super this) ..)? (funcall-super 'foo this ...)?
9:22:11
|3b|
(if i understand correctly, super is sort of generalized call-next-method, that lets you call any method or access a slot starting dispatch with superclass instead of actual class)
9:23:08
|3b|
ACTION currently is thinking of (foo (super this) ...) as best representing what it does
9:24:20
|3b|
though you could sort of generalize it to multiple, grab classes for current method, find applicable methods for requested function, remove first entry if exact match for current method
9:24:34
TMA
|3b|: is this special? [not in (declare (special this)) but extraordinary, separately handled etc.]
9:25:15
|3b|
yeah, this is for compiling code to interact with java APIs, so i need to subclass java classes, and call methods from superclass, etc
9:25:56
|3b|
so first need to distinguish it from an intentional recursive call, and 2nd need to generate different bytecode
9:27:00
|3b|
well, currently THIS is an explicit argument in my lispy code, so generating SUPER sounds a bit off
9:27:13
TMA
not (super this) ... the latter would seem to enable you to use (super foo) for any foo, which is not the case from your description anyway
9:32:04
|3b|
ACTION isn't sure only working on some things is too much of a problem, same way you can't call call-next-method on aything that would change applicable methods
9:32:45
|3b|
also seems like it would be fairly rare, since most places could just use call-next-method
9:37:24
TMA
using super for other purposes than the equivalent of call-next-method is considered bad style even in java itself
9:40:15
TMA
[the usage super(argument1, argument2); in constructors is a (call-next-method) of sorts albeit you can choose which superclass constructor you use]
9:46:31
shrdlu68
Spec says "vector is analogous to list", so is (aref <vector> n) the same as (nth n <list>)?
9:50:31
beach
|3b|: You know that the environment is gone by the time you have an AST, so you might need to define a new AST type as well.
9:51:36
|3b|
hard to tell what needs stored where until i try to use it, so probably will be a few passes of this sort of thing
9:59:42
pjb
shrdlu68: aref is not the same as nth: (nth 4 '(1)) #| --> nil |# (aref #(1) 4) #| ERROR: Array index 4 out of bounds for #(1) . |#
9:59:58
pjb
shrdlu68: elt is like aref: (elt '(1) 4) #| ERROR: 4 is not a valid sequence index for (1) |#
10:00:30
pjb
The older NTH is nice and gentle. It doesn't rely on a condition system, it just returns NIL.
10:01:23
pjb
The newer AREF and ELT are harsh and strict. They rely on the condition system, and like to dominate and control you.
10:12:18
adlai
no-defun-allowed: "a subset", sure, there are many trivial subsets (eg, bit vector operations, "logical" integer operations, etc). the interesting question is hunting for maximal feasible subsets.
10:29:33
|3b|
hmm, maybe it does eat the declarations in a way i can't get by walking up the env list
12:31:42
hjudt
is there any lisp project that has a docker file i can look into? i'd like to deploy a project to an openshift cluster.