freenode/lisp - IRC Chatlog
Search
9:58:17
dim
elderK: well I would say that the point about macrolet usage in macros is pretty advanced stuff, maybe the call-with- trick is a better way to get starting with macros
9:58:40
oni-on-ion
i am wondering to myself why lisp-1 would be annoying where lisp-2 is nice, because who names functions and variables the same without introducing obfuscation? and is that actually a more frequent requirement than working with functions without special [fun]calls?
9:58:52
elderK
dim: I'm not sure if what I'm trying to make is considered "more than what a newcomer could do" or not D:
9:59:06
elderK
Life would be made a lot easier if I used alexandria, but I would like to stick to the core language for now.
9:59:31
dim
well if you're having to use macros, it qualifies at more than what a newcomer is expected to play with I would gather
9:59:53
fiddlerwoaroof
oni-on-ion: honestly, something like (swap (list) (list* (cadr list) (car list) (cddr list))) reads just fine
10:00:22
fiddlerwoaroof
For it mirrors noun/verb ambiguity which generally isn't a cause of misunderstanding
10:01:34
fiddlerwoaroof
The compiler can check the symbol's function cell to see if a function has been defined
10:01:37
oni-on-ion
i asked schemers "why is t #t and not t?" and they say "because you might want to call a variable t" . cringe
10:02:12
aeth
oni-on-ion: Implement <insert formula from physics here> and you probably want to use the variable name t
10:02:24
fiddlerwoaroof
Also, there's plenty of ways to avoid funcall: FLET/LABELS or write a bunch of combinators that take functions and return lambdas
10:02:30
aeth
oni-on-ion: And even worse, if it's from mathematics closely related to physics, it is just t, it isn't time
10:03:02
oni-on-ion
aeth: thats a real reason? i use t all the time. but there are other letters. it feels like you could be suggesting "why not have a (varcall x)" then !
10:03:16
fiddlerwoaroof
e.g. (funcall (over (juxt #'car #'cadr)) '((1 2 3) (2 3 4))) ;; => '((1 2) (2 3))
10:03:23
oni-on-ion
or; why are functions especially-accessed instead of variables ? what if it were the other way around?
10:04:35
aeth
oni-on-ion: It's more like if a language used both "pi" and the actual greek letter "π" to mean something unrelated to the constant. I mean, sure, you could call 3.1415... something else, but the clearest name is probably pi.
10:05:10
aeth
alexandria:lerp uses v but literally all material everywhere else will use t here: https://gitlab.common-lisp.net/alexandria/alexandria/blob/e5c54bc30b0887c237bde2827036d17315f88737/numbers.lisp#L89-100
10:05:50
fiddlerwoaroof
Anyways, I can say that everytime I write javacript or clojure, I miss lisp-2s
10:06:31
aeth
oni-on-ion: t is basically the one place where Scheme has an advantage over CL against name collisions (usually Scheme's the language with the problem there)
10:07:20
fiddlerwoaroof
Also, a lisp-1 needs a hygenic macrosystem more than a lisp-2, especially if it doesn't also have something like packages
10:19:47
LdBeth
Then you should notice PLT’s macro operates on the “syntax” which automatically provides error checking
11:45:24
minion
progv: PROGV is a testament to the success of synthetic methamphetamines in the rearing and education of the inveterately brain-damaged contributors to the X3J13 standardisation proceedings
12:01:02
ogamita
Yes, harsh. At least for the California side of the comitee. They learned to use LSD creatively there. To wit, Steve Jobs, etc.
12:31:33
larsb
Just wanted to say we do have Muddle running on ITS on a PDP-10 emulator. Come over to #PDP-10 if you want to know more.
12:44:38
jcowan
A more principled Scheme answer would be "Scheme doesn't restrict which identifiers can be lexically bound."
12:59:58
jebes
how does ecl and abcl stack up against sbcl/ccl? I've heard ecl talked about favourably here.
13:01:10
jackdaniel
but ecl may be used to deploy your library as a shared library (and use it from i.e C application as i.e my-library.so)
13:01:20
jebes
jackdaniel: so if i was writing a high performance game/code base, the benefit of ecl's c integration might be outweighed by its speed?
13:03:19
jackdaniel
datapoints: ecl is slow with gf dispatch, we plan to work on it after the upcoming release
13:03:40
jcowan
Does anyone know how to find the "all issues" page in the clhs, or even if there is such a page? Dr. Google not helpful.
13:04:42
jackdaniel
ecl can't save the image (so you don't have save-lisp-and-die, you compile software from files)
13:05:13
jackdaniel
I don't know how fast / slow is ghc or c++ with gcc. compilation time penalty comes from invoking gcc
13:06:22
jackdaniel
you may be interested in talking with dto and borodust on #lispgames (there are others who work with games and lisp, but I know that both worked with multiple cl implementations)
13:12:54
jebes
how hard is it to reduce consing in lisp? Is it possible to get it to 0 or close to zero?
13:17:11
borodust
hi jebes, yes, it is possible to make tight game loops non-consing, aeth is one of the masters of such art
13:17:14
jackdaniel
(one more datapoint: statically-linked application built with ecl when stripped may fit in ~5MB)
13:20:35
borodust
last time i tried ecl was much slower than sbcl/ccl for my grossly unoptimized games, but aeth had very important suggestion i didn't try out yet that might improve ecl performance - for some reason by default cffi defines very slow method of calling foreign code for ecl
13:21:27
jackdaniel
it is indeed around 80x faster, but to make it default I need to work a little on passing original pointer declarations
13:22:41
jackdaniel
(right now cffi, when you declare something to return (char *), passes (void *) downstream to the implementation, what doesn't really work when you compile with C compiler)
13:23:26
jackdaniel
but lately (a few months ago I think) I've managed to make vaarg calls work OK, so it should be already faster with default being :dlopen now)
13:24:33
jackdaniel
nope, dlopen is not default yet, probably because of pointers still not being carried correctly
13:26:14
jackdaniel
but it is not guaranteed to work if you have functions in there which return pointers to something else than void
13:27:38
borodust
well, that's unfortunate, but we will see :) i think it's all :pointer down the road, which i guess is translated to void* anyway
13:29:05
ogamita
jebes: for one thing, it is not specified how much consing an implementation may do. So you can find that a set of functions in CL don't cons on one implementation, but cons on another.
13:29:55
ogamita
jebes: Then, the main problem is that consing and garbage collecting are not costly operations. It's like fork in unix: they're over optimized by lisp implementations.
13:30:14
borodust
ogamita: when building games (or end product in general), we don't care about portability often, because we have a privilige to choose an implementation we want to build end-user executable with :)
13:30:34
ogamita
jebes: So minimising consing means minimising one of the fastest operations of a lisp system, and replacing them by slower operations!
13:32:20
ogamita
jebes: you may have a look at http://cliki.net/Performance, there are some links about making Lisp faster than C.
13:32:35
borodust
jebes: you can write assembly in lisp! ;p see sb-cga which i already mentioned, but please don't :D prematur... well, you know
13:33:18
jmercouris
is creating a bunch of defgenerics an implication to the users who extend a class that they should probably implement those methods if no default implementation exists?
13:33:19
ogamita
jebes: one good trick, is to use pre-allocated objects (eg vectors), and upgraded arrays for things like double-float that would require boxing (a kind of consing).
13:34:18
ogamita
Take a lisp expression, and write a specific compiler generating optimized assembly, knowing your context.
13:36:32
borodust
jebes: e.g. assembly-in-lisp (sbcl-specific) https://github.com/nikodemus/sb-cga/blob/master/ports/sbcl.lisp#L137-L145
13:39:34
ogamita
Yes, the problem with sbcl, is that so many programmers using sbcl don't care about conforming or portability. Of course quicklisp only tests compiling with sbcl. So if you use sbcl, even if you try, you're bound to use sbcl specific libraries and APIs…
13:40:03
jebes
when i write normal non insanity driven lisp, i like to test on multiple implemtatios
13:41:05
borodust
ogamita: well, sb-cga has code for other implementations which makes it portable, it's just helluva lot slower on other ones
13:41:05
jmercouris
using sbcl specific extensions and making your code non portable should be IMO a crime, unless absolutely necessary
13:41:25
makomo
jmercouris: i'm thinking the same thing hah. "restricting" yourself to portable CL sometimes feels like you're missing out :D
13:42:47
jmercouris
because people will basically RELY on SBCL existing and being ported to their platform
13:44:09
jackdaniel
1. official ql policy is that library works at least on two implementations; 2. portability libraries are commonly used (bt for instance)
13:46:47
jackdaniel
" < jmercouris> the only solution is to pull in as few dependencies as possible" sounds super-dramatic to me
13:47:50
ogamita
jackdaniel: well, one problem is that there's no declaration of the supported targets for portability libraries and for cffi libraries.
13:48:30
ogamita
if asdf had such declarations, you could compute the intersection of the supporter targets for all your dependencies. (and find often, that you only have one or two implementations in there…)
13:48:46
shrdlu68
I like to take a look a look at the pgloader issues page because it reminds me of the actual issues I'd run into if I chose to write some tool in CL.
13:50:31
ogamita
Nowadays, you have to choose between C89, C99, C11, C18. Between gcc, clang, icc, msvc, etc; Various version of gcc with different features (and pressed by clang, it obviously adds new useful features all the time now).
13:51:47
jmercouris
though YMMV depending on how you've set-up your data and whether you are using mysql etc etc
13:54:33
jmercouris
All code does really well with ORMs has nothing to do with whether it is functional, it serves as a nice abstraction
13:54:51
jmercouris
I don't want to imagine what the underlying tables look like, I don't care, I am only working with objects
14:03:06
ogamita
Basically, SQL is for RELATIONAL databases. RELATIONAL databases are a good mathematical way to represent data and query it easily. But it is not the way real data in the real world is structured. In the real world, your healthcare file is not stored in tables with the healfcare file of all the other patients. In the real world, it's in a folder and you bring it with you, as an instance of person, to the next instance of doctor, to
14:03:37
ogamita
So basically, what ORM show, is that you should throw away SQL and RDBMS, and get yourself an OODBMS.
14:04:08
ogamita
The other problem that this denotes too, is how (the code of) applications are distributed amongst systems.
14:04:22
pfdietz
It's data as viewed by a large organization, not by a customer. As a customer, you don't care that your data fits (perhaps poorly) into tables with other customers.
14:05:02
ogamita
With a RDBMS, you'd have most of the logic of your application in stored procedures. With OODBMS, it's in methods of objects. But you need a OODBMS that can store objects with their methods in the database, and run those methods on any processing CPU that access it!
14:06:28
ogamita
As you can see, quite a mess. By the way, java (and applets) could be used that way. But there are no such system in use. The web ate java and applets, digested it, and threw it away, replacing it with ecmascript. (so called "javascript").
14:07:24
ogamita
But my point is that even OODBMS have difficulties because of this running of methods in the processing CPU.
14:07:59
ogamita
Or not. After all, with mobile applications, you often have this model where only the UI is on the mobile, the processing is done on the backend thru the web API.
14:09:10
ogamita
Now, perhaps you could do something usable, by hooking Common Lisp as stored procedure language in Postgresql.
14:09:37
ogamita
p_l: it's to run lisp program eg. in ecl on Android, and interact with java over a socket to do the UI in Android.
14:11:27
p_l
why not use JNI and possibly ring buffers (especially if shared data structure could be done)?
14:13:54
ogamita
well, you'd have to use libecl in that case. I feel safer with a separate process and sockets.
14:18:36
p_l
but it gets you idiots who read a header "R3 Corda used in finance..." and immediately look for "FEDCOIN" to invest into ;)
14:19:20
jebes
i do not feel comfortable being grouped in with people that use blockchain unironically
14:29:09
elderK
Well, after a few hours, here is my first "shot" at a set of macros: https://pastebin.com/wHu3kSu3
14:32:56
elderK
Yes, it does but it destructures. So, doesn't that ensure each "binding" has the correct form?
14:35:28
jackdaniel
(let ((a (foo-with-side-effects)) (b (bar-with-side-effects))) (if (and a b) … …))
14:39:37
elderK
I wonder how you'd do that. You could recursively expand it, or I guess you could have something like (and (setf ... ...) ...)
14:40:09
jackdaniel
there are two ways, either nested let (recursive expansion) or a block/return-from combo
14:41:58
pfdietz
But you can find out, using MACROEXPAND. Each implementation may do it differently.
14:42:58
jackdaniel
(let ((a (or ,form (return-from bam nil)) (b (or ,form2 (return-from bam nil))) …)
14:46:14
jackdaniel
ah, alexandria reserves when-let* for doing it one-by-one (there is no if-let* though)
14:48:54
makomo
jackdaniel: hm interesting. what would the semantics of IF-LET* be though? if one of the variables is NIL, what exactly can you expect to be bound within the ELSE?
14:50:09
makomo
i suppose WHEN-LET* is acceptable because there's really no ELSE. it's just "ok, never mind then"
15:23:56
shka_
and each time he is presenting his work, I think: "wow, this person is working on saving the world!" :D
15:26:36
makomo
+1 from me as well, just watching the talk. great work drmeister, very inspiring! :-)
15:30:17
cage_
moreover i like the fact that cleavir is in the game too, i am always happy when i can see the results of an useful collaboration
15:34:17
makomo
cage_: agreed! this is a very awesome and exciting time for CL -- Clasp, SICL, Mezzano, etc.
15:48:59
cage_
i wish we could use clasp (or ECL, why not?) to target webassembly, unfortunately i am not the person that is able to do that
15:57:42
jmercouris
to which stream can I print so that (print "fish") only returns fish instead of also printing to standard out?
16:00:28
jmercouris
Yes, what I actually want to do is call print-object, and have it only return the string, and not to standard out as well
16:00:31
Xach
if you aren't sure what might be involved in the output process, a string-stream can produce more reliable results
16:00:55
Xach
jmercouris: princ-to-string or prin1-to-string are some other things that can help there.
16:02:10
dim
I like with-output-to-string, in my head it's doing all the optimisation that you get when switching to a StringBuilder API in other languages
16:13:39
jmercouris
here's another question, how can I implement print-object, where it doesn't show quotes?
16:16:22
jmercouris
I want a generic way to get a string representation of an object for printing ina list
16:16:46
Xach
print-object is not a good way to get a string. make your own generic function if you want to ditch the general concept behind print-object.
16:17:12
jmercouris
then I will have to reimplement it as well for all normal data types like strings, numbers, etc
16:18:14
jmercouris
Xach: I thought defgeneric just created prototypes, and no actual implementation
16:18:32
jmercouris
can you make an abstract implementation? like what (defmethod object-string (object object) ...)?
16:19:51
Xach
the point is more that PRINT-OBJECT has the weight of expectations that you should not discard lightly
16:20:23
Xach
one of those expectations is that the object you read back from print-object is the same as what it printed, or there's an error (via the #<foo> unreadable object syntax)
16:21:06
Xach
now, within your own world you can of course do whatever you like! but it is usually better to knowingly break the rules than unknowingly
16:21:24
makomo
jmercouris: in what kind of context will you be using your "OBJECT-STRING" though? if you know you'll be printing buffers, can't you directly just print (name buffer)? if you don't know you'll be printing buffers, of what use is just printing its name (i.e. you won't know whether it's a buffer or not)?
16:23:21
jmercouris
makomo: I pass a list of objects to a minibuffer for rendering completions, how they are rendered depends upon the object
16:23:37
makomo
jmercouris: so does that mean you'll print buffers as something like 'BUFFER "foo"', to signify that they're buffers? would the unreadable object syntax suffice for that then (or do you want to customize it because you don't like how it looks)?
16:23:40
specbot
Similarity of Literal Objects: http://www.lispworks.com/reference/HyperSpec/Body/03_bdb.htm
16:25:44
pfdietz
There's something categorical about the relationship between equality, copying, hashing, and printing/reading.
16:25:55
makomo
jmercouris: and when you select that completion, what is inserted? the string "www.asdf.com"?
18:03:55
specbot
Similarity of Literal Objects: http://www.lispworks.com/reference/HyperSpec/Body/03_bdb.htm
18:23:22
anamorphic
Is it legit to define a function with its package qualification? e.g. (defun foo:bar () ...)?
18:37:44
pjb
anamorphic: defun doesn't care where the symbol naming the function comes from. The only forbidden symbols for function names are those in the CL package.
18:38:39
Bike
jcowan is talking about the definition of "similarity" for types, which is deffo undefined.
18:39:12
anamorphic
That makes sense... thanks. I guess if you want foo:cons, you'd have to have package created with (:shadow #:cons) ahead of time
18:39:33
pjb
(defun type-equalp (a b) (and (subtypep a b) (subtypep b a))) #| more or less |# (type-equalp 'character 'base-char) #| --> t ; t |# in this ccl.
18:40:56
pjb
Well then it's easy: types are not first class objects, so they cannot be saved to compiled files or loaded.
18:42:33
Bike
jcowan says the definition of array similarity depends on the definition of type similarity. there is no latter. Problem.
20:30:51
dtornabene
its the third time I've tried to install it and I hit different bugs each time, decided to just move on
20:31:52
anamorphic
You don't need roswell for lem, but if you do it will create a few commands for you to start it from the command line more easily
20:35:56
dtornabene
I guess its not right to say that the *roswell* install failed, it was actually choking on the lem install
20:51:45
dtornabene
i've been awake for almost a day at this point so I wasn't super motivated to try and chase it down, that and this being the third time, and that it was a lark
21:02:59
dtornabene
anamorphic: nothing there either, haven't used that function before, I'm assuming that it means I'd need to already have a version cached in local projects before I "register" it?
21:03:50
anamorphic
Yeah, so under ~/.roswell/local-projects, do you see a path structure like: cxxxr/lem ?
21:08:12
dtornabene
I mean, I hadn't tried to build it outside of the 'ros install cxxxr/lem' process
21:08:58
anamorphic
Ah OK. If you're not using roswell, just cd into ~/.quicklisp/local-projects and git clone https://github.com/cxxxr/lem
21:12:20
anamorphic
Hmm can you past the whole thing? Do you have the ncurses headers installed? On debian/ubuntu you need apt install libncurses5-dev I think
21:18:33
anamorphic
I'll try a new git fetch locally and see what happens. Maybe it dosn't build on master right now
21:26:17
anamorphic
I think you can check by looking in ~/.quicklisp/lisp/quicklisp/dists/quicklisp/software/ ..
21:30:44
dtornabene
a little embarrassed that everything was so out of date, shows how little CL I've been writing
21:34:00
dtornabene
so, I'm assuming since I'm in a repl at the moment, to use it I have to back out of the repl, and load a file with it from the commandline
21:35:07
anamorphic
Once your in lem though. you're still in the CL that you started it from, so you can just switch to using lem's slime-like repl
21:35:25
dtornabene
well I'm in, and there are errors on the screen, looks like slime is mad at lem, or something
21:37:54
dtornabene
anamorphic: is it reading all of the modes I have installed for my system emacs?