freenode/#lisp - IRC Chatlog
Search
9:15:14
dim
I think that's the classic compiler bootstrapping, in 3 stages, right? (I kind of remember that from classes ~20 years ago)
9:19:25
beach
dim: My initial plan was to define some kind of order between modules, so that one could start with some minimal Common Lisp implementation and then load modules in that order. However, that turned out to be too painful because one would have to keep track of what subset of Common Lisp to use for each module.
9:19:26
beach
Also, the maintainability of the code would suffer from not being able to use the full language. So I abandoned that idea.
9:27:45
dim
yeah, and it's not like you are pioneering CL anymore, you can trust/depend on having a good solid first implementation of the standard to use ; hell you even have a choice of Open Source solutions
9:34:37
beach
There is not an executable file named `sicl' that you can start by typing `sicl' to your shell prompt.
9:37:16
dmiles
ah I thought it was when you said the executable image is supposed to be a complete Common Lisp implementation, so it can't depend on any existing implementation.
9:39:15
beach
It becomes too boring to write things like "the executable image (should I live long enough to make the bootstrapping procedure complete enough that such an image might actually work)...."
9:46:24
dim
so SICL is about being able to write a full CL implementation in (only) CL, and with native first-class environments and some other nice improvements to the current standard, is that right?
9:47:18
beach
Right. The first-class global environments were invented mainly for the purpose of bootstrapping, but they can obviously be used for other purposes like sandboxing.
9:48:33
beach
There are very few "improvements to the standard". Mainly implementation techniques that I hope will be better than what currently exists. Like the fast dispatch technique, and the implementation of the sequence functions.
9:53:14
dim
in my book having generic “APIs” over sequences and streams (ala grey streams but natively so) and maybe hash table functions would be significant improvements to the standard “grey areas” (pun intended)
9:56:47
dim
I wonder if stream level abstractions make sense for higher level (network) protocols, such as MySQL or PostgreSQL protocols
10:25:38
Shinmera
For instance you could model exchange protocols with streams that emit objects representing messages.
11:04:54
ebrasca
I have write http://termbin.com/b11k but for some reason don't give expected checksums.
11:17:36
stylewarning
ebrasca: if you’re using SBCL there’s a dedicated function for that in the module SB-ROTATE-BYTE
11:19:54
stylewarning
ebrasca: then it might be worth abstracting it into a portable function and implementing the assembly code for it! :D
13:05:52
megachombasss
hello guys. do you see any redundant code, errors, or things i could do in other way in this code? https://codepaste.net/bc72wz
13:08:34
beach
And it's a bad idea to use identifiers in some language other than English, especially if, like now, you want an international crowd to understand it.
13:09:42
beach
Don't use the "get-" prefix in Common Lisp. Don't use the "is-" prefix either. Use the "p" suffix instead.
13:14:33
beach
Emacs indents three semicolons so that they are at the left margin, but two semicolons so that it is indented with the code.
13:15:04
beach
CamelCase, is when you have a capital letter in the middle of a word, like resolutionEtiquette.
13:15:38
beach
In Common Lisp, we don't use CamelCase. Use resolution-etiquette, or rather resolution-label instead.
13:17:05
beach
megachombasss: Perhaps it is a problem with TAB characters. In that case, make sure you don't use TABs in the code.
13:17:55
beach
megachombasss: Some paste services can handle it. Some others can't. It is best to avoid TABs.
13:19:29
beach
megachombasss: Don't use the "set-" prefix. Use a SETF function instead. LIke (defun (setf drapeaux) ...). Even better, (defun (setf flag) ...).
13:21:06
beach
megachombasss: So, fix the whitespace, the semicolons, the CamelCase, and the language, and then resubmit.
13:22:03
beach
megachombasss: Also, go read a text book on Common Lisp, and you will see how different their code looks from yours.
13:23:36
beach
megachombasss: What implementation of Common Lisp are you using that it doesn't tell you where it is?
13:24:54
beach
megachombasss: So if you want help, it is better to use one of the more widely used implementations.
13:26:06
Shinmera
You could try https://portacle.github.io, which will ship SBCL and should run without installation or admin privs.
13:27:40
beach
Oh, so I am wasting my time. You are not going to want to learn Common Lisp after this assignment is due. I guess I'll go do something else then.
13:31:39
megachombasss
tbh lisp itself doesnt interest me at all, knowing i have to do this project and teacher didnt give a single course on how lisp works
13:33:12
megachombasss
nono, dont ask you to do my course work (as i literally had no courses about it)
13:34:12
stylewarning
megachombasss: If you’re a beginning programmer, then the book Common Lisp: A Gentle Intro by Touretzky is a great book to teach yourself Lisp. If you know another programming language at an advanced level, then Practical Common Lisp is a great resource.
13:35:23
stylewarning
megachombasss: unfortunately for beginners, it’s easy to write bad Lisp code, with poor efficiency, style, and use of the language features
13:40:02
stylewarning
paule32: Write a function called GATE-EQUAL which tests if two gates are the same for your purpose. Happy to help after you’ve done that and can explain that function to me.
13:40:29
beach
paule32: I am asking you why, despite being told an uncountable number of times, you continue submitting code that does not respect the conventions. I have told you over and over again that it is very impolite. And you keep right on doing it.
13:58:14
KZiemian
do you know that book "Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS" by Sonya Keene is free to download
14:11:00
megachombasss
https://codepaste.net/3nyez7 i dont manage to see where the hell he finds more than 2 params for the if?
14:15:28
pjb
megachombasss: notice, if you used setf as I told you yesterday, and as I explain again in my sprunge, you wouldn't have to call gethash twice, since setf already returns the last value assigned!
14:16:32
megachombasss
wait a sec, the source code of what you've sent me seems exactly as the same i using, hence the one im using wasnt that one
14:17:45
pjb
megachombasss: it looks like the code shown in the error message you get is expanded from a macro.
14:19:42
pjb
megachombasss: when you get an error, you need to locate the source of the error; it's not always the form or the frame the debugger shows; you have to look up in the stack frames, to locate the actual source form or frame where the error occured.
14:22:15
megachombasss
well, the code you just pasted me, its exactly what i need. BUT, they should be more functions in that code
14:23:36
pjb
Youngsters these days! They believe things come from out there, from the Internet, instead of from the brains of somebody, including themselves!
14:26:00
pjb
Well, I don't know, first thing I do when I load bad lisp code in emacs, is C-x h C-M-\
14:33:48
megachombasss
i still have problems with this if clause. source : https://codepaste.net/rodwcr
14:34:07
megachombasss
dont know why it says i have to much arguments for the if condition, when i have 2 in both of them
14:34:59
megachombasss
it isnt that, before putting it "on the clisp standard", i need that the code work first
14:35:20
pjb
megachombasss: it can help to use emacs, with slime and paredit, so that indentation is performed automatically and correctly by emacs.
14:35:44
beach
megachombasss: You don't understand. You are submitting your code for others to read. If you don't follow conventions, you are putting the burden on those other people, and that is VERY impolite.
14:37:55
beach
megachombasss: Then you know that if you want to communicate your code for others to read, it must have the correct indentation, spacing, naming convention, etc.
14:37:58
pjb
megachombasss: for resetMemoire, you need &key or &optional: defun resetMemoire (&key (VM 'vm) (tmem 10000))
14:40:11
megachombasss
well, give me a couple minutes that i fix all this mess, put it in decent clisp lookin, and i come back
14:41:26
pjb
In universities, they should start by teaching emacs, as a prerequisite to any programming courses…
14:42:15
dlowe
One of my "todo" projects is to make a really nice stand-alone source code formatter for CL.
14:46:02
muyinliu
pjb: The Emacs stuff remind me of the early days...It's quite difficult to get used to Emacs.
14:46:03
tazjin
writing executable elisp scripts is trivial and emacs is widely available (and much easier to install than npm and all the rest of that ecosystem)
14:47:12
ghard
Things coud be worse - my daughter has her first programming course in the uni so I had to install netbeans on one of my boxen...
14:52:36
pjb
I don't remember if FizzBuzz Enterprise Edition uses the Interpreter Pattern. Perhaps it can be improved…
14:53:30
ghard
Thing is she's studying molecular biology, not CS so they don't care about programming hygiene
14:53:51
megachombasss
therefore, event with your comments, i have high troubles understanding some of the transformations you recomend me to do
14:54:32
megachombasss
so sir pjb, i would really need asistance of this. im whiling to pay if needed , but i really need to present something for tomorrow
14:54:48
pjb
megachombasss: in C or C++, you would use a struct to define vm? Then use defstruct in CL!
14:55:39
pjb
megachombasss: it's really a programming language just like any other. Since you said you know already four of them, you should be able to jump into CL without any problem. There's nothing different.
14:57:36
zazzerino
megachombasss: the parenthesis are giving you a headache because you're not using an editor that can help you deal with them. You've already been told this but it didn't seem to get though- try using https://portacle.github.io/
14:58:06
megachombasss
not familliar with emacs, and those are the only few installed on these computers
14:58:33
pjb
megachombasss: but if you do, you use it wrong, because it features: * Bracket matching !!!!
14:59:34
pjb
megachombasss: furthermore, it even has a lisp syntax highlighting module: https://ubuntuforums.org/showthread.php?t=2253625
15:00:00
muyinliu
megachombasss: You REALLY need Emacs with rainbow-delimiters, take a look at this: http://pasteall.org/pic/index.php?id=123935
15:01:25
zazzerino
Are there really universities that require Common Lisp for projects but don't allow students to install or use emacs? I find it hard to believe, but I didn't study programming in school...
15:02:34
ghard
Worse - dropping someone into CL straight from imperative languages without giving an initial course first.
15:05:16
rumbler31
There's no way this user hasn't had a lead up of some kind to have to use lisp for their final project. There's no fooling us in that regard. But it is not uncommon for departments to set up hosted machines where students must save and submit their work.
15:12:20
muyinliu
rumbler31: This online-editor is quire poor, without auto-indent or colorful parentheses...
15:13:13
rumbler31
its not great. but its better than gedit, and I can't find the other ones that were fully featured
15:15:11
sebastien_
which GTK+ binding would you recommend for a new application? cl-cffi-gtk or gtk-cffi?
15:16:31
sebastien_
the difference between the two is not obvious at first glance, though cl-cffi-gtk seems more maintained
15:20:22
zazzerino
sebastien_: I don't personally have experience with either, but I know nEXT browser (https://github.com/next-browser/next) uses cl-cffi-gtk
15:25:58
muyinliu
I wrote a Common Lisp CFFI wrapper for GraphicsMagickWand: https://github.com/muyinliu/cl-graphicsmagick
15:29:16
muyinliu
And a CFFI wrap of fswatch, a cross-platform file change monitor: https://github.com/muyinliu/cl-fswatch
15:31:45
rumbler31
I've always wanted to wrap native libs but it seems intimidating. how did you get started? did you leveerage any automatic header file parsing?
15:34:18
zazzerino
rumbler31: cffi has excellent documentation. Something that's nice about wrapping libs in cl is you can do it interactively, and can start with just the functions you need.
15:37:12
rumbler31
shinmera: speaking of which, I know that wrapping c++ libs is a different beast. how did you learn what you needed to know to make it happen?
15:38:19
Shinmera
If you do need to do it though the strategy is simple: write a C library that exposes all constructors, methods, functions, and structs. Then bind that. It's extremely tedious though, so I'd never do it myself.
15:38:44
muyinliu
zazzerino: The demo in CFFI's doc is not complete(especially about how to wrap Windows libs). I have to try my best to collect info from everywhere :(
15:43:35
zazzerino
I found it useful to look at examples in the domain I'm currently working on (audio programming). Tito Latini wrote some relatively simple wrappers for a few c libs for his Incudine library. You can find them at https://sourceforge.net/p/incudine/incudine/ci/master/tree/contrib/
15:48:40
Shinmera
Anyway, even CommonQt didn't really bind C++, it used Smoke which is an autogenerated C wrapper for Qt.
15:51:09
rumbler31
and on another note, I feel that linking c++ libs is more complicated than simply implementing the correct name mangling
15:52:20
Shinmera
And if you want exception handling, you'll need to handle that as well (good luck with that one)
15:53:05
Shinmera
But, even with just name mangling (and thus static dispatch) you can get pretty far.
15:54:56
rumbler31
so if you want to call a constructor for classes with heirarchies and dynamic dispatch, you have to do all that yourself, call the base class constructors in order, wire up the vtables.
15:56:04
Shinmera
if I remember correctly constructors are override unless they explicitly call super or whatever, so you don't need to implement that bit.
16:14:07
beach
It would probably be faster to use my generic dispatch technique than to use vtables.
16:14:42
Shinmera
Yeah, if you replicate the type hierarchy on the lisp side you can implement the dispatch yourself.
16:15:44
Shinmera
Well, the type hierarchy and method attachment (which classes even define a method of their own)
16:16:51
beach
It would be somewhat ironic, though, if the fastest C++ implementation would use a dispatch technique from Common Lisp.
16:18:39
Xach
i would still like to use it to try to make a js interface for non-cl users to customize cl software.
16:19:05
rumbler31
that doesn't help if the library code needs to call the virtual methods, does it?
16:20:14
rumbler31
if library code calls a virtual method on an object you passed it, the resolution of the final function call comes from a callback in lisp, right?
16:24:16
Bike
making generic functions static seems like a bit of an endeavor. And you'd either get a combinatorial explosion or have to assume some aspects of the class hierarchy don't change (you have to assume that anyway, of course)
16:24:19
rumbler31
because the object has a pointer to the vtable, if the library code makes calls to virtual functions, the compiler would have baked in the pointer lookups to the correct call. so what gets given to the library would need to be an object with a pointer to a table of function pointers, and if those pointers resolve to functions in lisp then they'd need to be callbacks
16:30:38
rumbler31
I've typed up several lines. But the only common response among them is "I don't know"
16:32:54
Shinmera
I don't know how exactly it works in C++, but typically a method call with dynamic dispatch works as follows: dereference the object to get the vtable, load the value from a fixed offset in that table for the specific method you want to call, then simply call that value (address) with the rest of the arguments.
16:35:05
Shinmera
If you know 1) what the class hierarchy is 2) which classes define which methods, and 3) what type an object has at runtime, you can replicate the dispatch without needing to even look at the vtable.
16:36:09
rumbler31
hold pointers to the library methods in lisp, dispatch in lisp to the correct calls
16:41:59
TMA
beach: not necessarily faster. it is three instructions (two memory fetches and one indirect call) in the case of single inheritance; it is more involved in the multiple inheritance case and in case of virtual base classes, but it is hard to beat the performance of the simple case
16:50:26
TMA
beach: I think I have read someone verifying the speed of lisp's generic function dispatch and c++ vtable lookup dispatch, but that was a long time ago and moreover not entirerly the same thing. (so yes, someone would have to verify that)
16:51:11
beach
If you read it a long time ago, then the Common Lisp way was using hash tables which is slower than my technique.
16:51:30
zazzerino
Does anyone know of a common lisp library similar to clojure's hugsql? (https://github.com/layerware/hugsql)
16:54:45
beach
rumbler31: scymtym has some benchmarks showing that it is significantly faster than the PCL technique, which is used by SBCL among others.
16:55:40
Shinmera
scymtym: Speaking of SICL dispatch in SBCL, what are the roadblocks to getting that merged in?
16:56:59
beach
Shinmera: The SICL technique as documented requires classes to have unique numbers (that change when the class is redefined). SBCL doesn't have that. So, as I recall, scymtym is using the address of the class metaobject instead.
16:57:10
rumbler31
iqubic: no but installing anything with quicklisp might, such as the slime-helper
16:57:53
beach
Shinmera: So, either you convince the SBCL maintainers to introduce class numbers, or you make them swear that classes will never move. None of which is going to happen.
16:58:24
rumbler31
iqubic: or more esoterically, if for some reason you've brought your loopback interface down, you'll have silent errors that will confound you for a little while, so don't do that ;-)
16:59:33
scymtym
beach: it's more nuanced than that in both regards. as i said at time, the benchmarks are not ideal and it cannot be concluded that (my variation of) fastgf is significantly faster in all cases. secondly, the dispatch i implemented uses multiple kinds of decisions, based on lowtags, widetags, layout addresses, EQ-comparisons and EQL-comparisons
16:59:58
rumbler31
iirc the symptom is that there is no error when opening the socket, so swank starts fine, but nothing can connect, so slime connect fails.
17:02:10
iqubic
loli: My main issue is wanting to pass a list to a function that only takes &rest params.
17:03:01
scymtym
beach: it wasn't, of course. and i'm not denying that fastgf is or can be faster than PCL. in fact i believe that is the case. i'm just saying that the benchmarks i did so far are not sufficient evidence for that conclusion
17:03:27
Bike
(apply #'+ (number-sequence 1 100)) can be better done as (/ (+ (* 100 100) 100) 2), natch
17:05:37
beach
scymtym: Do you share my sentiment that it would be hard to convince the SBCL maintainers to do what it takes to support a good version of my dispatch technique?
17:07:08
Bike
reduce works if the function is associative and such, but in general, if you have a list you want to pass to a function as arguments, that is what apply does
17:11:06
scymtym
beach: since i am an SBCL maintainer, i could, in theory, undertake that myself and i don't think anybody would object. that said, this would probably be the biggest and most invasive change since i started working on SBCL and i often had trouble getting much smaller things to a point where i could merge them
17:11:58
Bike
i was under the impression that sbcl classes had "layouts" that can be used similarly for obsolete instances. could you see how it goes just using eq comparisons of those instead of small integers?
17:12:14
scymtym
beach: maybe when some other implementation completely embarrasses SBCL in terms of generic dispatch performance, stassats could become interested
17:16:06
scymtym
i think, layouts already have a CLOS hash or similar in them. so that could be used. but doing any sort of range optimization would be out of the question
18:46:10
warweasle
rumbler31: They didn't want to take time to make it. Programmer's will just have to walk to the lab.
20:25:32
Xach
Does anyone here have a project in quicklisp and want to monitor its build failures through RSS?
20:32:59
specbot
Additional Constraints on Externalizable Objects: http://www.lispworks.com/reference/HyperSpec/Body/03_bdd.htm
20:34:55
pjb
jasom: I guess you could write a make-load-form for hash-table. Also, the keys and values would have to be externalizable.
20:37:08
jasom
pjb: well if ABCL allows defining make-load-form and all other implementations don't need make-load-form, I have a workable solution
20:42:03
jasom
pjb: actually in this case load-time-value is the exact opposite of what I want. I want it to be evaluated at compile time, not at run-time.
20:42:11
pjb
megachombas: also, you may want to finish output with a newline, and to flush the buffer with a call to (finish-output).
20:43:22
pjb
Notice that hash-tables have attributes that are not always visible, such as :size, :rehash-threashold, etc.
20:43:46
megachombas
actually i want to know what is passed as param in a fuction, to be able to copy this parameter and load that fuction by hand
20:45:24
pjb
megachombas: the advantage of print is that it returns its first argument so you can use it in expressions: (if (print (= (print a) (print b))) (print 'same))
20:46:01
pjb
The inconvenient is that it only prints the argument, so if you have a lot of them it may be confusing.
20:47:14
pjb
I have a macro (com.informatimago.common-lisp.interactive.interactive:show expression) that prints expression = value and returns value so it can be used as print, but its output is clearer.
20:53:45
pjb
megachombas: in C, would you write: print(list a,b,c) or print(list(a,b,c))? Would you forget the inner set of parentheses?
20:59:27
pjb
megachombas: Call the function list with as arguments 'foo a b and c is written ( =call list 'foo a b c )=end of arguments.
20:59:56
pjb
call print with as arguments (list 'foo a b c) is written (print (list 'foo a b c)) not (print list 'foo a b c)!
21:02:22
pjb
clisp contains a good tutorial: https://sourceforge.net/p/clisp/clisp/ci/default/tree/doc/LISP-tutorial.txt
21:08:40
jasom
Consider the output of this form with *print-circle* set to t and nil: (let ((x (gensym))) (list x x))
21:13:33
jasom
whatever you are interacting with is generating output that includes uninterned symbols. These are confusing if you are new to lisp, so just enable *print-circle* for now if you want to be able to paste the output and have it read in correctly.