freenode/#lisp - IRC Chatlog
Search
5:49:35
kenanb
maybe it is set to etags search function or something, which might be causing the definitions to not be found. -rpc version asks swank to find it, which works successfully in my system
5:50:04
Bike
ugh, of course it's not etags. it's rpc, but it doesn't work for some sbcl internals lately, for me, that's all.
5:51:50
kenanb
hmm weird. some emacs plugins try to be extra smart with behaviour of irrelevant libraries, I hoped it might be the case that some library is messing with the search function
5:52:56
Bike
i'm not very good at emacs. the most complicated thing i use is slime and my rc is like ten lines. so it's just some voodoo wizard fucking with me.
5:56:10
Bike
oh, even better, if I enter sb-c::%defknown myself it does work, just not when doing it from a buffer. oh well, it's not a big deal.
5:58:24
kenanb
you mean when you enter it yourself interactively to slime-edit-definition from minibuffer?
5:59:17
Bike
so presumably there is some failure to interrogate the correct symbol from the file buffer
6:01:27
kenanb
tho if it cannot determine the package at point, it shouldn't be able to eval region etc as well,
6:05:34
kenanb
Bike: maybe this? http://askubuntu.com/questions/392118/slime-lookup-definition-not-working-with-sbcl
6:25:13
beach
Then, it depends on what you mean by "struct". Do you mean the TYPE created by DEFSTRUCT, or do you mean the instance of that type?
6:25:14
shka
but still, i'm under impression that defstruct and defclass construct object in a different way
6:27:07
shka
i want to know the difference between object of a class declared by defstruct with object of a class declared by defclass
6:27:38
Bike
structs are more likely to be boxed. classes have so much redefinition stuff it's hard to allow things.
6:29:40
kenanb
shka: tho the standard doesn't mandate such optimizations, it is up to implementation to do such things
6:34:33
kenanb
shka: you may think of a structure object as kind of like a very primitive alternative to a CLOS standard object. they are likely to be optimized more heavily due to being less powerful than a standard object, they don't support multiple inheritance, the slot access doesn't necessarily follow the same strict rules as the ones for a standard-object. so more implementation dependent behaviour. what you usually have with a structure is the
6:38:44
kenanb
shka: then they might be useful, careful initializing your slots. they will be initialized to "something" if you don't provide initforms.
6:40:25
kenanb
shka: or they may not be initialized by default, nothing seems to be guaranteed on that end really. always provide initforms.
6:41:18
kenanb
shka: I would just go with standard objects unless I am sure I want structs for some reason
6:44:13
kenanb
shka: structures might be of represented as vectors or lists by explicitly specifying a :type, in which case there will really be no new class definition, therefor no method to specialize on it, therefore all accessors will really be functions, so it is highly likely that you will accidentally have name clashes because of automatically generated reader names, with that in mind, prefixing struct name seems like a good idea, just to make
6:48:47
kenanb
shka: an inferred-type can be generated if you also provide :named option. because there will be a struct-name-p which will simply check the symbol naming the struct in corresponding position of vector/list. if you don't provide it, there is no way to retrive that information, it is just a sequence. but that can only be used to generate an inferred type (like in deftype), not a class representing the structure.
6:50:03
kenanb
shka: well, I would never guess that, too. thankfully, standard states that very clearly. :D
6:58:30
kenanb
:) not me tho, I am not knowledgable enough on types to even consider having feelings about a particular type specifier, tho I know I simply ignore satisfies clauses in the type expansion code I am currently writing
7:27:16
kenanb
Bike: worked like a charm!! pushed fix, created pull request. https://github.com/froydnj/nibbles/pull/22
8:30:44
myrkraverk
When I have a hashtable where the values are lists, how do I append to such a list?
8:32:28
myrkraverk
I can't seem to get it right; in particular (and maybe predictably, I don't know) this doesn't seem to work: (setf (gethash normalized-word words) (append (gethash normalized-word words) (list count))))
8:33:55
Munksgaard
Append returns a new function (is "pure"), while nconc modifies the lists in-place.
8:37:14
myrkraverk
Ok, then (maybe) my comparison function in the hash table is wrong. IIRC gigamonkeys said to use 'equal for string keys, so I did that.
8:38:16
myrkraverk
More like a loop at this point, but I'll try to come up with a minimal self contained example. And it just might be the case that my minimal example will work, in which case: back to the drawing board.
8:42:11
myrkraverk
Do, I just realize my stupidity; the hash table is defined in the wrong loop (inner, not outer)
8:52:14
malice
Hello, I want to print minutes with format; I want to print the number as with ~D, except when it's less than 10 - then I want to add 0 before the number
10:52:44
John[Lisbeth]
Ok I am reading the gigamonkeys thing and I am inside slime. And I've typed (defun hello-world () (format t "Hello, World!"))
10:54:40
ecraven
John[Lisbeth]: defun in this case probably 'returns' the symbol of the function name
10:54:52
John[Lisbeth]
So can I pass that into another function and have it be the same as hello-world ?
10:54:56
p_l
John[Lisbeth]: you have defined a function, called HELLO-WORLD, which is what defun returned
11:00:32
codesine
the return value is just the<codesine> (equal 'HELLO-WORLD (defun hello-world ()))
11:01:26
John[Lisbeth]
I was doing sicp but then I realized I didn't want to do things purefly fuctionally
11:02:37
codesine
it was first the little lisper, i think it has the translations of the lisp code in it as well
11:04:02
codesine
I haven't looked at sicp, I did that practical common lisp, random reading of source code, but am thinking about reading the rest of the series to the little schemer
11:08:33
Cymew
There are multiple attempts to work through SICP with CL, and people have blogged about it. Might be worth searching for.
11:11:15
djh
tho I think so far the books I've had the most "aha!" moments with have been PCL and AMOP
11:11:57
codesine
it has scheme in the name, but all the snippets have translations for lisp (as it was originally for lisp (i think?))
11:13:31
djh
I largely put learning CL on hold to work through SICP, looking forward to coming back to it later :)
11:15:34
djh
been meaning to read up on MOPs since I started using Perl's, finally found the time courtesy of long train rides :)
11:22:56
djh
The general use-case is "you want OO to work differently than the default" such as different inheritance rules, or different ways of storing data in slots
11:31:38
djh
It kind of sums up the CL attitude for me, that when they needed to work out what OO rules to go with, they just said "let's invent a way to support *all* of them!" :)
11:44:25
codesine
generally speaking, is it preferable to use (list 1 2 3) vs '(1 2 3)? Is it considered more idiomatic by the community?
11:49:46
malice
codesine: Moreover, you can do (list 1 (evenp 2) 3), but '(1 (evenp 2) 3) won't work(in the same way as #'list one); you'd need `(1 ,(evenp 2) 3), or list.
11:50:01
|3b|
LIST makes a new list every time, while '() might be combined with other similar lists during compilation (one reason you shouldn't modify it)
11:50:39
|3b|
so in addition to the problem of modification, they behave differently in regards to identity as well
12:05:45
John[Lisbeth]
I am reading the gigamonkeys and some of the emacs keybinds from slime are not working
12:07:16
|3b|
(though for that specific thing, you might look at paredit or similar, that close parens when you open them, so you always have both)
14:11:21
drmeister
Why in emacs does hitting "g" in the *compilation* window restart the compilation (proper behavior) and other times hitting "g" inserts a "g".
14:15:51
igam
drmeister: in some modes, we use direct keys for a smoother user interface. In those buffers, it would be meaningless to insert character or to edit in general. So those keys are free for other commands.
14:16:39
Shinmera
I think he means that in the *compilation* window it sometimes inserts a g and sometimes does not
14:17:06
drmeister
igam: Right, but the *compilation* windows sometimes get into a mode where "g" inserts a "g"
14:17:51
igam
You can always change the mode to an editing mode. But it would not be the normal workflow.
14:18:34
igam
Notice that I would want to be able to input into *compilation* buffer, since sometimes makefiles are interactive. But it's not possible, and one has to run those make in shell instead.
14:21:06
drmeister
Whew - all of the compile errors are now out after making closures first class objects.
14:21:35
igam
drmeister: when this happens use M-x view-lossage RET = C-h l ; it will show you what you just did, and will probably explain the behavior.
14:28:32
i-love-iisp
Is there a way to define a symbol besides nil, that would also evaluate to nil if used on a test? Like (if :my-nil 3 4) returning 4
14:28:32
drmeister
Nice - the REPL started up first time after making lots of changes over the last couple of days.
14:30:56
|3b|
or similarly with defparameter, if you don't care if someone can redefine it to something else
14:31:21
i-love-iisp
I extended cl-json to convert the json null to nil, and the json false to the symbol :false
14:31:52
|3b|
symbols in the keyword package are defined to evaluate to themselves, so ::my-nil evaluating to nil would be a bit odd, but you could probably manage it on most implementations with a bit of effort
14:32:19
i-love-iisp
but then i always have to do (if (eq my-var t) ...) instead of (if my-var), since :false evaluates to true
14:34:55
i-love-iisp
Hm, but yeah, i think what |3b| is saying should work. use a constant defined as nil instead of a keyword
14:35:44
i-love-iisp
Yeah, i really need to work with json on this project though, and go back and forth, so i somehow need to represent [], false and null in lisp
14:39:13
i-love-iisp
yes, i guess implementing an if that tests for those keywords works. I was thinking maybe there was a way I didn't know with defining a type subclassing nil or something
14:47:38
vydd
Shinmera: hey, can you point me to a project (yours or not) that you think is very well documented. what I'm mainly interested in is to see how people go about commentating on types and how people talk about CLOS related stuff, also, macros - the other things I think I can take from my experience with other languages
14:50:17
mood
I like to think Birch, my IRC library, is pretty well documented in the README: https://github.com/jorams/birch
14:50:48
vydd
|3b|: ha. ok. as silly as it sounds, looking at those docs for examples didn't occur to me. thanks!
14:51:02
|3b|
i guess the pretty printer does some CLOS stuff as well. Probably the most important part there that differs from other languages is documenting the protocols defined by the various generic functions
15:19:38
sjl
I'm reading PAIP and in one of these functions uses .,(some form that returns a list) inside a quasiquote
15:21:23
John[Lisbeth]
|3b|: is there a dialect of lisp where I could write (((hello-world))), or an arbitrary number of parentheses?
15:23:11
|3b|
T isn't a function in CL, just like 1 isn't a function in C, so you can't call it as one
15:23:24
sjl
in C-like languages parens are used for both grouping (precedence-wise) and function calls
15:24:33
|3b|
CL specified how to evaluate a form that is a list, and those rules require that the first element either be a symbol naming an operator, or a list which is a valid lambda form
15:25:33
Cymew
If you "like put parentheses around anything I can get away with" I wonder if you are trying to understand how lisp work, or if you are just fooling around to see what happens.
15:26:34
|3b|
DeadTrickster: true, i simplified a bit... they also don't make a list inside strings, when quoted, etc
15:28:59
|3b|
John[Lisbeth]: CL divides things up into separate stages, first it READs the text of the program to create lisp objects like symbols, lists, etc, then it evaluates (or compiles) that lisp data, so it has to create a list for every () it sees since the READer doesn't know about semantic meaning of what it is reading
15:29:54
|3b|
actually, i guess technically you could write (((hello))) in scheme, if (hello) returns a function of 0 arguments that returns a function of 0 arguments
15:30:58
|3b|
John[Lisbeth]: but you couldn't wrap that in another () unless that last function also returned a function of 0 arguments (and so on)
15:31:11
ggole
If you want useless parens, write a macro (useless-parens (((foo)))) that expands to (foo)
15:35:39
|3b|
DeadTrickster: yeah, they could have defined arbitrary other behaviors for lists as first element of lists, but they didn't :)
15:36:45
|3b|
though then you get into the question if "if lists in operator position are evaluated normally, why aren't symbols?"
15:43:08
jackdaniel
I was wondering, how much of heresy would be evaluating the argument on first position only if it isn't a function name?
15:43:55
|3b|
* seems to recall thinking of some place where it wasn't obvious how to interpret that, but can't think of it at the moment
15:44:25
jackdaniel
Shinmera: I think it depends on the point of view, you get lisp-1 fallback for nothing
15:44:28
John[Lisbeth]
So you are saying it doesn't work in common lisp because it has multi-value namespace?
15:46:15
|3b|
John[Lisbeth]: it won't work because it is defined to not work, and even if it did work, probably wouldn't do what you seemed to want
15:46:30
Shinmera
jackdaniel: Then you're forcing the programmer to be aware of the full function namespace at all times. Pretty awful.
15:47:09
John[Lisbeth]
If it makes sense I basically want everything inbetween the space character to be surrounded by parentheses unless they are between quotation marks.
15:48:01
jackdaniel
Shinmera: I would say, that using a symbol in the first position would be a bad practice. Either way, just an idea
15:49:40
|3b|
* doesn't like python for the way it uses whitespace, so i can't complain if you don't like the way CL uses () :)
15:50:24
jackdaniel
there was some project messing with the readtable to reduce number of parens in favour of spaces and some inference
15:50:55
|3b|
possibly you could define some reader macros to make CL surface syntax more palatable, but at that point you aren't really using CL, and no CL programmer would want to read it :)
15:57:38
jackdaniel
one problem with evaluating symbol which isn't in the function namespace would be (let ((a 'b) (b 'a)) (a 3))
16:03:32
jackdaniel
(defun evaluate (...) ... (if (functionp (car sexp) (funcall (car sexp))) (funcall (evaluate (car sexp))) ...) would burp in the infinite recursion
16:04:31
|3b|
you hit something with a definition in the function namespace, but that isn't a function
16:05:30
fiddlerwoaroof
I've thought that would be useful to use as an extension language for a lisp program
16:05:52
fiddlerwoaroof
Since the syntax looks more "normal" to most people than making them right lisp
16:05:54
|3b|
(let 1) instead of (a 1) would see the special operator LET and error, so seems odd the recursive expansion version would behave differently
16:05:59
jackdaniel
|3b|: if symbol isn't found in the function namespace, then the first-position element is evaluated, and if it evaluates to the function, then it is funcalled
16:07:53
jackdaniel
|3b|: given implementation something like (defun evaluate ...) I shown would fall into infinite recursion. It's a problem which might be avoided I think
16:07:58
|3b|
* assumed you meant an evaluation rule where it would expand A to B, see there was no function named B, then expand that to A, and repeat indefinitely
16:08:42
|3b|
so in my (a 'let) example, would it find LET in the function namespace, or ignore it because it doesn't name a function?
16:10:32
|3b|
* thinks the discussion is a good enough reason for the specified behavior, too complicated to come up with all the details for a feature that wouldn't be used much
16:10:59
|3b|
that part makes sense, but i'd assume you finish that with "and in any other case it errors"
16:11:56
|3b|
not "then it tries to evaluate that again, but only if it is a variable that doesn't evaluate to itself"
16:12:35
|3b|
since (:foo) would always evaluate to :foo rather than a function, similarly 1 would always evaluate to 1
16:15:02
fiddlerwoaroof
I was just thinking about how I kinda like the way Arc lets you treat data structures as functions.
16:15:11
jackdaniel
(defmacro defht (name) `(progn (defparameter ,name (make-hash-table)) (defmacro ,name (key) `(gethash ,key ,,name)))
16:15:59
jackdaniel
but given that the evaluator is extensible, you could just treat data separately
16:17:15
jackdaniel
marzenie scietej glowy, it would fail bad given that you may actually want to compile it (the extensible evaluator thing)
16:43:48
rudolfochrist
*** #lisp: topic set by fe[nl]ix!~quassel@pdpc/supporter/professional/fenlix,
16:43:54
rudolfochrist
*** Users on #lisp: rudolfochrist nikki93 moei jinxter Bicyclidine arescorpio
16:51:40
Bicyclidine
there is the theory of the möbius, a region of chat in which time becomes a loop
17:16:58
beach
It would be great if someone would take on the maintenance of CL-VECTORS. Of course, I haven't (yet) asked whether the author would be interested. In particular, the documentation needs to be brought up to date, and missing things needs to be added to it.
17:21:14
rudolfochrist
*** #lisp: topic set by fe[nl]ix!~quassel@pdpc/supporter/professional/fenlix,
17:21:21
rudolfochrist
*** Users on #lisp: rudolfochrist nikki93 moei jinxter Bicyclidine arescorpio
17:24:22
beach
fe[nl]ix: Good point. I'll start by asking him whether he would be interested in maintaining it himself.
17:24:34
moore33
beach: Heh, well I understand that to mean "using Common Lisp," though perhaps not using it for rasterization.
17:25:32
fe[nl]ix
we can of course import the repository to github/sharplispers but I think Xach wishes the author's permission to switch the Quicklisp source to that new repo
17:38:15
myrkraverk
Is it possible, to detect with lisp code, if it's running through a hashbang? As in #!/usr/bin/sbcl --script