freenode/#lisp - IRC Chatlog
Search
11:04:54
dim
is it safe to conclude they already had copy/paste at the time when writing the spec? ;-)
11:53:14
pjb
So it probably pre-existed unix ed, after all, unix is but a simplified clone of older systems and software…
12:51:05
pjb
shka: you have to look at early computers. Later, punched cards were copied first on an input spool tape (using a secondary computer), before being fed to the mainframe.
13:56:41
pjb
shka: the thing is that they were built with strong material. Like 5 mm steel. Just like a tank!
14:06:30
Josh_2
In On Lisp there are two examples as shown in this paste http://paste.lisp.org/display/358509 where one function takes a variable x as an argument to a function and that variable is considered bound, and then another example which takes the variable n as an argument to a function but that variable is considered free. This seems contradictory, is it?
14:08:46
mxb
Hi all. Anyone have experience with binary-types package? I'm struggling to try to define a binary-struct which references an earlier field and I'm not sure if it's possible to do so. (Basically parsing {type,length,data[length]} blobs
14:09:11
beach
Josh_2: Because it is used in a function, but it is not a parameter of that function.
14:11:44
mxb
phoe_: I'm learning binary-types with PNG file format - my code is here http://paste.lisp.org/display/358510
14:12:08
mxb
PNG spec is here if it helps: https://www.w3.org/TR/2003/REC-PNG-20031110/#5Chunk-layout
14:13:43
phoe_
I never used binary-types myself, but hopefully someone up there can take a peek at your code.
14:14:45
mxb
phoe_: yes, during macro expansion of define-binary-string size is LENGTH, which is not of type (INTEGER 1 *)
14:21:32
phoe_
Since this a macro, then SIZE must be an integer before its evaluated - so it cannot be a variable.
14:22:00
Bike
oh, so this isn't gigamonkeys's? i'm pretty sure his could do that, since it's so common for binary formats
14:23:47
mxb
phoe_: Yes, it seemed like there are signed/unsigned binary integer types, and 'strings', which I took to be arbitary lengths of data
14:26:09
Josh_2
I don't particularly understand lambda calc just like I don't understand normal calculus. However I found this sentence "The abstraction operator, λ, is said to bind its variable wherever it occurs in the body of the abstraction."
14:27:06
Josh_2
I'm sure if I put some serious effort in I could learn some Lambda calc just like I could with normal calculus
14:27:12
Bike
well, and i suppose integration and differentiation can involve binding variables and so on
14:27:28
beach
Josh_2: The concept of free variables is very important to the compiler writer, because, in general, they can't be treated as simply as bound variables can.
14:28:13
phoe_
And I'm sorry that I can't help in this case. Maybe the library Bike suggested can deal with that.
14:33:32
phoe_
I wish I had a #lisp full time job so I could spend all of my time and all of my attention on refining CL documentation and libraries. There's so much to be done in Common Lisp world and I am doing corporate dung instead.
14:34:53
Josh_2
Save some money, buy a van, live in the van using mobile internet and a laptop for 6 months of the year.
14:37:38
Josh_2
Well I have a motorcycle so takes me 10 min to get to Uni. I guess you went to a much better Uni than mine if you need to prep for a class
14:38:17
phoe_
Just doing homework takes time, and sometimes there's a lot of homework needed before I get some programming or math concept.
16:10:51
Bike
you could also define a package that shadows cl:close; might or might not make sense for you
16:12:56
phoe_
or make your defcfuns inside a different package that either does not :use CL or shadows it CLOSE symbol
16:21:34
jackdaniel
if test *evaluates* to true, true is evaluated and result of this evaluation is returned
16:29:58
Josh_2
dlowe: I gave (set t nil) a shot and got Simple Error Veritas Aeterna or Eternal Truth
16:35:38
Bike
huh, define-symbol-macro isn't defined to have any compile time effects. weird oversight
16:59:54
Bike
no, sizeof is not an operator available at runtime. you can use something like grovel to keep that information
17:15:52
phoe_
when you dereference a pointer, you tell CFFI what you expect to have underneath that pointer - if it's an int, a float or a structure of type X
17:16:24
emaczen
phoe_: Ok, I think I see my mistake in reading the C code then -- that makes sense too
17:16:31
phoe_
you don't declare the type when you grab a pointer, you declare the type when you dereference it.
17:17:54
phoe_
pointers are simply numbers after all, uint32 or uint64 depending on architecture. CFFI uses exactly this philosophy.
17:18:34
osune
while we are at CFFI, somebody knows a library for libevdev? I still have quite a hard time to wrap my head around cffi to do it myself but if there is nothing I'll have no other option then to do it myself
17:18:37
Bike
i'm not sure if a c implementation is allowed to use different representations for different pointer types
17:20:37
jackdaniel
cffi store more exact information about pointer type, but what implementation gets is indeed just :pointer
17:21:29
phoe_
jackdaniel: a pointer is a value, a memory offset, which is a number - am I wrong here?
17:22:43
Bike
you can allocate a block and use arithmetic on pointers in that block, but as soon as you go outside it's UB land, iirc
17:25:06
jackdaniel
but if it were just a number, than uint foo = my_ptr; foo++; my_ptr=foo; should yield in the same thing as my_ptr++
17:25:59
jackdaniel
but if it doesn't, you come into bigger trouble. so there is a good reason for error ;)
17:26:20
dlowe
jack_rabbit: uh, not true. The amount my_ptr is incremented depends on the size/align of the underlying type.
17:30:18
jackdaniel
also I'm not sure, but I have a suspiction that there is no mention in C standard, that pointers are numbers at all
17:31:41
dlowe
but yeah, the only guarantee is that you can cast a pointer to a number and back and get the same pointer
17:34:56
jackdaniel
well, you can't (portably), because you don't know if pointer will fit in any integer you have
17:40:37
tax
does having multiple namespaces in common lisp yield a major benefit over lisp-1 languages? why do even popular industry languages like clojure use/choose a lisp-1? seems like namespaces would be useful. what am i missing or not understanding?
17:41:20
_death
pointers are numbers in the same sense that "everything is a number".. what is usually meant is that they can be represented as numbers.. there are some gotchas for the unwary, though.. for example the null pointer (0) may not be represented as all-bits-off numeric zero
17:41:41
phoe_
tax: lisp-1 languages are usually pretty heavy on functional programming, and Clojure is not an exception here
17:42:39
phoe_
CL has multiple namespaces actually - variables/symbol macros, functions/macros, classes/conditions/types, restarts... and the user can create and define their own ones
17:44:12
phoe_
when you're heavy on functional programming, you might want to use a shortcut where e.g. FOO always means a function
17:46:05
phoe_
(defun ensure-list (list) (if (typep list 'list) list (list list))) <- hey, that's five LIST symbols next to each other, not counting parens and quotes
17:47:21
phoe_
but then again, I'm not a Schemer - I'm used to CL so I can mostly tell you the CL viewpoint.
17:48:38
phoe_
dlowe: write a blog post about it and post it on /r/lisp so we can reference it for the future.
17:55:41
Bike
check it, i googled "python optional" and this appeared http://www.diveintopython.net/power_of_introspection/optional_arguments.html
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.