freenode/#lisp - IRC Chatlog
Search
11:00:17
theemacsshibe[m]
ACTION walks off the #lisp Bad Joke Night stage and sits back down blushing
11:01:02
theemacsshibe[m]
How do implementations of CL make their hash-tables? Binary trees seem like a simple solution but I'm sure there's more magic in it.
11:03:42
theemacsshibe[m]
I can't see much about IRC operators and stuff on Matrix, so what do you do around here jackdaniel? Just curious.
11:04:05
jackdaniel
it varies. I suspect ABCL uses whatever Java provides, SBCL has implementation written in Common Lisp, ECL has implementation written in C
11:05:39
jackdaniel
if you wonder whenever I'm channel operator it happens that I am (though I think I've never used the privilige)
11:07:24
jackdaniel
here is HT implementation used in ECL: https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/c/hash.d
11:16:02
theemacsshibe[m]
Does it make some kind of link to the comment? Never been on the receiving end of one.
11:16:52
foojin
At least it's not a link to an empty page with a huge wad of minified JS. Even curl just prints out the contents.
11:17:52
foojin
It's visible to everyone on the channel, right above your "My God, what have I done?" message.
11:19:24
foojin
theemacsshibe[m]: Ah, so there's a service that converts you messages made through that Matrix thing and posts them here?
11:20:49
theemacsshibe[m]
I use it for a lot of channels. I don't want to feel the wrath of jack, so I'd rather talk about matrix some other place.
11:22:12
foojin
Ok, I won't inquire further then. There are usually bots which do things like these, so that was my first guess.
11:22:49
pjb
DemolitionMan: design pattern are macros. Lisp calls them macros. cf. https://www.informatimago.com/articles/usenet.html#Object-Oriented-Programming
11:24:33
pjb
DemolitionMan: said otherwise, lisp has had design patterns (done correctly) since 1964, while people working with other programming languages had to work 30 years (with teachers, students, "research", PhD, books, editors, and so on, a whole cottage industry, working to archieve… nothing (well, something that was known since 1964, good work guys!)).
11:25:15
pjb
DemolitionMan: of course, in our capitalistic system, all this increases the GDP, so everybody is happy. In the meantime, we're still waitting on our flying "cars", and Moon and Mars bases…
11:26:07
pjb
theemacsshibe[m]: I notice that org-mode has better -to-pdf results (since it goes thru LaTeX, the output is nicer).
11:27:08
pjb
theemacsshibe[m]: I like reStructuredText, but when you write it to generate PDF, you have to add a lot of not-nice "tagging". So I think I'm converting to org-mode.
11:29:17
pjb
theemacsshibe[m]: myThing comes from perl (AFAICS). It's a convention used to denote local variables.
11:30:19
pjb
yes, this comes from C++, where variable members are often prefix with m (or sometimes _).
11:31:17
pjb
This is to avoid shadowing the members by parameters foo(int p){ _p=p; } instead of this->p=p;
11:31:53
foojin
BTW does learning design patterns give one a sort of "architectural insight" into software design?
11:31:54
flip214
schweers: pjb: pandoc can convert RST <=> org <=> Markdown etc., good enough for most uses.
11:32:11
foojin
I often find myself unable to come up with ways everything should fit together, even though I'm quite capable of writing and refactoring functions. Maybe that's one of the reasons I'm still stuck with fixing someone else's code.
11:33:24
pjb
foojin: yes, reading the GoF book is not a bad idea. But as lisper, take it as a good exercise to write the macros corresponding to each design pattern.
11:33:38
schweers
to clarify, I mean the sort of scoping that OO languages often introduce by introducing member variables into the scope of methods. Now that I’ve written this, I realize that this is nothing more than lexical scope. So ignore my question ;)
11:35:11
pjb
schweers: well this is a good question. In CL it's solved with with-slots and with-accessors. It doesn't need to be automatic. So it probably has a name.
11:36:18
schweers
well it is basically lexical scope, but then again, OO languages often have ways to clarify which foo is meant. If `foo' is a member variable, then foo may refer to something different than this.foo. or this.that.something_other.foo
11:36:32
foojin
schweers: IMO in languages like Python, where you can just add members at runtime and have them visible, lexical scoping doesn't really cut it. I think it just uses a dict there.
11:38:29
foojin
flip214: I tried to do that several times but it always ends up with me finding the result too ugly to improve. Lisp macros seem like a nice solution to my problems, so I'll definitely try to write something with it.
11:39:05
p_l
ACTION always got the feel that for supposedly hating monkey patching, python is most full of it
11:40:05
pjb
↻foo↺ ⇽foo⇾ ⎏foo⎐ ⟃foo⟄ ⦦foo⦧ ⦨foo⦩ ⫍foo⫎ there are a lot of left/right pairs in unicode:
11:52:18
flip214
and now, please do the same with UP and DOWN, so that multi-line forms like "(PROGN" and ")" can be properly framed ;)
11:53:32
pjb
flip214: notice already that there are the vertical left/right. I used them once in C programs (with compose in emacs, to substitute for {}). ︠︡︢︣︤︥︵︶︷︸︹︺︻︼︽︾︿﹀﹁﹂﹃﹄﹇﹈
11:54:01
pjb
I mean, since a lot of C style put a single bracket on a line, using ︷ and ︸ made sense…
11:59:06
foojin
Given the complexity of Unicode, there should be special tools that check the source code for things like "invisible" characters.
12:01:58
pjb
foojin: you can have fun right away: https://www.voltage.com/technology/a-clever-use-for-u202e/
12:06:44
foojin
pjb: People at least have bookmarks to defend against this. Someone who applies a patch sent to him doesn't.
12:06:50
foojin
Add an innocent unicode character in a comment and you even have a "reason" for using Unicode.
12:07:41
pjb
(mapcar (lambda (s) (map 'list 'char-name (symbol-name s))) '(innоcuous innocuous)) --> #|in clisp|# (("LATIN_CAPITAL_LETTER_I" "LATIN_CAPITAL_LETTER_N" "LATIN_CAPITAL_LETTER_N" "CYRILLIC_CAPITAL_LETTER_O" "LATIN_CAPITAL_LETTER_C" "LATIN_CAPITAL_LETTER_U" "LATIN_CAPITAL_LETTER_O" "LATIN_CAPITAL_LETTER_U" "LATIN_CAPITAL_LETTER_S") ("LATIN_CAPITAL_LETTER_I" "LATIN_CAPITAL_LETTER_N" "LATIN_CAPITAL_LETTER_N" "LATIN_CAPITAL_LETTER_O"
12:07:41
pjb
"LATIN_CAPITAL_LETTER_C" "LATIN_CAPITAL_LETTER_U" "LATIN_CAPITAL_LETTER_O" "LATIN_CAPITAL_LETTER_U" "LATIN_CAPITAL_LETTER_S"))
12:09:12
pjb
foojin: this is something you could write as a small extension to emacs. Scan buffers for homographs.
12:13:16
pjb
Not necessarily. The source can be written by russians in cyrillic, or japaneses, or chineses.
12:24:58
foojin
I still think that it has no place outside comments and string literals. It's only a small step from an agreed-upon programming language to an agreed-upon naming convention.
12:29:56
schweers
I wonder whether russian and/or asian programmers use non-english names in programming.
12:33:47
foojin
schweers: Of course. I tried to port an emulator written by someone like that from JS to C and found out that only clang is capable of compiling it.
12:34:54
foojin
Yep. I still haven't really touched most of his code, save for operator substitutions, so it would take a while to make it build under GCC.
12:35:51
foojin
It taught me to compile with different compilers just to see the warnings produced though.
13:08:54
pjb
schweers: even latin-based natural language writers may have difficulties mixing their language with english-based programming languages.
13:09:37
pjb
schweers: as a French, I prefer in general using only English in my programs, to keep the consistency with the English keywords and the user identifiers.
13:10:09
pjb
However, there are circumstances, where it would be preferable to use native language identifiers.
13:11:41
schweers
although it can be problematic when people don’t know english well enough to give proper identifiers. I saw a variable once, which was supposed to hold a current value (of a measurement) which was named actual_something. In german the word „aktuell“ means „current“.
13:13:39
pjb
Macron said to the Austrian prime minister that his wife was delicious. But that doesn't mean exactly the same in French and in English :-)
13:16:42
pjb
literally, it means good, tasty. But une "femme délicieuse" means a "delightful wife", while a "delicious wife" is more lewd.
13:17:26
schweers
yeah, I got why it’s inappropriate to call his wife delicious. just didn’t know what it would have meant in french
13:18:56
pjb
It wouldn't be bad, it could be excused, if it wasn't for the personality of Macron, the banksters' puppet.
13:50:30
beach
Depends on your implementation. Line information is not so great, you want position of the start and end of the expression being evaluated.
14:01:09
schweers
does anyone know why SLIME sometimes indents a macro use correctly and sometimes does not?
14:01:41
schweers
I defined a macro and used it at one point, indentation worked (oddly enough it did before I defined the macro). Now it does not.
14:02:41
schweers
well, I have them in two packages, but I use the macro as (packagename::macroname arg1 body)
14:09:15
schweers
weird. I restarted the lisp image, same problem. moved it to the same package and now it’s fine.
14:09:33
schweers
Which is okay in this case, as it actually belongs in the package where it is used, but still ...
14:11:50
jdz
schweers: before the code is loaded I bet indentation is based on the name (starts with "with-").
14:12:50
schweers
anyway, I was thinking it may be well known. I guess it’s a little tricky to debug it now.
14:39:23
Ukari
it is a good idea to use (make-symbol "name") instead of (gensym) in defmacro for a better debug experience?
14:40:11
Bike
i find it a bit confusing in the case of e.g. nested macroexpansions, where they'll have distinct symbols that look the same
14:47:00
beach
I once had a student who used only one-letter variables, thinking it would take up too much memory otherwise.
14:48:46
phoe
I once read about a Russian who defined a C macro `#define RETURN(x) return x; }` - including the closing brace, thinking all the closing brackets would take up too much hard disk space otherwise.
14:50:47
schweers
When I started programming (in C/C++), I used the built-in smaller integer types whenever I felt they would be enough. So my code was riddled with 8 and 16 bit ints. On the stack, no less!
14:54:53
syncriix
I have a lot of tasks to sort in emacs, like a few thousand... and I want to sort them by TODO state, Priority and alphabetic order
15:33:17
jeosol
beach, I am doing ok. Finally was able to submit my challenge abstract, waiting for reply.
15:33:46
jeosol
you guys were great help in resolving a bunch of issues, code runs steady, clean, with a lot less problems.
15:35:14
jeosol
This question is probably for the web channel if there is one. I am trying to now add a front end interface. I delved into angular 4 last few days and I almost lost my mind with the unnecessary complexity. I would prefer to stay in lisp
16:38:14
Ukari
`(funcall (lambda () (or (values-list (list)) "hi")))` and `(funcall (lambda () (values-list (or (list) (list "hi")))))`
16:43:18
Ukari
i ask this because the condition that (funcall (lambda () (values))) returns no value while (funcall (lambda () )) returns a NIL
16:44:24
beach
So you just want an example of something similar that would return more than one value?
16:44:32
Ukari
so i want to make (funcall (lambda () (values))) also returns a "NIL" when I defstruct a NIL-struct instead of NIL
17:05:18
foojin
Ukari: Do you have a special ship just for this? With nothing to map over, there's no way to create something sensible for a more complex definition of nil-ship.
17:06:10
foojin
Ukari: You just happen to have something which always turns out the same when constructed.
17:12:47
foojin
Ukari: So I recommend describing the actual problem instead of oversimplifying to the point of the resulting example becoming useless even under its own constraints.
17:13:56
Ukari
it is my fault, i don't like the code style in test-wanna-1 due to it need to do one more step to make a single element list. so i use (or (values may-nil) single) instead and find that it don't return multiple values anymore in this code style
17:33:30
shka_
i want function that will, after accepting full lambda list return me list of optional arguments, key arguments, aux arguments…
17:33:32
foojin
Ukari: First of all, why do you even bother with returning values if you end up collecting them in a list anyways?
17:35:55
Ukari
i am trying to make a generator which needs to transform "return values" in generator function to "iterator objects", something like `function* a() {return 1}; a().next()` in javascript
17:39:09
shka_
Ukari: i did something like generators, simply made syntax like clojure loop, but i save arguments in closure on recur and instead simply jumping to begin i return value
17:46:30
Ukari
shka_, (setf gen (lambda () (funcall (lambda (store) (lambda () (incf store))) -1))) (setf next (funcall gen)) (funcall next) ?
17:48:17
shka_
first function establishes lexical binding for inner function, inner modifies bindings and returns value
17:50:38
shka_
anyway, in use: https://github.com/sirherrbatka/cl-data-structures/blob/df228a268e7ab3478cbf59b71ecdaead0e3edbe1/src/api/expression-tests.lisp#L34
17:50:46
foojin
Ukari: That doesn't look like what you can write in JS and Python (this probably can be done with macros), but if you don't care about keeping the style, it would do just fine.
17:53:30
shka_
traverse will work like (map nil ...), to take just one value you can use cl-ds:consume-front
18:48:18
flip214
> asdf/backward-interface::*deprecated-function-style-warning-enable-asdf-binary-locations-compatibility-notified-p*
19:01:18
defunkydrummer
flip214: i prefer verbose names; and BTW deprecated-function-style-warning-enable-asdf-binary-locations-compatibility-notified-p is still short for Java standards, comparatively
19:02:09
defunkydrummer
flip214: still much better than Java's InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
19:02:21
defunkydrummer
flip214: For real. Take a look at: https://github.com/zxlooong/jdk16045/blob/master/com/sun/java/swing/plaf/nimbus/InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState.java
19:07:47
sunshavi
jackdaniel: an example near to this layout on McCLIM? https://i1.wp.com/qt-project.org/doc/qt-4.8/images/mainwindowlayout.png
19:12:08
jackdaniel
or, if you feel fancy, you may experiment with bbpane (black board pane) which is a "floating" layout (as in opposed to "tiling")
19:22:55
sunshavi
jackdaniel: wanna see the same layout on commonQt. I have found and example on the network?
19:34:45
sunshavi
jackdaniel: see this if u have time (if commonQt installed): https://transfer.sh/dE0xc/holanombre.lisp
19:40:38
jackdaniel
if commonQt works for you and McCLIM doesn't – go for it. I don't think there is much merit in picking wrong tools just for a sake of being lispy
19:44:29
sunshavi
jackdaniel: actually I am trying to check both (commonQt, and McCLIM). commonQt seems quite fine for this kind of layout. I just want to invest a couple of hours and see if I could come with something similar to that with McCLIM.
20:26:59
Bike
(cons nil nil) is a call to the function called CONS. (nil) is a call to the function called NIL. simple, yes?
20:30:15
Bike
(cons nil nil) calls the cons function. the cons function returns a list. that list is then passed to the length function.
20:33:12
loginoob
so anything inside a list like here (Something) will be considered a function call when not in quotes
20:35:04
Bike
or another operation, if something is a macro or special operator. but that is the basic syntax, yes.