freenode/#lisp - IRC Chatlog
Search
16:16:11
jackdaniel
but in principle each undefined behavior trigger is an invitation for nasal daemons
16:17:49
jackdaniel
yes, but from the cognitive perspective of language, by asking: how portable is this and this means – how likely will it fail
16:18:04
jackdaniel
otherwise "bordeaux threads is a portability layer" wouldn't make much sense, would it?
16:19:20
Shinmera
Well, it does make sense, because it extends the specification of the CLHS by its own interface, thus extending what it means to be portable.
16:19:43
_death
smokeink: it is precisely for doing this kind of thing, customized pretty-printing of lisp forms
16:19:59
Shinmera
If an implementation is not supported by it, then that implementation is not conforming, making it irrelevant for the question of whether code is portable on it or not
16:23:06
jackdaniel
code which uses threads (even through bt) isn't portable if we take definition you have linked a few lines above
16:24:50
pjb
BT can only aim at covering the implementations that implement a threading extension, but not all implementation do. So writing code using threads cannot be portable by definition.
16:25:25
pjb
Your application is only portable to the intersection of all the supported set of all its dependencies.
16:25:27
_death
the clhs definition is a stipulative one.. not very good for trying to understand the common use of the term
16:25:48
pjb
Often this restricts the practical portability to very few implementations, platforms and systems.
16:26:25
pjb
Shinmera: it would be nice, but very few implementation take the pain of implementing a portability layer API. cffi, bt, closer-mop, etc.
16:27:08
pjb
Sometimes they may move slowly toward better support (eg. asdf), but there's no will to boldly implement those interfaces directly.
16:27:09
jackdaniel
Shinmera: in that case what smokeink wants may be considered his informal spec. then it works where it works. word portability loses its meaning, or indeed we agree, that this definition can't be taken verbatim in conversation proceeded in natural language
16:28:45
Shinmera
As we have already determined, there are better ways in which his actual question could have been formulated, though.
16:28:46
jackdaniel
so if you know, then saying that "it's not a gradient" was referring not to the *meaning* he used, but something what it has common term with
16:30:41
Shinmera
Just because I can leniently interpret sentences does not mean I agree with the way they were expressed.
18:13:36
pjb
For your custom-defined CLOS objects, you need to implement PRINT-OBJECT and depending on the syntax used when printing it readably, reader macros.
18:15:39
pjb
jmercouris: ie. your first reflex should have been /msg specbot clhs read-from-string RET /msg specbot clhs *print-readably* RET /msg specbot clhs prin1-to-string RET
18:32:46
rumbler31
jmercouris: You already type things like, (make-array dims :initial-contents '(a b c ...)) So if you take an array and splat its contents into a string, you can re-make this form
18:33:40
rumbler31
serialize becomes taking the contents of an array and generating the string "(make-array size :initial-contents '(real contents here))" and then calling read on the string, right?
18:35:30
_death
I'd rather communicate via json.. read-from-string is definitely not a good way to communicate with the outside world
18:38:05
pjb
incompatible float formats, bignums not supported (eg. in C), confusion between lists and vectors, a-list and hash-tables, etc.
18:38:45
_death
still you need to trust the other side, and then there's the matter of interning (which you can simplify by using keywords everywhere...) and more..
18:38:59
pjb
Not all lisp objects have a printable readably form, but at least, it's specified. (cf. chapter 2).
18:55:33
jackdaniel
sxhash isn't necessarily used in hash tables. also it is not necessarily based on address (consider moving gc)
18:56:28
pjb
For example, you could have a CL implementation that would use wool threads and a robot to tie knots in them to build cons structures.
18:58:36
jackdaniel
pjb: I'm referring to internal ECL implementation, it is in context of mentioning si:pointer
18:59:14
_death
jackdaniel: speaking of ecl, do you have any input on the two "wtfs" I mention in https://github.com/death/TIC-80 .. I didn't get to looking further into them
18:59:43
pjb
jackdaniel: well, if you're based on C, it is disputable that addresses exist. In C you have pointers (opaque) and integers, and a way to convert from one to the other, but nothing implies that integers are related to eg. a MC68000 address.
19:00:23
pjb
shka: hint: hash values are only useful for one thing, in general you are not needing them.
19:01:37
jackdaniel
_death: as of second wtf – I can help with that, but you won't have ability to load native fasls (something I plan to work on though)
19:02:06
jackdaniel
as of first wtf, I think that calling cl_shutdown and after that cl_boot should be enough
19:02:24
pjb
shka: indeed, sxhash is defined in terms of similarity which for cons cells defer to the similarity of car and cdr.
19:03:12
_death
jackdaniel: I think that's what is happening, but it's not enough.. I think something akin to lua_State would be great, but that's likely too much of a big change
19:03:15
pjb
shka: There is no conforming way to get the identity of a cons cell otherwise than the cons cell itself. And also, similarity is defined cross images!
19:03:37
shka
there is a couple of singular lists, the rest is constructed by consing into other list already existing in the table
19:04:02
jackdaniel
_death: I would have to look into it, but right now I have work in progress on delimited continuations + green threads in ECL, so that would have to wait
19:05:03
jackdaniel
if you could report issue on gitlab with description what lua_state is and what you are expecting, that would be great
19:05:47
shka
but this allows me to (when i have reference to the right list) to obtain value from hashtable, as well as do the same for every rest
19:09:52
shka
i am under impression that "[20:02] <pjb> shka: indeed, sxhash is defined in terms of similarity which for cons cells defer to the similarity of car and cdr.", which translates into recursive definition of hash
19:11:43
pjb
Well, then you will have to use a CL hash-table to map cons cells to unique identifiers that you can use in your own hash function.
19:12:10
pjb
Perhaps some implementations let you find the address of a cons cell (but as noted, if they have a moving GC, the address will change).
19:12:23
pjb
clisp can be compiled to provide a third slot to each cons in which you could store a unique identifier.
19:13:17
pjb
Notice also, that for hash-table with equal or equalp most implementations won't compute the hash on all the elements of the list, but use a projection such as list length, hash of the first and last element.
19:14:56
pjb
Or imagine an implementation storing cons cells by drawing them on paper, and following the links with a camera: https://www.youtube.com/watch?v=Mp8Y2yjV4fU
19:17:00
pjb
sometimes, you can use a (defstruct kons car cdr key something-else) and build your lists (copy CL lists) using that.
19:22:52
pjb
so you build a spinal cord: (defstruct box cons key) (let ((k 0)) (maplist (lambda (c) (make-box :cons c :key (incf k))) '(1 2 3))) #| --> (#S(box :cons (1 . #1=(2 . #2=(3))) :key 1) #S(box :cons #1# :key 2) #S(box :cons #2# :key 3)) |#
20:55:16
rumbler31
pjb: in your example output, does the #1= and #2= mean that subsequent uses of #1# and #2# refer to eql cons's, not just identical in contents?
21:01:17
dwts
Hey guys, does anyone know why the first part of the code works while the second one doesn't?: https://codepaste.net/gisfzt
21:33:41
Bike
dwts: yeah looks like the general use is for the values to be strings. `word` there is of course a symbol, not a string.
21:34:58
Bike
there's a function, but in this case i imagine the problem is that you're not actually using a variable.
21:41:14
Bike
it's not that important. instead of the compiler, you have me telling you you made a mistake. artificial artificial intelligence, it's called
21:41:45
Bike
you understand, right? you quoted `word`, so it's not evaluated, so the argument isn't used, drakma only sees the actual symbol WORD
21:45:40
dwts
Bike: yep, that did the trick! Also type-of looks helpful if you are unsure what you are passing to your functions I guess
22:58:11
mrottenkolber
spreadable argument list designator n.: a designator for a list of objects; that is, an object that denotes a list and that is a non-null list L1 of length n, whose last element is a list L2 of length m (denoting a list L3 of length m+n-1 whose elements are L1i for i < n-1 followed by L2j for j < m). “The list (1 2 (3 4 5)) is a spreadable argument list designator for the list (1 2 3 4 5).”
22:59:33
mrottenkolber
so if a spreadable argument list designator is a “non-null list L1”, that means nil is not a valid s a l d, right?
23:06:19
mrottenkolber
I seems to indicate that (apply 'list '(1 2 3 (4 5))) ≡ (apply 'list '(1 2 3 4 5)) which is luckily not true on i.e. CCL
23:11:58
mrottenkolber
the + led me to believe apply would accept one or more spreadable argument list designators
23:14:25
pjb
mrottenkolber: but you have to remember that &rest gets a list of arguments, so when the spreadable argument list designator takes for example (1 2 (3 4 5)) it means that the function was called with the rest arguments 1 2 (3 4 5) like this: (apply 'list 1 2 '(3 4 5)) for example
23:51:29
k-stz
is there a protable way to translate a c array to a lisp array, or can I just leave it in its cffi SAP form? Efficiency actually matters in this case
23:57:48
k-stz
I'm not sure what counts as keeping it around. As its set up to be I have to use it multiple times. I'd have to test it
23:58:21
pjb
But remember that you have to free C data yourself (unless you use a underlying C garbage collector such as the BoehmGC.
23:58:41
pjb
k-stz: if you only need to access the elements of the C array once, there's no point in copying it.
0:02:47
pjb
You may want to optimize safety and ease of use; lisp data is easier to use than foreign data.
0:04:01
dwts
mrottenkolber: is there an alternative that returns same results across implementations?
0:06:01
k-stz
But also the idea to make a lisp-array from pointer data sounded mildly exciting ;), so I thought it made by even a common thing to do!
0:06:44
pjb
It's only that it's slow. So you need to be able to amortize it, if your purpose is to optimize execution speed.
0:07:13
Bike
it basically amounts to making a lisp array of the length of the c array and copying the c array contents (translating as you go)
0:07:58
mfiano
dwts: The author of Common Lisp Recipes gives an example, `(type-of "foo")`, giving 4 different results across 6 different implementations. To be portable, you probably want to check for an explicit type/subtype with TYPEP/SUBTYPEP, or perhaps someone more familiar can give more help.
0:09:08
k-stz
Bike well just have lisp use the exact addresses pointed to, not freshly allocate an array
0:09:30
Bike
but it's a c array. lisp arrays have type information and stuff. and can be garbage collected.
0:13:03
dwts
I was wondering, is anyone here using common lisp at work? I've only used scheme (in the past) common lisp (now) for some toy projects
0:16:52
dwts
Xach: Given that there aren't many (to my knowledge) common lisp positions, how many years of experience one would require to get a senior common lisp position?
0:20:19
Xach
There are CL projects in many companies, but they are not often made public. They are often the work of enthusiastic individuals who really want to use Common Lisp and have some discretion at work. That might be because they are founders or just given a lot of independence.
0:22:19
Xach
Before I did contract CL work, I used CL to write tools to make life easier in various ways - to process or generate data, or to generate code for tools in other languages.
0:22:20
dwts
Yeah, I've noticed that you can't get much info on that subject. Apart from a few companies that were using common lisp and then turned to python/whatever it's really hard to get any info
0:24:32
Xach
dwts: rob warnock has written quite a bit on the topic. he uses the CL pretty-printer in nice ways to generate code.
0:27:13
Xach
here's a small bit: https://www.xach.com/rpw3/articles/mbudnVpUvZKbC8XVnZ2dnUVZ_vudnZ2d%40speakeasy.net.html
0:28:58
dwts
Xach: this kind of info make lisp's power look unlimited...or only limited to one's imagination
0:39:56
mejja
(format t "~%foo_t ~a_foos[~d] = {~ ~%~{~<~%~1,68:; {~/0x/, ~2/0x/}~>~^,~}~%};~%" instance (/ (length data) 2) data))
0:42:28
dwts
Xach: how feasible do you think it would be to write a linter in common-lisp? I was thinking about a chef linter
0:43:45
pjb
Very feasible: https://www.google.fr/search?client=safari&rls=en&q=common+lisp+lint&ie=UTF-8&oe=UTF-8&gfe_rd=cr&dcr=0&ei=qHYTWq3jGrGJgAborLiQAQ
0:46:02
aeth
mejja: format takes in streams, so you can break it up into smaller parts and even mix non-format writing/printing things in as well
0:46:53
aeth
(only format nil would make this hard, but you could use with-output-to-string instead to generate a string that way)
0:49:53
aeth
mejja: Here's an example (but, of course, this is a toy example and I wouldn't break this up): (progn (format t "Hello, ") (format t "world!"))
0:51:24
mejja
code snippet is from the link pasted by Xarch a page up. original author is Rob Warnock not me..
0:55:46
aeth
mejja: if it ran (it doesn't!) and if Lisp Paste was still up, I'd try to make it more readable
1:00:19
aeth
If you want to see a completely different approach to generating C-style syntax, I generate a subset of GLSL (which uses C-style syntax) recursively here: https://gitlab.com/zombie-raptor/zombie-raptor/blob/79ba7be2b51ca8992c453490fb9a7bb109027818/data/generate-glsl.lisp
1:03:05
aeth
It's not very efficient because it recursively returns strings generated by format nil, but it runs while compiling to produce constant strings so I don't really care about performance. If I had to write it today, I might consider a with-output-to-string stream instead of returning and concatenating strings.
3:49:04
mfiano
just ask your question, and understand that 'clisp' refers to an implementation, and not common lisp the language