freenode/#lisp - IRC Chatlog
Search
18:04:37
emaczen
I keep getting this error: The value (S-ADDR 31235) is not of the expected type CCL:MACPTR. -- http://paste.lisp.org/display/358528
18:04:58
emaczen
I have no idea why, the slot wants a :uint32 and that is exactly what inet-addr returns
18:05:23
sjl
or are you just saying use &rest and manually process the arglist in the function body myself?
18:07:22
Bike
so you could use foreign-slot-pointer to get a (:pointer (:struct in-addr)) instead, and then get the s-addr from there
18:07:24
_death
sjl: anyway, python also has thing sillyness of evaluating the default forms once at definition time, no?
18:07:48
emaczen
Bike: I just changed the inner cffi:foreign-slot-value to cffi:foreign-slot-pointer
18:08:21
pjb
So it really has optional parameters, and keyword parameters, etc, just like CL. You just need to implement a library using stdarg.h
18:09:32
SaganMan
ohh, just googled https://stackoverflow.com/questions/19212040/how-can-i-make-a-function-with-optional-arguments-in-c
18:11:07
SaganMan
but pjb, can all arguements in a fuction of C be optional? don't you get "too few arguements"
18:12:04
pjb
SaganMan: of course, you need to have a way to indicate the actual number of arguments.
18:17:17
pjb
_death: CL functions can return multiple values, so you cannot use result=f(), but you have to use f(…,&results)
18:17:33
_death
pjb: the caller builds up the &rest list.. you could then define one function to call them all, apply(symbol("add"),list(...))
18:18:09
pjb
So you have to write: list(3,number(3),number(2),number(1),&results); apply(2,add,results[0],&results);
18:21:01
Xach
phoe_: do you understand the problem in http://report.quicklisp.org/2017-10-12/failure-report/asd-generator.html#asd-generator?
18:30:46
haom
hello, what is the way to format variables into strings by their names, like "My name is $name." => "My name is Mike."
18:42:53
pjb
Lisp in Small Pieces http://pagesperso-systeme.lip6.fr/Christian.Queinnec/WWW/LiSP.html http://pagesperso-systeme.lip6.fr/Christian.Queinnec/Books/LiSP-2ndEdition-2006Dec11.tgz
18:42:57
emaczen
You can find several and I think pjb is referencing John Mccarthy's original paper, which is on that site too
18:43:19
_death
aeth: no, it is modelled on principle of Lisp - use Lisp conses and atoms for structured information
18:44:02
emaczen
http://paste.lisp.org/display/358528 -- see anything wrong with my defcstructs? I'm getting ERRNO=47, EAFNOSUPPORT
18:44:09
aeth
_death: Your out example looks like `cout << "My name is " << name << ".";' except more concise because you don't need to use <<s
18:52:55
phoe_
Xach: the freshly cloned github.com/phoe/asd-generator compiles on my machine on ASDF 3.2.0.1
18:58:32
rumbler31
Xach: my machine crashed while I was in the middle of running update-all-dists. It was in the middle of downloading updated packages so I'm pretty sure it didn't finish. Is there a way to "restart" this process?
19:03:57
_death
aeth: here's another example, introducing a "recent" addition for printing hash table contents.. (let ((ht (plist-hash-table '(two 2 forty-two 42)))) (outs (:dc (:h ht (k v :separator ", ") k " => " v)))) ==> "two => 2, forty-two => 42"
19:09:49
Bike
emaczen: though i guess this might not be the right sockaddr_in definition for your system
19:15:09
emaczen
Bike: One second, I just googled a bunch of types, made some changes and am testing
19:22:18
pjb
emaczen: for now, the pre-processor is implemented, it should be usable to get the #defines.
19:23:46
pjb
for typedefs, you'll have to wait implementation of the compiler. Or use something like swig/cffi, but it is very deficient.
19:24:38
emaczen
This is really helping me with CFFI, once I get this to work I may give objc OpenStep a crack
19:26:06
emaczen
At least I can deal with C this way... recompiling just to see a different errno and writing so much code just to do that!
19:33:23
pjb
emaczen: CFFI is ok, it's the various ways to parse C headers and generate CFFI code that are wrong.
19:34:12
pjb
Mostly, because they can't deal with all the specificities of C headers. Eg. #pragma pack are ignored.
19:39:07
emaczen
struct sockaddr_in { __uint8_t sin_len; sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; char sin_zero[8];};
19:45:22
emaczen
_death: yes, I know that works it returns 2 which is what AF_INET is #defined to be
19:52:19
_death
it's possible that the layout you describe doesn't match your system's layout.. grovel may be useful here. some quick checks you may try: comparing the struct sizes, offsets for each slot, or simply printing out filled instances that are supposed to be equivalent in both languages
19:54:26
emaczen
_death: Once I get this to work, I'll try it because I do want this to work on different Linux machines too
19:55:32
_death
or come up with a simpler interface and implement it in C.. unless you're actually going for sockets, and then - why not use the one defined by your implementation?
21:14:26
Xach
phoe_: i suspect you need :verbose t to see the warning. it is clear that the code is wrong just by looking at it.
21:15:51
Xach
https://github.com/phoe/asd-generator/blob/master/asd-generator.lisp defines all-pathnames with one arg and then immediately calls it with two.
21:23:14
phoe_
yes, this is a valid issue. I raised https://github.com/phoe/asd-generator/issues/7 on the person who wrote this code, I hope he responds tomorrow or the day after.
21:24:34
phoe_
Okay - I'll try to fix it on my own if the person doesn't respond tomorrow or on Sunday. Deal?
22:10:32
p_l
bigos: CommonQT does, as does EQL (ECL-specific). Some of the GTK interfaces, if you get them to run, should work cross-platform
22:11:31
bigos
i Looked at it on Linux and was impressed, the problem is I can't install QT on windows
22:19:47
bigos
p_l: none of the GTK interfaces worked, I had most success with cl-cffi-gtk, but its github page admits it crashes when you try to move the window
22:20:55
p_l
bigos: I think all are pretty much abandoned by now except for GTK backend of Common Graphics, and that's proprietary to ACL
22:21:34
p_l
ACTION would honestly expect franz's clim to build better than any of the GTK interfaces
22:22:44
bigos
ceramic failed to install, at some point i got message that something failed to compile on Linux, I did not try it on windows
22:23:16
shrdlu68
I've never bothered to check this, how much is the cheapest of the commercial implementations?
22:30:12
bigos
qtools failed on ccl and sbcl on windows, i was trying to follow example from https://github.com/Shinmera/qtools/blob/master/examples/helloworld/helloworld.lisp
22:32:26
Shinmera
Can you restart the REPL and then just do (ql:quickload :qtools-helloworld) followed by (qtools-helloworld:main)
22:32:51
Shinmera
Simply copypasting things in that file isn't going to cut it because of the dependencies.
22:34:24
Shinmera
If you want to follow an example and not just run one, follow the documentation. https://shinmera.github.io/qtools/
22:37:30
Shinmera
Anyway, it's like past midnight here and my eyes feel like they have thicker crust than bread that's been baked for ten years.
22:37:51
Shinmera
If you encounter any other problems, write an issue ticket on github, or hope people here will be able to help you.
0:22:19
sjl
none of these restarts look like they'll give me a stack trace so I can try to figure out what actually went wrong http://paste.stevelosh.com/59e158a6ee0a0000081b25a1
0:42:16
psilord
Hello there, I have a small question: Common Lisp Recipies basically says not to use type-of since it is inconsistent between implementations. But, if I use it like this (typep instance-of-thing (type-of instance-of-thing)) will I always get the expected T from that test?
0:43:51
psilord
and, if I do (typep instance-1 (type-of instance-2)) I should get T or NILL that is correct on all implementations?
0:45:07
psilord
The domain of the types themselves will be CLOS object type names defined with defclass.
4:41:46
emaczen
iqubic: for &optional and key you can supply a third argument like (param default supplied-p) and check supplied-p if it was supplied or not
4:41:59
Bike
(defun test2 (&optional (o nil o-p)) (values o o-p)), then (test2) => NIL, NIL while (test2 nil) => NIL, T
4:45:33
Bike
lisp has multiple namespaces, and two of the more important ones are for variables versus for functions
4:46:08
Bike
in (f 1 2) it's looked up as a function, which is a separate space, so i tdoesn't care about the setq