freenode/lisp - IRC Chatlog
Search
11:05:42
dxtr
So what's the common thing to do in multi-file projects? Are all files their own package or the same?
11:08:31
jackdaniel
some prefere file-per-package, others have a separate packages file and source scattered trough many files
11:08:59
jackdaniel
sometimes it's just one package for whole system, or two packages (interface, and internal implementation)
12:38:49
phoe
I've somehow installed OpenJDK7 on FreeBSD on SPARC and managed to run ABCL on it. Installing Quicklisp fails though and all I get is, debugger entered on ERROR: "Invalid argument".
13:41:50
dxtr
jackdaniel: If I were to use one package per file (or directory for that matter) would it make more sense to define the package in package.lisp or the file itself?
14:15:32
dxtr
So if I were to create a macro that creates some variables with DEFPARAMETER with names based on the input; would I have to concatenate the variable names as strings and then convert them to symbols and then pass that to DEFPARAMETER?
14:24:28
dxtr
I actually found a stackoverflow question that was close to what I wanted to do :D http://stackoverflow.com/questions/22359035/define-variable-with-defparameter-with-name-determined-at-runtime
14:25:15
dxtr
like if I want it to do three defparameter I just do `(defparameter ....)\n`(defparameter ...)?
15:13:29
afidegnum
hi, i m reading some gigamonkey tutorial but i don't understand this part.... https://ghostbin.com/paste/v355s which among them is responsible for the prompt ?
15:14:31
drmeister
Does this look right? In the cl-jupyter project there is an UNWIND-PROTECT that looks like it has a typo where the form that should be in the protected-form ends up in a cleanup-form
15:16:14
beach
afidegnum: The call to FORMAT is responsible for the prompt, and the call to FORCE-OUTPUT makes sure that all buffered output is transmitted to the device.
15:17:44
nyef
drmeister: But the nature of the failure is such that a casual test wouldn't find a problem, since it's basically "just" the cleanup code not getting called.
15:18:20
nyef
And that, only with a non-local exit. If SHELL-LOOP exits cleanly then there's nothing to see.
15:19:37
beach
afidegnum: It generates some output that the user sees. That's what we call a prompt.
15:20:33
beach
afidegnum: Some other function calls the function prompt-read to print the prompt and read a line of input typed by the user.
15:22:05
afidegnum
so if i understand, force-output will emit the prompt and read-line will capture what the user typed, right ?
15:22:56
beach
afidegnum: No, the FORMAT will emit the prompt, either to the device or to a buffer. FORCE-OUTPUT will make sure that, if the prompt was emitted to a buffer, then the buffer is transmitted to the device.
15:25:32
afidegnum
ok, i think i will read more about it, Ah, earlier i read (fornat t "") where t is part of the destination, we do have string and streams
15:26:45
beach
afidegnum: For FORMAT, the first argument designates a stream. For FORMAT it can either be a stream or T or NIL. T means the same as the stream *standard-output* and NIL means that the result is returned as a string.
15:38:19
afidegnum
beach: i know there is a read function which prompt a user but i don't understand how come FORMAT too play a role as a prompt
15:40:00
beach
afidegnum: By "prompting the user" I mean show some kind of message, such as "Pleas user, enter a file name, would you:"
15:40:58
beach
It is the PRINT functions (and in this case the formatted output function FORMAT) that can print such messages.
15:45:50
beach
I don't see any function under "Output functions" that says it prompts. Which one do you see?
16:58:39
learning
hi, i'm trying to find a toy example for (format t "~:@c" #\magic-character) where #\magic-character shows unusual shift keys so that I can better understand the c directive. i know its imlementation dependent. have sbcl and clisp already setup.
16:58:59
learning
page that im referencing: http://www.lispworks.com/documentation/HyperSpec/Body/22_caa.htm
17:03:44
nyef
Problem is, it basically needs both the "implementation-defined attributes" and full knowledge of the input device mapping, neither of which are things that a modern Lisp system tends to have.
17:30:06
afidegnum
lispworks and allegro, don't they have a free license? or everything is paid? and after the trial version of what they offered you can't use their product again?
18:10:20
Xach
afidegnum: If you ask nicely, you can get the full version without paying anything. But you cannot use it for anything you wish, usually.
18:10:42
Xach
afidegnum: for example, I asked nicely and was granted full licenses for quicklisp testing purposes. but I cannot use it to make and sell applications.
18:31:20
axion
No, because Common Lisp code is usually not used outside of a Common Lisp environment where we have standard functions to lookup documentation.
18:32:18
aeth
axion's right, you should be able to look up documentation on anything (and that docstring can be extracted for API references, like Quickdocs does)
18:32:42
aeth
But how many packages in Quicklisp have a docstring for everything that is exported? Do any?
18:33:19
dxtr
I've played around with both ocaml and haskell and they both have horrendous documentation
18:33:37
dxtr
ocamls documentation is basically non-existant and haskell stuff might have documentation but assumes you are an expert alreadyh
18:33:41
aeth
Brainfuck tends to be well-commented because otherwise the author would not know what it does in a few days.
18:33:45
haom
im not looking for documentation, i want to write documentation, and have noticed that a lot of lisp projects use different documentation tools, but that other languages have somewhat standardized documentation formats.
18:34:06
aeth
Lisp tends to be "read the source" and you can usually get away with it unless it's a 100-line fancy macro (or a 100-line function used by a fancy macro, no real difference)
18:35:17
aeth
Every popular library is on Quicklisp, which is then parsed by Quickdocs in a centralized way.
18:37:06
axion
aeth: He always writes very crappy code and refuses to respond to issues relating from it.
18:37:25
axion
For example, he likes to hide all non-expected input behind the equivalent of ignore-errors
18:38:17
aeth
haom: There are probably a dozen ways you can generate API documentation from docstrings in code, but there are none that are standard afaik.
18:38:35
aeth
That's generally common with Common Lisp. If something is easy, there are a dozen libraries. See: unit testing.
18:40:51
axion
The only standards body we have is ANSI, so the only correct response is that which I gave.
18:43:26
aeth
Other languages might have a major implementation that is considerably more popular than the rest, and/or they might have a "killer app" framework, and/or heavy involvement from some corporation, or some other way for standards to spread for trivial things through influence.
18:47:01
aeth
If something like that is not present, the answer to bikeshed painting [0] is to make your own bikeshed and paint it what you want, rather than having to come to some consensus on how to paint a bikeshed.
18:48:57
aeth
In other words, a de facto standard for some simple X, Y, or Z could come from whatever the official language implementation does, or the main libraries/frameworks do, or what the main corporate backer does, etc. But Lisp has none of this.
18:49:38
aeth
(Scheme often does have de facto standards because each implementation might as be the official language implementation of a new language, rather than just an implementation of Scheme. But this is a Common Lisp channel.)
19:45:29
krwq
hey, what's the simplest code to read value given a key from list which looks like: '("key1" "sdfsdf" "key2" "fff")
19:53:08
aeth
If you can control the format, use keywords instead of strings, and you can just use (getf the-list :the-key)
19:54:03
krwq
this looks like will work http://stackoverflow.com/questions/9310913/how-to-get-two-elements-from-a-list-each-time-in-common-lisp but i wonder if there is an option to pass :test to getf
19:54:32
aeth
krwq: you can pass test into similar sequence operations like search, find, and position
19:55:15
krwq
aeth: but getf does not have tes and find will not necessarily position on key and may give valuye
19:56:45
aeth
You have a sequence, you can locate the key, and you know the value is one after the key.
19:58:39
aeth
Now, one complication is if there's a string that matches the text of the key as a value that shows up in the sequence before the key. So it isn't trivial.
19:59:09
aeth
Once you get the position, you'd probably have to check that it is even, and if it's not, search the sequence again, starting from that point.
19:59:42
Bike
fuck that, (loop for (key value) on list by #'cddr when (string= key to-find) do (return value))
20:01:54
krwq
Bike: thanks, I just got identical code based on http://stackoverflow.com/questions/9310913/how-to-get-two-elements-from-a-list-each-time-in-common-lisp :D
20:05:22
aeth
(defun getf* (sequence key &optional test) (let ((candidate-position (position key sequence :test test))) (if (evenp candidate-position) (elt sequence (1+ candidate-position)) "This is an exercise for the reader")))
20:06:20
aeth
Works on any sequence, and with any test. Doing it with dotimes instead of position would even get rid of the edge case where the key could be in the value spot
20:06:52
krwq
aeth: this is interesting although i find a loop syntax much easier to read for this thing
20:08:42
aeth
varjag: it's possible that sbcl optimizes it if getf* is inlined and it knows that it's being used on a list instead of a generic sequence
20:09:27
krwq
varjag: looks good and probably as fast as loop - my vector has less than 1k entries so perf is irrelevant
20:10:04
krwq
i like looking at alternative answers as aeth gave because i always remind/learn something new
20:10:21
aeth
i.e. this: (defun bar () (let ((foo (list "foo" "bar" "foo2" "quux"))) (getf* foo "foo2" 'equalp)))
20:14:50
aeth
varjag: You're right, but there was an easier way, and that was to disassemble. The disassembly shows that it calls #'nthcdr, so it doesn't optimize.
20:15:20
krwq
i sometimes wonder what kind of project are you guys doing that you fight for every nanosecond
20:15:58
aeth
varjag: I really need to use this heuristic more: when I think of measuring the behavior of a function, I usually can just disassemble and often a comment in the assembly tells me what I'm looking for.
20:18:05
krwq
does drakma have some pagination handling bultin? im parsing that by hand right now but after i finished im wondering
20:19:54
krwq
btw sorry for asking newbie questions but i.e. for most of the stuff i use one or two functions while for sexps there is like 45 different ones and i keep feeling like im reimplementing stuff
20:39:16
aeth
dxtr: All emptyp (in alexandria) does is check (null sequence) for lists and (zerop (length sequence)) for the rest.
20:39:30
aeth
As I learned earlier, code that's generic for sequences usually has to handle lists specially. <_<
20:39:58
Bike
given that there are only two kinds of sequences, treating one of them specially doesn't seem surprising
20:51:02
hjudt_
do people here use emacs auto-complete or helm? both or only one of those, and in the latter case which one?
20:54:25
hjudt_
i saw a video about slime in which helm or auto-complete are used, but since i do not know either i can't tell which one it is. so first i thought i'd try auto-complete, but then when investigating further it seems helm does provide even more.
20:58:21
axion
auto-complete uses a popup menu to incrementally complete as you type, much like helm, but is usually used for completing language symbols and the like. helm is a menu system for creating interactive emacs buffers, which is usually used for just about anything, such as running commands (like the helm-M-x M-x replacement)
21:00:37
axion
Another difference is that helm is invoked, and then you incrementally type. Whereas in auto-complete, you type, then initiate auto-complete and incrementally type.
21:01:53
hjudt_
i see. so auto-complete is actually a bit more convenient for completing language symbols, right?
21:02:32
axion
auto-complete and company-mode perform the same task. helm and ido perform the same task.