freenode/#lisp - IRC Chatlog
Search
22:07:31
sjl
could add a key parameter to package-nicknames: (package-nicknames "org.xach.mycoolpackage" :local-to (find-package "some-package")) => ("mcp")
22:18:31
jeosol_
sukaeto: you are using clack for this? anything else I need to use this nginx config file.
22:21:46
sukaeto
jeosol_: yeah, it's just clack. If you're not using docker, you'll have to come up with some scheme for assigning ports to the workers (and supervising them)
22:22:29
jeosol_
I haven't done anything, so I can use whatever works to get me to get an AWS instance working
22:22:35
sukaeto
(of course, replace "worker1", etc with the container names, or localhost if you're not using docker)
22:24:11
jeosol_
While I have used hunchentoot, have not used it with nginx. Haven't used Clack at all. So some learning to do on my end.
22:29:59
didi
So reading about dynamic extend, I got an idea: If, when using FFI, instead of messing with the GC, we declared the alloc'ed variables with dynamic extend and cleaned them just before leaving the block?
22:32:54
jeosol_
@sukaeto: you are saying with docker, the assignment of ports to workers is handled if I am using docker?
22:34:00
sukaeto
jeosol_: the docker containers themselves have their own own "port space". They're kind of like mini guests on the host
22:34:22
sukaeto
so yeah, you can have all the workers just listen on the same port and there won't be any collisions if they're each in a different container
22:35:55
jeosol_
I see, I admit I am not a docker expert. I will have to read up on this. Thanks for the explanations
22:36:54
didi
stacksmith: Well, many alien libraries have functions like `make-widget', which malloc memory.
22:37:42
stacksmith
didi: I have a macro "with-foreign-vals" that makes an environment with allocated foreign values. Like (with-foreign-vals (:int16 x :int16 y :int16 width :uint16 height) ...) I use it all the time for ad-hoc cffi allocations.
22:38:43
didi
stacksmith: Cool. I struggle with the idea of wrapping these variables because I want to feel like programming in lisp, even if I'm calling foreign functions.
22:41:47
stacksmith
didi: you could actually do what you described, but I prefer - at least during development - to be able to create a window with widgets, say, and return to REPL...
22:44:34
didi
stacksmith: I know what they are, but never used them. Well, except for non-local exits.
22:46:49
stacksmith
didi: I've never used any built-in ones, but sometimes it feels really great to turn a program inside out... Like say an image viewer that decodes as many bytes as you send it and returns instead of a loop that takes over and blocks...
22:50:06
didi
stacksmith: Well, you don't need continuations for that. You can use threads. Unless you want green threads, AIUC. I've being writing a library for concurrency programming for a while, that abstracts away from threads, but I've being stuck.
22:52:03
stacksmith
didi: I am always dealing with deeply nested trees, and I wind up wanting to do something deep inside on a branch. I could send a lambda, but it can only do so much. With continuations, I could make the code stop where I want and return. Then I can do things like bind some variables and go back in for the rest of the branch.
22:53:58
didi
Bike: I dunno. Good question. Maybe it can be used. But the more high level question is: Should the alien variables feel like lisp variables that can be GCed or not?
22:57:00
stacksmith
I thing by GC didi means just getting rid of it properly at some point in the fugure.
22:58:33
stacksmith
There was an idea of keeping foreign variables on the stack and having them go out of scope naturally, I believe.
22:59:31
didi
Maybe not in the stack. The "dynamic extent" has more to do with the idea of an object being valid just inside the block.
23:06:07
smokeink
jeosol: I'd recommend lighttpd over nginx (I had some issues in the past with its config files , its config script language it's one of the dumbest I've ever seen) . Some notes here: http://dpworks.net/miscellanea/mod_lisp-lighttpd.html , http://pastecode.ru/8d5d29/
23:09:17
stacksmith
Bike: I think the reason I wrote with-foreign-vals is because I allocate/free a single foreign object containing all the foreign values specified...
0:05:24
johnnymacs
It basically lets you have multiple namespaces so you can re-use symbol names for shorter code
0:07:13
jasom
johnnymacs: variable and function names are actually not strings in lisp, but rather symbols. You can create a unique symbol with a given name in any package, you can import symbols from one package to another, and you can even create symbols that are not in any package at all.
0:07:44
jasom
The last one is useful for writing macros; you can create brand new symbols with readable names that are guaranteed to not be used anywhere else in the code.
0:08:24
fouric
Does anyone know of a Common Lisp project in a GitLab repository with successfully running CI that I might be able to take a look at?
0:09:06
jasom
johnnymacs: all of the symbols defined in the common lisp standard are in the "COMMON-LISP" package, which has an alias of "CL" so e.g. "cl:print" will always refer to the standard print, while "print" will refer to whatever symbol is named print in the current package.
0:26:13
johnnymacs
https://github.com/search?utf8=%E2%9C%93&q=integration+language%3A%22Common+Lisp%22&type=Repositories&ref=advsearch&l=Common+Lisp&l=
0:28:22
fouric
I don't know if it's incompatible with GitHub's, but that's partially because it's really hard to search for repos with CI set up
0:28:35
fouric
if someone more knowledgeable than I tells me that they're interchangable, then I'll believe them
0:34:42
johnnymacs
there could be continuous integration that is setup for git that is agnostic to gitlab or github
0:44:41
johnnymacs
I think what you are trying to say is that lisp handles the reference passing automatically
0:45:38
Bike
it's not like C where you can have things and then you can have pointers to things, and so on.
0:48:33
onion
i think he is just looking for how to 'reference' an entry of a hash table ? why complicate?
0:49:30
Bike
Okay, if you want implementation details, here's the thing. Common garbage collection strategies rule out the use of pointers by the programmer.
0:49:53
Bike
"copying" GCs move objects around in memory, which means pointers would stop working fast.
0:50:47
onion
ie not passing a "whole object structure" to functions as what we can do with C without pointers
0:51:14
fouric
johnnymacs: Yeah, but there's already an FFI (actually, several - to C, C++, Python, and maybe a few more), and none of them needed malloc() written - modern implementations provide ways to do that.
0:53:46
johnnymacs
Other people are getting confused about my support question when my question is already answered
0:55:55
onion
i would definately ask "whats a ref to a hshtbl" but we like to talk about lisp also, so =)
0:59:04
didi
"In Common Lisp, a data type is a (possibly infinite) set of Lisp objects. Many Lisp objects belong to more than one such set, and so it doesn't always make sense to ask what is the type of an object; instead, one usually asks only whether an object belongs to a given type. The predicate typep may be used to ask whether an object belongs to a given type, and the function type-of returns a type to which a given object belongs. "
1:11:08
onion
how are there types that are not classes, if 'everything is an instance of a class' ??
1:11:28
sjl
The thing that helped me most with types was when I started thinking about them as sets of values.
1:12:27
sjl
E.g. the type designated by `(integer 1 10)` is the set of integers from 1 to 10. The type designated by `(or integer list)` is the set of all integers unioned with the set of all lists.
1:13:50
sjl
When you make a class, Lisp also helpfully defines a type for you with the name of the class, which means "the set of objects that are instances of this class (or a subclass of it)"
1:14:13
sjl
But it does muddy the waters if you're not used to thinking of types as sets of objects.
1:16:43
Bike
also conveniently explains why you can't specialize methods on types, because types don't have enough structure for ordering.
1:17:34
sjl
Thinking of them as sets also makes subtypes and supertypes easier to understand. E.g. bit is a subtype of integer because the set {0 1} is a subset of the set of all integers.
1:21:49
onion
sjl: yeah, i ve been mentioning deftype a few times this week. i didnt know CL had that !
1:21:56
sjl
This also demystifies the Haskell/Scala "when is a particular function type a subtype of another" that takes blog posts like https://www.stephanboyer.com/post/132/what-are-covariance-and-contravariance to explain
1:24:02
Bike
the way function types are defined, they're not like other types in referring to a set of objects
1:24:53
sjl
(function (vector) integer) is a subtype of (function (string) number) because it accepts a superset of the arguments, and returns a subset of the results
1:25:22
sjl
Is (function (vector) integer) not "the set of all functions that accept a single argument, which is a vector, and return an integer result"?
1:26:05
Bike
like if foo is declared to be a (function (vector) integer), that's like rewriting (foo bar) as (the integer (foo (the vector bar)))
1:27:26
sjl
> list form of the function type-specifier can be used only for declaration and not for discrimination. Every element of this type is a function that accepts arguments of the types specified by the argj-types and returns values that are members of the types specified by value-type.
1:27:28
Bike
which means, say, that (except package restrictions) you could locally declare CAR to be of type (function (cons) t), even though (function (cons) t) is not a subtype of (function (list) t)
1:29:13
sjl
CAR *is* a member of "the set of all functions that accept cons arguments and return t elements"
1:30:56
sjl
I think it hinges on whether you consider "accepts an argument of type X" to mean "accepts an argument of EXACTLY type X"
1:31:17
Zhivago
Ah, not because of ordering, but because specializing on type gives you fundamentally incoherent semantics.
1:31:23
Bike
well, since you obviously can't actually use function types as a membership thing, it doesn't matter so much to me.
1:31:47
Bike
one time i thought too hard about this and decided that lisp types mean at least three different things that are mildly incompatible, which is why it's confusing.
1:32:02
Zhivago
It means that your operation is really multiple operations with different semantics which are conflated.
1:32:06
sjl
sure, yeah, whether the computer can actually *figure this stuff out* is a different story, and unfortunately the answer is usually no
1:32:34
Bike
i don't mean the compiler. i mean you can't do (typep foo '(function ...)). i'm not even sure what that would mean.
1:32:45
Zhivago
In contrast, if your function takes a single type, and dispatches based on implementation (i.e., class) then it should have coherent semantics.
1:34:07
pillton
The generic function name may return a symbol for a set of objects, or it could return a string for others.
1:34:12
sjl
(typep foo '(function (x) y)) would mean "is foo a function that accepts a single argument of type x, and returns a result of type y"
1:34:35
sjl
Which probably no current lisp can reliably answer. But I don't think it's an unclear *question*.
1:35:07
Zhivago
You can certainly dispatch on type -- the problem is that if you're dispatching on type, you're doing bad things to semantics, so you probably shouldn't.
1:36:08
sjl
> Every element of this type is a function that accepts arguments of the types specified by the argj-types and returns values that are members of the types specified by value-type.
1:41:41
sjl
You could just ignore any case that fails, and say "those don't contribute to the type". I suppose that's fairly reasonable.
1:42:30
sjl
Right, "does not return" isn't really captured in the current CL function type. Maybe we need an extra parameter
1:44:12
sjl
It's probably reasonable to say "any code path that doesn't return anything has no effect on the type of the function"
1:46:14
sjl
so you could check that the person actually passed a function that takes one parameter and returns something
1:47:43
Bike
guess you could consider (function (&optional t)) a subtype of (function (t)), cos it accepts more argument (lists)
1:47:46
sjl
sure. (function (t &rest) t) is a subtype of (function (t) t) because it accepts one parameter (and also possibly mroe)
1:48:51
sjl
Or, e.g. I have a function in my project Euler repo called SUMMATION that takes a sequence and sums it, and it takes a :key argument. That :key function should be a subtype of (function (t) number).
1:48:58
Bike
well this limited accepts is easier, it's whether the argument list is accepted by the lambda list, in the sense of acceptability defined by the lambda list rules etc
1:50:05
sjl
Because #'car is a perfectly valid key when you know all the elements start with a number, but its return type isn't a subtype of number.
1:50:44
smokeink
(= (+ 37 (sb-vm::get-lisp-obj-address #'car)) (sb-vm::function-raw-address 'CAR)) ;==> T . In sbcl what's the difference between get-lisp-obj-address and function-raw-address ?
1:51:05
Bike
obviously the type of car should be understood as null -> null | forall A (cons A T) -> A instead
1:52:25
Bike
smokeink: this seems like an #sbcl question. but it looks like function-raw-address is used for static linking, so it might be the actual entry point and not the closure words or whatever the hell
1:59:37
parjanya
the fright lisp sometimes gives me reminds me of when I was learning Latin, but it’s a little worse ; )
2:17:19
Zhivago
Well, it's understandable when you consider that most other languages have been evolving toward a common consensus on code appearance.
2:17:59
Zhivago
Lisp has ignored that in order to emphasize ad hoc macros, which other languages have also been evolving away from.
2:48:08
johnnymacs
So lets say I have a package called foo and in foo I have a funtion called car and cdr. And I have another package which uses common-lisp and uses bar. I want to use the bar package with car and cdr but my foo package only uses cl.
2:48:40
johnnymacs
So I want to pass data between packages and layer a hierarchy of namespace priority
3:06:07
smokeink
(cl::car (cl::list 1 2)) ==>1 , and since 'car and 'list are external to the package CL you can use : instead of ::
3:26:05
johnnymacs
The reason I wanted to use packages is to get away with short function names but then you end up having a long package name
3:36:00
johnnymacs
When writing object oriented code one needs to get sub objects very often which is why getting a subobject is just . in most object oriented languages
3:39:33
johnnymacs
(defun dot (table &rest args) (while (not (equal 0 (length args))) (setvar table (gethash (pop args) table))))
3:43:06
pierpa
loginoob: good for what? If it is for learning, there are several good and free books available
3:44:08
loginoob
pierpa: I'm learning from book CL: gentle introduction to symbolic computation. Was wondering to read blogs in free time
3:46:09
loginoob
also in my emacs when i type 'this 'this 'true it return last input i.e TRUE . Shouldn't it return all three
3:49:04
pierpa
as far as I remember, yes, it should print all three results. At the moment I cannot check.
4:25:25
beach
johnnymacs: If you often want to the slots ("subobject"s) of an object, then your code is badly structured. Slots are an implementation detail that should be used (if at all) only by the module that defines the class. Instead, such details should be hidden behind a consistent "protocol" (an extension of the concept of an "interface" in other languages) consisting of classes and (often generic) functions.
5:25:02
smokeink
I want to replace the 2nd code here https://rosettacode.org/wiki/Sieve_of_Eratosthenes#Common_Lisp , with a documented version http://pastecode.ru/19973/ . Please criticize the code on the 2nd link, point out all the stylistic issues and help me to fix it.
6:36:14
johnnymacs
What is wrong with this? (defun gethashes (x &rest y) (loop while y do (setf x (gethash (pop y) x))))
6:59:05
beach
johnnymacs: Perhaps you are confused about how Common Lisp passes arguments. Did you expect the first argument in the call to your function to be modified as a result of the call?
6:59:07
johnnymacs
well I want to take a set of nested hash tables and search through them with keys
7:01:19
beach
johnnymacs: What did you expect to happen to the values that you give to X in this function?
7:05:03
beach
johnnymacs: Did you see my remark you your desire for a compact syntax for accessing slots (what you call "subobject"s)?
8:05:52
johnnymacs
Why is it whenever I try to define a variable it always tells me the variable is undefined
8:07:35
jackdaniel
you define variables with DEFVAR, like that: (defvar *foo* (lambda () (make-hash-table)))
8:23:55
pierpa_
Why write (lambda () (make-hash-table)) instead of simply #'make-hash-table ? Ok, there's a small difference, but does it matters in this case?
8:26:31
johnnymacs
(defun gethashes (x &rest y) (loop while y do (setf x (gethash (pop y) x)) (return x)))
8:31:09
johnnymacs
If the advice seems to be a corret way to solve my problem that I can understand then I follow it
8:31:24
johnnymacs
Somtimes people have the correct answer but they refuse to explain it in simple terms
8:31:40
johnnymacs
or for example some people want to have a conversation with you before they will tell you what they think the answer is
8:31:58
beach
johnnymacs: It would be very helpful if you acknowledged that you received the advice, and if you don't intend to following, indicate why.
8:33:19
beach
johnnymacs: "WHILE Y" indicates to the reader that Y is a Boolean variable. In reality, here it is a list. The expectations of the reader are thus violated.
8:33:42
jackdaniel
johnnymacs: if you are not willing to listen to advices you get (without saying why), then you simply waste people time by asking questions.
8:34:37
beach
johnnymacs: This solution has the additional advantage that you won't modify the parameter Y, which makes debugging easier.
8:35:28
beach
johnnymacs: I am attempting a few more times to give you advice. But, pretty soon, I'll give up unless I see some reaction.
8:41:27
beach
johnnymacs: If you can't read a specification, perhaps you should choose some other activity.
8:44:41
beach
johnnymacs: Some of us help in the hopes that you will become autonomous one day. What you are saying now is that it will never happen.
8:45:13
beach
Being able to read the specification yourself, rather than having people here read it for you.
8:45:24
jackdaniel
that doesn't mean you deserve help. if you need tutor who will explain things to you (without doing your homework), you probably need to hire somebody
8:46:18
johnnymacs
The common lisp hyperspec is like a cheap rag compared to a document like gentle introduction to lisp
8:47:42
johnnymacs
I think the hyperspec is the single worst piece of documentation I've read. I've read documentation ten lines long that taught more.
8:51:05
jackdaniel
you see, nobody here is a teacher (at least doesn't spend time on IRC to fulfill teaching duties, just to hang around with people with similar interests)
8:52:21
johnnymacs
if you didn't want to answer my question then why would you half assedly participate in answering them
8:52:32
antoszka
johnnymacs: I'm sure you had suggestions on *teaching* books (since you mention Gentle Intro and PCL which are both excellent books).
8:52:32
Shinmera
beach: Fwiw in my experience people that don't start out autonomous hardly ever become autonomous.
8:53:52
antoszka
johnnymacs: I only just look at the channel, I'm not in-any-part-assedly participating, I'm not in fact participating at all. Just wrote my opinion on the Hyperspec.
8:53:58
jackdaniel
1) being polite is something many people do; 2) we want to help if someone is willing to help himself - more lisp hackers = better; 3) I'm 100% sure you haven't read http://catb.org/~esr/faqs/smart-questions.html
8:54:38
beach
Shinmera: I think I know of some exceptions, but that doesn't falsify the general statement, of course. I still think it is an interesting observation, and I'll think about it myself.
8:55:41
johnnymacs
jackdaniel: that seems like alot of preparation simply to type some characters and then put a question mark at the end.
8:58:38
johnnymacs
I don't know I just feel like you guys have a high success rate at convincing people not to use the common lisp variant of a turing machine.
8:59:27
Shinmera
I feel like you're very disrespectful about the courtesy people have given you here.