freenode/#lisp - IRC Chatlog
Search
11:48:38
megachombass
well, i want my code to do the same thing, but written in different way: https://codeshare.io/GkwJYA
14:07:05
pjb
megachombass: you know, nowadays, you just cannot copy anything or get help from any programmer without the teacher being able to EASILY and trivially know it.
14:08:09
megachombass
whats wrong with this let syntax (let (vm (make-vm 1000)) (vm2 (make-vm 1000)) fibo1 fibo2 fact1 fact2)
14:08:48
pjb
megachombass: current DNA-research, machine learning and artificial intelligence techniques exist to easily 1- match source code with other source code to determine their common ancestor, whatever the transformation you make on it (notably, renaming, things you can do with replace-regexp, are completely transparent), and 2- identify the AUTHOR of a chunk of code!
14:09:11
megachombass
+, teacher got absolutly no idea what is our coding level, even wonder if he know who i am
14:09:19
pjb
megachombass: basically, if your teacher cares, he will run the program on the code, and he will know, line by line, who wrote it, what git repo it comes from, etc.
14:09:44
_death
you should also know that the lisp community isn't that big, that some professors reside here, and that this channel's log is publicly available
14:09:54
pjb
megachombass: nothing is wrong in the syntax of: (let (vm (make-vm 1000)) (vm2 (make-vm 1000)) fibo1 fibo2 fact1 fact2)
14:11:28
pjb
megachombass: it means: create a variable named VM, bind it to NIL. create a variable named MAKE-VM, bind it to 1000. Call the function vm2, with as argument the result of the call of the function make-vm with as argument 1000. Ignore the result. Evaluate a free variable fibo1. Ignore the result. Evaluate a free variable fibo2. Ignore the result. Evaluate a free variable fact1. Ignore the result. Evaluate a free variable fact
14:12:51
pjb
megachombass: https://books.google.fr/books?id=waUzDwAAQBAJ&pg=PA286&lpg=PA286&dq=identify+code+author&source=bl&ots=xKeviX41nO&sig=mztxKotHQkwV_xbqe3dqug6lzQI&hl=en&sa=X&ved=0ahUKEwjX6oy66_rYAhXKBcAKHQGbDpwQ6AEITTAF#v=onepage&q=identify%20code%20author&f=false
14:15:14
pjb
megachombass: just time to write an essay explaining what you've done, what problem you have, and make a planing indicating how much time you'd need to implement the project.
14:17:06
pjb
megachombass: oh, true, if I was a lisp teacher, obviously I would already be on all the lisp irc channels, the lisp newsgroups, the lisp forums, and they'd be logged.
14:17:26
pjb
megachombass: notice how beach routinely ask people whether their new in #lisp, and check them in his logs…
14:21:07
megachombass
and to avoid banhammer, i will clearly specified (thanks to pjb for his help on this project, without him this wouldnt exist)
14:24:28
pjb
megachombass: but seriously, at this point if you want to save your skin, writing a project report explaining the failure, how it occured, and what you could do to recover and complete the project (whatever time you'd need), is IMO the best option.
16:24:49
phoe
FLET ADD is not really readable for me. The function name ADD sounds like mathematical addition to me.
16:35:27
beach
ebrasca: Your LOOP clauses are not correctly indented. I suggest you use the slime-indentation contribution to get them right.
16:37:36
beach
In my .emacs I have: (slime-setup '(slime-fancy slime-tramp slime-asdf slime-indentation))
16:38:40
beach
In Common Lisp code, there is usually one blank line between each top-level form and no blank lines anywhere else.
16:40:44
beach
ebrasca: Perhaps, but the problem is that you are submitting it for others to read. So then, you should make it such that it is easier for THEM to read, and the best bet is then to follow established conventions.
16:43:11
pjb
ebrasca: basically, if you need to insert a blank line in a function, it means you should refactor it, calling smaller functions.
16:45:30
beach
Then use '() to initialize it. NIL means either the Boolean value false, or some default value. Not the empty list.
16:46:22
beach
ebrasca: '() is the empty list 'nil is the symbol NIL, () is the empty parameter list, and NIL, like I said, is a Boolean or a default value.
16:49:01
beach
On a deeper level, I find it confusing the way your macro introduces variables, such as NAME that then occur without context when the macro is called. It suggests that the macro does not correspond to a very good abstraction.
17:14:12
beach
ebrasca: I guess I can be more specific after you put in comments describing what each function and macro does. That way, I can more easily tell whether they represent good abstractions.
17:20:03
ebrasca
write-metadata write some metadata like file-size , last-write-date to file/directory.
17:24:17
beach
OK, I am looking for a more detailed description. Like the type and role of each parameter, especially those of do-cluster. And I am looking for a kind of contract for it. Obviously it seems like it introduces variables such as NAME, CHECKSUM, etc. How does the body (bodies?) use those variables. What are their values, in each iteration. What is FINALLY, IF-T, IF-NIL and why are they named that way? etc, etc, etc.
17:26:26
beach
I am not looking for a one-liner here in the channel. I am looking for a comment or a docstring, or both, that I can compare with the code.
17:31:14
beach
It seems I have a few more minutes. I have no idea what you mean by "IF-T is for what is diferent in if if it is t"
17:32:54
beach
If that is the case, I am now convinced thet do-cluster is not a good abstraction. Abstractions should be possible to understand by reading the name and the parameters (and the comments to those parameters), not what is inside it.
17:33:51
beach
So, you are basically saying "Hey, macro user, in order to know how to use this macro, you need to read the code for it. In fact, you need to read the code for it just in order to understand why the parameters are named the way they are".
19:11:22
beach
It is too late for me. I need to go spend time with my (admittedly small) family. I'll look tomorrow morning (UTC+1).
20:07:38
aeth
ebrasca: From a previous conversation here on docstrings, I came up with this rule for my projects: "Docstrings for functions and methods should mention the inputs, the outputs, and the side effects."
20:12:13
aeth
so e.g. your read-file currently says "Return data buffer of file", but that's only the outputs part (except, I guess it mentions the variable file?)
20:19:11
aeth
The ones I've seen usually have the first line line up with the function indentation and then the rest aren't indented.
20:19:14
pjb
the problem is that the string itself is indented. SO when multiline, I usually start it with a newline (and end it similarly).
20:20:55
aeth
ebrasca: " RET type your documentation RET type your documentation RET type your documentation RET "
20:26:46
aeth
ebrasca: Here's an elaborate example of what pjb's style is, from pjb's own code: https://gitlab.com/com-informatimago/com-informatimago/blob/51d8149b18cdce4626c1d795181d9232c465c883/rdp/rdp-macro.lisp#L48-208
20:27:30
aeth
Notice that the first " lines up with the source indentation and then the rest start at column 0
20:28:19
aeth
ebrasca: Side effects would be on something like format, where what format t does depends on *standard-output*
20:30:42
aeth
Okay, I'm actually not sure if interacting with an outside global is a side effect or an input, actually.
20:31:05
aeth
I think setting it might be a side effect, but reading it might be an input. So my format example might be bad.
20:33:36
aeth
ebrasca: In some sense, "good code is better than documentation" is true, but not in the way you think it is. I think it applies more to comments than to docstrings. If you have to comment some part of your code heavily, you can probably just write it better and not have to comment that part.
20:34:19
aeth
But you can't really do that with variable names themselves unless you make their names very long and ugly.
20:38:14
aeth
There is nothing stopping you from writing a mini-hyperspec in docstrings, complete with examples, etc. People would probably like that. You would probably need some markup convention for that, though. e.g. Python uses reStructuredText and Java uses JavaDoc
20:38:31
aeth
What I gave is the minimum documentation you need to give in a docstring, not the maximum.
20:39:19
aeth
Doing something equivalent to docstrings in variable names would (1) capture only the minimum part, (2) look ugly, (3) violate CL style guidelines
20:40:17
aeth
ebrasca: Well, some programmers in other programming languages used concise conventions so they could have their self-documenting variable names while not greatly lengthening their variable names. e.g. https://en.wikipedia.org/wiki/Hungarian_notation
20:42:44
puchacz
like here: void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
20:48:00
puchacz
Bike: so defcalback first, and it should take :pointer as an argument and return :void, right?
20:48:36
Bike
borei: you mean, you tried to use this as a specializer? in the defmethod lambda list?
20:49:02
borei
(defmethod (setf translate) ((r '(simple-array double-float (4))) (transform transform-3d)) ..... )
20:49:12
Bike
borei: point one, don't quote it. point two, not all types are specializers. that type is not a specializer.
20:49:17
aeth
ebrasca: You have to have docstrings for every exported function in most styles. For the other functions, it depends on the style.
20:51:55
aeth
Something like a make-foo could possibly be documented in one line: "Returns a newly allocated foo based on the filename file and the number number"
20:53:20
aeth
If you had a formal style for your docstrings, it would probably make them take up several lines at a minimum.
20:56:18
aeth
A lot of the tile you might say things like "the number number" in your docstring because your variable name for the input is perfectly named. Sometimes people capitalize the names to make it look a little better, i.e. "the number NUMBER"
21:01:07
puchacz
Bike: FYI, changing the argument type from :pointer to :int of sqlite3-result-text lets me pass -1 and it seems to work.....
21:04:00
puchacz
I think "casting" to function pointer does not do anything in C to actual bitpattern of data in memory..... but I may be wrong, as I don't know C
21:18:15
pjb
ebrasca: yes: basically all that you put in the docstring, you could put it in a declare.
21:28:10
TMA
ebrasca: the main thing is that you can ignore most (if not all) of the declarations except for (declare (special ...))
21:55:06
pjb
This is why it's important to also write the tools that will interpret your custom declarations.
21:55:30
pjb
Then you can call them automatically in your build process, and fail when there are errors.
21:56:07
pjb
For example, those pre- and post-condition can be used to generate assertions and use them in tests or in the compiled code.
22:13:51
pjb
I use the stepper declaration to disable the stepper in some functions that cannot be stepped (eg. the functions that are called from the stepper itself or that are too much of a bore to step into).
22:15:45
pjb
ebrasca: elsewhere, I've used declare to declare commands (interactive functions). In emacs lisp, (interactive) is a declaration. In CL You write (declare (interactive)).
22:16:14
pjb
ebrasca: (of course, you can also use a macro such as defcommand in those cases, sometimes it's easier than to process declarations).
23:01:31
aeth
If someone was going to add a contract system to CL it would be nice for the type part of it to use type declarations in SBCL and any other CL that uses similar semantics and check-type for the majority of implementations.
23:02:36
mgsk
jmercouris: seeing weird behaviour of tabs in gtk. Sometimes C-x b doesn't show any tabs, and C-[ shows empty pages. Aware of that?
23:02:48
aeth
(I'm assuming a contract system in CL would do both runtime type checking and compile time type checking.)
23:07:07
jmercouris
mgsk: as a quick aside, if c-x b doesn't show any tabs, type space, and then backspace, it'll refresh the table view, usually :D
23:10:15
jmercouris
I don't think that should have an effect, though the stupidity of GTK has surprised me quite a bit :D
23:13:36
jmercouris
except for using the legacy webkit wrappers on cocoa, hopefully with a new ffigen replacment that can be fixed
23:15:12
jmercouris
I tried installing BSD on my macbook for dual boot, I ended up in tears from frustration
23:16:01
isBEKaml
Surely, you shouldn't have problems installing any BSD on a Mac? Because Mac is derived from BSD?
23:17:11
jmercouris
darwin has diverged quite a bit from straight bsd, at least apple isn't freely handing out kexts