freenode/#lisp - IRC Chatlog
Search
14:19:34
flip214
on SBCL, a call to (SB-BSD-SOCKETS:GET-HOST-BY-NAME x) with x being (VECTOR CHARACTER 20) gives an error: #<SB-KERNEL:CASE-FAILURE expected-type: (OR NULL (ALIEN (* CHAR)) SIMPLE-BASE-STRING SIMPLE-STRING)
14:23:21
Shinmera
jdz: I'll be in Japan around September, though I expect that'll be too far off for you to have a little lisp meet?
14:23:58
Shinmera
In other news, Trial is back up on its feet and I can play around with live GL coding again, woo woo. https://filebox.tymoon.eu//file/TVRVeE5nPT0=
14:27:18
flip214
can somebody tell me in short, easy words the effective difference between SIMPLE-STRING and (VECTOR CHARACTER)? Apart from being "different" types, that is.
14:27:42
Bike
a (vector character) could be non-simple, for example being displaced or having a fill pointer
14:29:05
flip214
hmmm, I guess that's the reason -- the VECTOR might be displaced to the original file data
14:34:44
Bike
Simple arrays and displaced arrays are totally different sorts of objects on SBCL. The underlying code to access them is distinct. So code can be written that works on only simple arrays.
14:44:45
flip214
Bike: but does this distinction make _any_ sense for (SB-BSD-SOCKETS:GET-HOST-BY-NAME x)?
14:45:46
Bike
Beats me. But it wouldn't be a change to check-type or how it's invoked, it would be a change to get-host-by-name.
14:45:47
flip214
well, what I'm trying to say is that some CHECK-TYPEs should include other possible STRING-related types.
14:46:22
Shinmera
The suggestion should be more that the function should automatically coerce to simple-string.
14:48:10
Shinmera
simple-strings have a nice property in that they can be shared directly with C in a lexical context by pinning.
14:55:34
scymtym
coercing automatically at the high-level interface instead of forcing the user to do it sounds good to me
15:07:17
comborico1611
Yeah, that was just a test. Trying to learn how to print a string of symbols without being contained in braces.
15:12:30
comborico1611
Yeah, I just looked up the answer in teh book. I see. I must also be half asleep, because I thought I posted this in the #clnoobs
15:46:54
easye
Sorry if I missed it, but <http://www.european-lisp-symposium.org/> is down and not coming back?
18:57:53
pjb
comborico1611: have a look at: http://informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/rpsls/index.html
20:14:10
Bike
why do you want to do that, and why do you want to do it with a macro? Could you provide context?
20:18:35
fafff
in C for example I could do stuff like like this, replacing a keyword with blocks of code
20:19:19
Bike
that's because C macros are textual. Lisp macros are more involved in the actual syntax.
20:19:51
Bike
You can put a macro form where you'd put any other expression, but a macro form ccan't be multiple expressions.
20:20:22
Bike
It's likely there's a way to avoid repetition like you want, but it's hard to say how with so little information.
20:27:10
__rumbler31
to be fair, I don't fully understand what he's trying to do, but I should have qualified, if you need a macro to return multiple forms, you use progn
20:27:54
Bike_
you could use a function that returns multiple values, or a macro replacing map, or any number of things
20:28:14
Bike_
which is why i asked what they're doing more specifically so i could maybe pick which direction seemed best
20:30:23
__rumbler31
I was confused about the context of the discussion at hand, so "at the time I was speaking about what I thought was a more general discussion"
20:52:36
pjb
fafff: you can write (map 'list (lambda (x y) (+ x y)) (k1)) on the condition of wrapping it into a normal (operator argument) form.
20:53:23
pjb
then you write the with-k1 macro, to analyse the sexp (map 'list (lambda (x y) (+ x y)) (k1)) and replace it with (map 'list (lambda (x y) (+ x y)) l1 l2)
20:54:42
pjb
fafff: now, if you have a list of list, for example returned by a function f1, you can write (apply (function map) 'list (function +) (f1))
21:05:47
pjb
But it may be a little violent. You may want to use a code walker to interpret (k1) correctly: (with-k1 (list (k1) (labels ((k1 () 'foo)) (k1)) (k1))) only the first and last (k1) must be substituted, the (k1) in the middle refers to the function k1 defined by labels.
21:47:27
stylewarning
"you may want to use a code walker" ;; people always suggest this, but is there actually a usable code walker out therE?
21:57:29
attila_lendvai
hu.dwim.walker is ours, and it was used in non-trivial applications (uses contextl for fine grained customability)
22:05:26
Shinmera
You can say (:pointer type), but it's equivalent to :pointer as it doesn't do anything with it.
22:05:44
pjb
stylewarning: AFAIK, the only implementation that has an implementation specific special operator is sbcl. This is the only #+ you need in a code walker.
22:07:53
pjb
Ah, there's also: (ccl:nfunction) and in clisp, cl:function is used with an extension (a second parameter).
22:08:13
pjb
But as I said, it's no problem if the code walker provides its own set of standard CL macros.
22:10:40
pjb
Implementation specific special operators (without a corresponding macro) would be particularly problematic if used in implementation specific macros (in extension packages).
22:57:22
emaczen
Shinmera: I'm having trouble arefing a foreign pointer/array the type of the array is an opaque type just defined like: struct name;
23:04:22
axg`
maybe you can define it as an alias to *void? types aren't "allocated" when defined beyond as data within cffi/the c compiler
23:07:52
emaczen
the C code initializes the pointer like: type **name; and then passes it in the function call via func(&name)
23:11:19
Bicyclidine
you have no addressof in lisp. if you want to pass a pointer you have to allocate a pointer
23:11:44
Bicyclidine
cffi doesn't really care about the type beyond knowing that it's a pointer, though
0:07:53
pjb
Shinmera: I wouldn't be so categoric: pointers can have different sizes. eg. in MS-DOS. But also because you may have pointers to different type of data requiring more or less bits.