freenode/#lisp - IRC Chatlog
Search
15:05:45
Xach
borodust: however, i need to work on having proper expectations and understanding of how things work before reporting things as bugs
15:06:02
beach
fourier: (first) Climacs works, but it isn't good enough for what I want. So I am working on Second Climacs, which will have a much more sophisticated incremental analyzer of Common Lisp code.
15:11:11
Xach
borodust: i started a window with a little demo code that draws a square at the mouse cursor. when i close the window and try to re-start it, i end up in the debugger.
15:18:38
borodust
Xach: ah, i see, it isn't quite stable in this regard at this moment and there known problems when engine is restarted several times per image (probably due to a resource leak). Does this still happen if you close window with #'gamekti:stop?
15:20:11
borodust
Xach: also, I recommend binding input inside #'post-initalize function https://borodust.org/projects/trivial-gamekit/manual/#gamekit-post-initialize
15:30:56
Xach
borodust: gamekit:stop allows for restarting. closing the window with the window controls does not. (this is with latest updated dist)
15:37:26
borodust
Xach: it will probably reappear if you try to close window and call #'start around the same time
15:59:26
jmercouris
Goal: Move element to the beginning of list, What would be the better approach: Make a copy of the list with the element in the first position, Modify list in place with car/cdr, Anything else?
16:03:31
jmercouris
That's a good question, I'll give some more specifics, the list is between 0-50 elements, frequently changing in size
16:03:48
beach
If the element is already at the beginning, do nothing. Otherwise, find the CONS cell that precedes the one containing the element. Short-circuit the list using (setf cdr). Finally link the unlinked cell to the beginning of the list.
16:04:35
pjb
Can it contain duplicates? Is it shared (do you have multiple references to its cells)? Are there multiple threads accessing it in parallel?
16:05:28
jmercouris
pjb: There is only one master reference to this list, no one may delete something from this list without using this lists reference
16:05:38
beach
Or, if you don't care about the order of the remaining elements, swap the first element with the one you want to move.
16:06:30
jmercouris
I think the term is something like spatially recent, it's on the tip of my tongue
16:07:00
jmercouris
pjb: The threads have reference to the individual elements, I would rather not create/destroy the elements, only change the list itself
16:07:26
pjb
jmercouris: also, you said that the size changes. How (what thread) do you remove elements?
16:08:35
jmercouris
so I always do something like this (setf listy (delete delete-this-element listy))
16:09:09
pjb
If you already use delete to delete them, then (setf list (cons element (delete element list))) would be a consistent way to move it to the front.
16:09:46
jmercouris
Well, this operation is not executed more than lets say once a minute, and the list is small
16:10:45
jmercouris
but if the elements within the list are large, does this affect the speed of the creation of the list? I cannot see why it would, but maybe there is something I dont know
16:11:40
jmercouris
Yeah, I have a reference always to the item I want to move, so I can leave it at eql
17:38:42
dim
oh, or maybe you mean something else, I use Github Pages but with a local static HTML toolkit: gohugo (used to be home made CL code but I don't care about maintaining that)
17:38:56
fourier
```lisp does not really work for me... maybe theme prevents it ? i'm using minima theme.
17:48:05
jmercouris
1. I have a GUI that has a textbox, 2. I can only prompt the textbox for its value, 3. I recieve all keystroke events in my program 4. I want to make a blocking read/input function similar to on a terminal, 5. do you think I should use a semaphore to do this?
17:51:43
shka
but don't create more threads then you need (that would be one for GUI and one for internal logic)
17:53:21
jmercouris
Here's what I am doing: https://gist.github.com/944e60992fd391fc9008485788342ce6
17:55:18
jmercouris
So, my current solution is entirely non-blocking because I pass a reference to a function which I call at some point in the future
17:55:30
jmercouris
I think that a blocking input solution is good for a lot of simple little functions
17:57:03
shka
blocking threads leads to more threads, more threads leads to more locks, more locks lead to problems and performance degradation
17:57:49
fourier
should you maintain a stack of ui elements, whoever on top should receiev all events and propagate to the next on stack if they are not consumed?
17:58:44
jmercouris
shka: Given this very simple function: (defun name-food (name food) (print name) (print food))
18:04:37
jmercouris
of course this example is quite trivial and doesn't require chaining, but what if the second input depended on the first in some way
18:07:41
jmercouris
but the function should be able to be given name and then do any arbitrary processing before asking about food
18:08:55
jmercouris
I mean certainly one could write a function like (defun name (name)) and then (defun name-food (name food)) where after executing name, it would call name-food with the value of name, but passing state between those two defuns would be exceptionally complex
18:11:47
jmercouris
I mean compare the left hand side to the right hand side for so many of the examples :https://en.wikipedia.org/wiki/Continuation-passing_style
18:13:01
jmercouris
maybe there is a way I can write a macro that intelligently breaks apart calls somehow to avoid blocking
18:13:19
nyef``
Heh. And the occasionally-tried approach of doing the CPS-conversion automatically has its own drawbacks.
18:23:37
jmercouris
shka: Concurrency is its own kind of bullshit, but maybe I don't have to worry about that, when the system is getting input, maybe it should block
18:24:01
jmercouris
ah shit, if a function from the GUI thread were to call for input, that would be a disaster
18:25:43
jmercouris
Maybe I will just focus on making the chaining simpler through the use of some macro
18:25:58
jmercouris
it won't attempt to automatically convert the code, but at least make a simpler syntax
18:27:51
fourier
wrote down some of my tests with SERIES package: https://fourier.github.io/lisp/2017/12/17/series.html
18:30:30
fourier
yep, but my point in general that I write in a highlevel functional style and dont give up on performance.
18:31:36
fourier
I'll try to rewrite some loops in my libraries with it and see if it makes it more readable and optimization still holds
19:46:15
jmercouris
Can someone explain what's wrong with this code? https://gist.github.com/e0f61735782211eae4bd2a512d87269c how is NEXT-APPLICATION undelcared?
19:47:23
fourier
im more interested in something like rxjava though, of the same quality. they took it into java9 now. I started to look at series thinking it is something similar but it is not (and cells is a dead project)
19:49:10
aeth
hah, I love the comment "Man, is GCL broken!". https://sourceforge.net/p/series/series/ci/813f28ae2516ed118697bfffeb48d0c52f2eed32/tree/s-code.lisp#l870
19:52:53
aeth
Hmm... looks like on the surface, series conforms to what I think is the way to write efficient CL, i.e. macros, not higher order functions.
19:54:41
fourier
it depends on a situation I guess, mostly not (hard to debug, etc) but for a general-purpose framework with the focus on optimization is a right way to go.
20:31:00
fiddlerwoaroof
I think it's more "finished" than "dead": if I'm not mistaken, Kenny Tilton still uses it for things like his algebra-teaching site
20:36:57
fiddlerwoaroof
I disagree, the skills and aptitude for writing documentation are different from the skills necessary to write good software.
20:38:05
fiddlerwoaroof
I have used plenty of good libraries with horrible documentation and plenty of bad libraries with ok documentation
20:40:47
fiddlerwoaroof
Yeah, this is one of the impressive things about Shinmera's libraries: they are pleasant to use, and the documentation is really nice
20:41:33
jackdaniel
it is not hard to write OK documentation when you create a project, it is hard to mobilize yourself to do it
20:41:59
fiddlerwoaroof
What makes documentation hard is understanding what newcomers to your project need to know
20:42:15
fiddlerwoaroof
For really simple libraries that do one obvious thing, it's not that difficult
20:42:58
fiddlerwoaroof
But for complicated libraries, it's extremely difficult for someone familiar with the project to understand the perspective of a newcomer.
20:43:35
jackdaniel
simply outlining most important concepts and how they fit together makes OK documentation
20:45:15
fiddlerwoaroof
Also, it's hard for people who do something well to understand how difficult it is to do what they do :)
20:46:35
jackdaniel
that's why you are not documenting parts you find hard but concepts. but I may be very well wrong, I'm speaking of my intuition (which whispers – it's laziness not a technical problem to write a documentation)
20:47:40
jmercouris
The biggest issue with documentation is forgetting everything you know, but remembering it at the same time so that you can write complete documentation, but understand what your users may be missing
20:48:17
jmercouris
You have to be able to paint the whole picture, and make no assumptions about the users' knowledge (except for some basic assumptions, which have to depend on a per project basis/target users)
21:19:05
jmercouris
TMA: Yeah, and that's one of the key differences between good/bad documentation, a good way around this is to constantly have noobs proof-read your docs and see where they have problems
21:19:44
TMA
good examples are beneficial too -- where "good" means: showcasing the typical usage (if it is typical to have more than one instance of THINGAMAJIC, make the example use at least two, not one. if it is idiomatic to do it one way, do not do it another way in the example); good examples are partially overlapping. (one uses A and B and showcases their interaction, other example showcases A and C)
21:20:19
aeth
TMA: That's why I think an examples directory is often better than traditional documentation, as long as the examples are heavily commented
21:20:50
jmercouris
aeth: It really depends on the software, whether it is a library or a user-facing GUI application
21:20:55
aeth
Not just a documentation example, but something that will break if someone forgot to update it.
21:21:03
jmercouris
aeth: It's not easy to convey the workflows of a GUI in plain-text in an exmaples dir
21:21:37
jmercouris
aeth: I would agree though, for libs, I always look at the examples that come with it rather than some terse documentation
21:21:58
jmercouris
Or a tutorial, tutorials are always really good, because they are like an example, but with explanations
21:22:17
TMA
the examples provide a roadmap. then there needs to be a reference documentation, that can be as dry as required. it is important to document all the dark corners too ("although the type is (unsigned-byte 8) only powers of two are valid values")
21:22:44
jmercouris
TMA: The reference code is in the docstrings, hence this big debate yesterday or two days ago about formatting docstrings :D
21:24:18
aeth
Sometimes you do need a ton of documentation including a full reference, e.g. if you're writing your own loop-like macro
21:24:25
jmercouris
shka: Super true, you realize the shortcomings of your API when you are forced to use it as an outsider
21:25:19
aeth
jmercouris: well the examples directory is what being forced to use it as an outsider is
21:26:21
aeth
Too many example directories aren't commented, though, because the author thinks they're self-documenting.
21:26:35
shka
someday i will be smart enough to write largeish system without instant urge to scrap everything and start all over again :P
21:26:59
jmercouris
shka: Nobody is ever that smart, writing a large system involves constant incremental refactoring
21:27:21
jmercouris
Nobody can make a grand plan for a large piece of software in their heads, in the 90s, big fad of so-called "architects", that didn't pan out so well
21:27:44
aeth
You can write a large system, in pieces, without any major refactorings or mistakes if you pick something very well defined, e.g. if you wanted to write your own emacs.
21:27:53
jmercouris
Especially because you'd have to nail down the business requirements before you even started programming- which of course will change throughout the course of programming
21:28:28
jmercouris
You might be able to, if your task was very well defined beforehand, but that's so rare
21:28:31
TMA
jmercouris: writing a large system involves mainly code duplication (you cannot modify the code, because you do not know which other parts depend on the quirks/bugs contained therein)
21:29:34
jmercouris
basically you feel as if you cannot trust any of the existing API (particularly in "legacy" systems)
21:30:39
jmercouris
shka: I've decided to try a blocking design btw, I think I will spawn a new thread every time minibuffer input is requested
21:31:37
jmercouris
I associate the word "legacy" with "unmaintained" a similarly nebulous term, frequently of debate on this channel :D
21:31:56
jmercouris
I'm always imagining some crufty cobol code mixed with perl on some IBM mainframe that some poor developer has to maintain lol
21:32:41
jmercouris
and then on top of that the "front-end" team, has setup a REACT NATIVE application after they rewrote the meteor one, and now they are moving to JS ES6... etc
21:33:07
jmercouris
aeth: I luckily don't have this problem, but if I did, I might look at a way to make perl and cl interop lol
21:33:16
fourier
i cant believe the necessity of quality documentation is even a topic of discussion
21:34:00
jmercouris
fourier: It's not that there isn't a consensus, it's just a cathartic release, personally it doesn't bother me at all, I prefer the channel to be a little active
21:34:14
fourier
for example i never used cells and will never use just because its a) lacks of documentation b) no active community
21:34:57
fourier
even if it does the same thing as rxjava does, i have no way to find it out without spending a couple of days digging into its internals.
21:36:20
fourier
on the other side, series, even if it doesnt help in this sense, have 2 papers describing it and a chapter in CLTLv2
21:36:47
fourier
if the authers didnt bother with the doc i assume the quality of the source code as well
21:37:20
fourier
why the hell you will write explanations and a good design if you can just hack some shit together and live with it ?
21:38:10
fourier
meaning if you dont bother about potential users why should you bother about someone reading your code.
21:39:07
fourier
sure but the job is not done if there is no documentation. writing it is a part of getting things done.
21:40:09
aeth
_death: no, writing documentation doesn't stabilize the design. The design can change heavily, and paragraphs can then be completely wrong
21:41:43
_death
aeth: right.. it was more about my attitude towards documentation (and tests..) rather than a general remark on how things are
21:42:51
fourier
thats why it is not widely used. just hacked away. documentation page on tilton-technology.com is 404, and the project is dead when its author lost interest.
21:43:36
_death
fourier: sure.. many projects are like that.. doesn't mean they're useless for everyone
21:45:50
fourier
jmercouris: but they better to be active? i reported a bug bothering me to cl-prove and didnt get any attention, so i just dont use this particular part of functionality
21:46:35
fourier
so if things like this continue i'll roll on my own library, fragmenting community even more
21:48:02
Shinmera
I'd like to say that Parachute has a much more justifiable reason to exist than a lot of the others out there
21:48:44
fourier
i guess main reason is because Shinmera is an active developer and will probably fix the bugs ;)
21:49:10
Shinmera
Part of the proof of that is that it has compatibility layers for the syntax and behaviour of other testing frameworks
21:49:24
whoman
o jeez abstract that away much, everythings intended extensible and all-encompassing =P
21:49:58
Shinmera
jmercouris: Eh, it's more that it just has a protocol for how tests are defined and executed.
21:50:01
_death
fourier: personally I took all quicklisp projects I have that have a git repo and cloned them into a third-party directory.. every once in a while I fetch all and review the new commits.. when something isn't right, I just patch it.. so it works for me.. the extra work w/ pull requests and discussion etc. is a different matter with differnet priority
21:50:19
jmercouris
I was thinking about using Parachute, but I'm a long way from actually writing tests...
21:51:13
fourier
_death: maybe you have a full-time lisp job? when having family/kids and having 1-2 hours every other day for some coding its not really a viable option
21:51:39
_death
whoman: my own projects already live in local-projects, talking about everything else.. why? so that my threshold for patching 3rd party code is basically zero
21:52:00
jmercouris
So every popular quicklisp repo could have a "Lisp community version" which can pull upstream from the official version and accept patches from others
21:53:04
aeth
There are several Lisp community-run groups. I immediately can think of https://github.com/sharplispers/ and https://github.com/lispgames/
21:53:07
fourier
I typically just use the stuff from quicklisp, and if have a problem trying to search on github for this project, fork it and suggest a fix. that is why I even reported a feature request to Xach so I can get the source repository url straight away from repl without getting to quickdocs etc.
21:53:43
Shinmera
aeth: sharplispers is run by a select few lispers, and lispgames is run by the lisp games channel. Neither are run by "the lisp community."
21:54:32
jmercouris
Is anyone willing to join a Lisp community to fork and maintain orphaned projects? If so, I would volunteer in starting the org and adding members/promoting it etc
22:26:40
hobbit|o746
â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ DID YOU GUYS KNOW TODAY WAS NIGGERS DAY?? SAY HI TO YOUR FAVORITY NIGGER IN #FREENODE!! quicktalkeh676te.onionufpsgdenhk: Intensity pjb mepian turkja attila_lendvai fikka pseudonymous Karl_Dscc damke smurfrobot AntiSpamMeta lagagain red-dot Danishman malcom2073 groovy2shoes jmercouris EvW1 peccu3 Kevslinger Jesin megalography dliot Amplituhedron te
22:26:40
hobbit|o746
â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„â–„ DID YOU GUYS KNOW TODAY WAS NIGGERS DAY?? SAY HI TO YOUR FAVORITY NIGGER IN #FREENODE!! quicktalkeh676te.onionxayskabq: fikka rotty tom34 red-dot attila_lendvai orivej atgreen Bike wigust_ SuperJen damke rpg eudoxia milanj Intensity jmercouris Kevslinger pseudonymous terpri marvin3 josema pmetzger Karl_Dscc Amplituhedron mepian
22:32:12
jmercouris
This kind of thing should be wipable, I don't think this is good content to save
22:32:40
pmetzger
The more interesting question is chasing them down and telling the 12 year old's mom what he's been doing online.
22:41:19
jmercouris
Lol, that's not the idea I had in mind, it's not to drop off your own projects, I thought we could pick up projects which aren't responding to pull requests etc, and accept/patch them etc
22:44:43
_death
(mapc #'jmercouris (sort (remove-if #'maintainedp projects) #'> :key #'num-transitive-dependents))
22:54:18
jmercouris
Shinmera: I know, but spin-lock is funnier, it won't release to any other thread
22:56:49
whoman
jmercouris, sorry i know =) just speaking out loud to remind myself under the pressure of peers
23:00:40
rpg
fourier: ABCL is good for lightweight JVM scripting, but it's too inefficient for use as one's main implementation.
23:12:54
earl-ducaine
Lispologists! q: what are the various opinions on the conventional usage of -p, e.g. blah-blah-blah-blah-blah-p
23:12:59
earl-ducaine
Should it only be a function, or is it acceptable to use as the name of t/nil variable?
23:14:26
earl-ducaine
I would have thought the former (only as a function, maybe macro), but I've seen many instance of it being used as variable.
23:18:05
fourier
rpg: then lw is a good option, the integration with jvm is real good (for example I was able to use fantastic java joda datetime library from CL in LW)
23:19:26
rpg
fourier: the integration in Allegro is also good. But, to be honest, integration with the JVM is always going to be nasty -- because it's a virtual machine, and a lisp image is almost a VM itself, the easiest way to integrate is some form of remote procedure call, which is very heavyweight. I think that's more Java's fault than anyone else's. It's pretty much the same for .NET
23:22:03
earl-ducaine
_death: I'm showing my appalling ignorance... But I've never understood what was 'predicat' about how -p is used. (i.e. how it would be realated to the verb object part of an english sence, the only usage of the word i'm familiar with.)
23:22:45
earl-ducaine
So, perhaps I should clarify my question: how in practice do you use it, or expect it to be used.
23:23:23
fourier
rpg: yep but even it is bulky it works, and works pretty well. at least it is integration! Its really sad though what abcl doesn't get much traction, its the reason to choose clojure on jvm as a jvm-compatible lisp. Also there is not much information on how to embed abcl into the java developer's workflow, like ant/maven/gradle integration so I can quickly drop it as a dependency to my say Android project to use it for code
23:24:27
rpg
fourier: I used it quite successfully as a way to explore and then extend a very large Java system. But I did end up taking the code originally written and tested in ABCL and then translating it into Java with Eclipse.
23:25:38
_death
earl-ducaine: you could say the boolean variable is a way to write a nullary function, but I don't see it as good style
23:30:15
earl-ducaine
_death: Thanks. Reading the wikipedia article on logical predicates (I didn't know, though I should have guessed) that's what they were named from, it seems that both interpretation i.e. a function or variable *could* be justified, at least for a simpleton such as myself.
23:56:21
fiddlerwoaroof
Also, integrating ABCL in a java project is pretty straightforward: I spent an hour or so playing around with it, and it wasn't too difficult to figure out how to embed it in a java application.
0:02:13
dim
ah, abcl, sometimes I'd like to produce a pgloader.jar for the JVM, and in that version use the JDBC drivers
0:06:42
fiddlerwoaroof
The company I work for has a significant amount of clojure code, although I'm not on one of the teams that works with it
0:09:38
rpg
IIRC there's a Scheme that is designed especially to be compiled into a Java program as an extension language. Is that maybe Kawa?
0:15:44
aeth
Well, the choice is to either have a lisp-2 and require (funcall #'foo 42) which makes higher order functions less elegant or have a list-1 with tons of name collisions and make naming things less elegant (e.g. (define (foo l1st) ...) or (define (foo lst) ...) or (define (foo l) ...) when you can just (defun foo (list) ...) in CL)
0:16:30
fiddlerwoaroof
marvin3: I don't like having to pick a name for variables/arguments based on whether or not there is already a function by the same name
0:17:31
marvin3
unless it is a function you actually use in that scope you can just shadow it with a variable name. so for less commonly used functions it isn't an issue
0:18:03
aeth
One possible alternative would be to break the language up into smaller packages, instead of having one big (:use :cl) so you don't have a name conflict
0:18:29
_death
I think this post presents some good arguments: https://adeht.org/usenet-gems/data-hygiene.txt
0:18:40
aeth
And yeah the problem mostly shows up with list in Scheme, especially since you use lists in Scheme more than in CL ime
0:18:57
fiddlerwoaroof
But, when I used to write python all the time, I'd frequently have bugs where I had accidentally shadowed a built-in function and then attempted to call it
0:21:37
rpg
I could really use a common lisp with a type-checker, TBH. Wouldn't have to be brilliant, but would save me a lot of stupid bug time.
0:22:13
aeth
I use type declarations all of the time. Unfortunately, semantically, it won't type check on all implementations and in some implementations it will just type assume. On SBCL, it probably type assumes with (safety 0) but never do that.
0:23:19
fiddlerwoaroof
But, I'd love to have a way to write blocks of code with ML-style type inference that seamlessly interoperate with CL
0:23:23
aeth
The problem with CL, or at least SBCL, is that functions (except when inlined) are basically barriers where all type information is lost unless you declare them all over again, for the most part. (or use the, which is very similar to declaring)
0:23:47
aeth
I would love to have full program type checking, that reruns if I change a function's signature in the REPL
0:24:11
fiddlerwoaroof
There are some really nice things in Haskell (e.g. return-type polymorphism) that would be nice to use in CL
0:24:29
aeth
I'm not even sure that full program type check warnings and type inference is impossible in CL. Just... track the functions.
0:25:01
rpg
I was just reading an article about Instagram open sourcing some code that auto-generates type declarations from Python. I was wondering if something like that could be done for CL. But it actually depends on your code *running*, and if my code runs, then typically I don't have such bugs.
0:25:08
aeth
The CL problem is that (foo 42) might return a fixnum now, but it could be redefined in 10 seconds to return a single-float. Or a list.
0:26:00
fiddlerwoaroof
Of course, you have to treat everything that gets checked as a single compilation unit
0:26:13
rpg
Fare: I'm getting the XMLS release fixed up a bit, but I saw your MR. I am running the ASDF tests now. If they pass, I will merge.
0:27:05
aeth
What stops the implementation from rechecking if a function gets recompiled? It would just need to check users of #'foo when #'foo is recompiled, and then rerun those checks. Obviously, you wouldn't want that in the final program, but it could help before then.
0:28:01
aeth
fiddlerwoaroof: redefine #'foo, the data structure that tracks users of foo is checked, the type signature is found to be incompatible, warning happens
0:28:26
aeth
I guess one problem is that you wouldn't be able to use this for type inference in the final program to improve performance (e.g. automatically telling map which sequence it's working on)
0:28:36
fiddlerwoaroof
Also, nice type systems allow propagating all sorts of information that makes recompiling parts of the program less useful
0:29:27
aeth
fiddlerwoaroof: There are some parts of a program where treating every function as a T-returning black box makes sense. And then there are some, particularly in a hot loop, where you probably don't want that behavior.
0:29:55
aeth
And at the moment you're probably going to fill that part with the or declare to give type information, anyway.
0:30:16
aeth
Type information that could possibly be inferred if functions weren't the boundary for type inference
0:30:53
aeth
Types have two uses: catching bugs and performance. Everyone seems to focus on the first use these days.
0:30:54
fiddlerwoaroof
To me, the correctness-checking parts are the least interesting parts of a type system
0:31:17
aeth
If the compiler knows the types of everything, it can do magical optimizations to really make things run fast
0:33:33
aeth
Inferring immutability is probably afaik one of the most important things about a type.
0:34:24
_death
to me, types and type systems are something that's overblown to the point of being more harmful than useful
0:36:00
aeth
To me, I want software where everything that can be done before runtime is done before runtime. Types are helpful there. As are Lisp-style macros. And especially Lisp-style macros that know the type of things.
0:37:00
xenon-
_death did you have experience with more modern type systems, with type inference, etc? not the kind of types that exist in java/c++/c and friends
0:40:30
_death
xenon: do you have experience with people who used such languages and aren't praying at that particular altar? :)
0:41:37
fiddlerwoaroof
There are a bunch of things I don't like about a language like Haskell, but the way you can use the type system to propagate information about your program at compile time is really cool
0:42:28
aeth
_death: If you have a long-running loop, you want all of the work done ahead of time that you can get away with. If you're using the language as a Unix script, it might not be worth the time.
0:42:40
rpg
aeth: got to go, but one thing -- I think there are two very different purposes for type systems. One is to help with correctness, for which you need very thorough type inference, and complex types (or, as in Java, the types don't help you get correctness). The other is type information to allow the compiler to do magical things. It's not clear to me that there's a type system that gives you both.
0:44:13
aeth
rpg: Well, you give the behavior you want, the compiler (or the macro with type information!) decides the fastest route it knows that produces equivalent results. So you want both a magical compiler and correctness.
0:47:30
aeth
In SBCL, what limited type information you can give provdies both afaik. e.g. disassemble something with and without type declarations, especially if it's dealing with numbers or sequences.
0:48:48
_death
apropos, I thought Guy Steele made a good joke when he asked about those formalisms type theorists like so much, which are expressed in first-order logic, which is untyped..
0:49:03
fiddlerwoaroof
With a haskell-style type inference, you wouldn't need the result-type argument of map, but (aref (map #'+1 '(1 2 3)) 0) and (car (map #'+1 #(1 2 3))) would both work
0:49:54
aeth
fiddlerwoaroof: you need the result type in CL because you can say (map 'list #'+ 'some-vector 'another-vector)
0:50:29
fiddlerwoaroof
Yes, in haskell the type system would realize that #'aref takes a vector and automatically pick the right implementation of map
0:51:51
aeth
fiddlerwoaroof: But aref is generic over all arrays. The compiler will know you want a 1D array, and nothing more. Do you want a T array or an array of the most specific type it can use (e.g. '(unsigned byte 8) or something) or the most general not-T type it can use (e.g. 'fixnum or something)?
0:52:21
aeth
But you could think up an example where you both do the aref and then e.g. return the array too
0:52:59
fiddlerwoaroof
The idea is that, since the compiler knows what type your result is supposed to have, it can use that information to do generic function-like dispatch, at compile time
0:54:04
marvin3
haskell does the same thing with literals. 1 is of Num a => a type, which can, depending on a context, be Int, Integer, Double, or any other type that implements Num
0:54:34
fiddlerwoaroof
Yeah, this is why I want to have a little common lisp DSL that does haskell-style type checking
0:54:37
_death
meanwhile, if I want fast code I can generate assembly in Lisp, or write opencl code, or write a C module or whatever..
0:54:42
aeth
fiddlerwoaroof: I think you can do that in CL, if the macro system knows the type information and you write the right macro. Iirc, type information in macros was proposed but rejected.
0:54:49
caffe
i'm having a bit of a stumper regarding sb-ext:run-program... i can get it to run one-liners, but despite :input *standard-input* :output *standard-output*, i can't get it working for anything that has interactive prompts
0:55:51
aeth
_death: Ideally, you don't want to directly write assembly, you want to have a conversation with the compiler to try to produce the correct (disassemble #'foo) result automatically. Then it stays portable, but slow, in other circumstances and you probably save effort anyway.
0:55:56
fiddlerwoaroof
I have a friend who did something like that in Racket: https://github.com/lexi-lambda/hackett
0:57:13
aeth
fiddlerwoaroof: I think (I haven't had the time to look into it) you can do something with this library: https://github.com/Bike/introspect-environment
0:57:41
aeth
Unfortunately, it only supports SBCL, CCL, and CMUCL. If ECL supported the ncessary features, too, that would make a huge difference.
0:58:03
fiddlerwoaroof
Yeah, I think the common lisp type system is too powerful for good type inference :)
0:58:13
aeth
_death: A compiler with enough information will generate better assembly than you can write by hand. The problem is when the compiler doesn't have enough information.
0:59:36
aeth
fiddlerwoaroof: I suspect that that's a problem with C being high-level PDP-7 assembly and not really matching modern hardware too well.
1:00:27
fiddlerwoaroof
I think auto-vectorization, like auto-parallelization is a surprisingly hard problem
1:00:45
_death
aeth: sometimes it's enough just to be able to generate the instructions you need for the particular case..
1:01:18
aeth
fiddlerwoaroof: But in something like Lisp, you don't need auto-vectorization, you can make anything look like it was a built-in part of the language. Auto-vectorization is afaik more like C programmers wanting to stick to their increasingly-outdated for loops.
1:01:55
_death
aeth: you have all the control you need then, and an assembler is much faster than an optimizing compiler as well
1:02:21
aeth
Make a language where the problem isn't hard, rather than trying to make C-style semantics do something totally alien to the PDP-7 it was designed for.
1:08:35
caffe
not any one in particular... mostly a set of bash scripts that prompt for a few lines of input and exit
1:09:11
Xach
I'm actually thinking of making something expect-like for sbcl's run-program pty stuff.
1:12:08
Xach
caffe: no, just use the :pty argument to run-program and you will have a lot lower-level control over input and output of the process
1:13:11
Xach
fiddlerwoaroof: you don't need to directly open a pty, run-program does it on your behalf.
1:15:24
fiddlerwoaroof
Cool, I just meant to say that you don't need to get the user's pty, you just start your own---implicitly or explicitly
1:31:13
fiddlerwoaroof
https://github.com/sbcl/sbcl/blob/f685c4dacde06c9a2bcb2be5f24eca987d4f4188/src/code/run-program.lisp#L708
1:31:46
fiddlerwoaroof
It's also available here: http://www.sbcl.org/manual/#Running-external-programs
1:37:56
fiddlerwoaroof
Does anyone know if lispworks automatically adds (:use :cl) to a defpackage without any (:use...) clause)
1:42:41
caffe
(run-program "/bin/program" '() :input *standard-input* :output *standard-output*) gets the farthest, but fails at the first interactive prompt of the program being run
1:46:50
fiddlerwoaroof
Even in the terminal, it shows the output, but doesn't really respond to input
1:47:39
malice
well, for me, if working with sbcl, if I create a code.lisp (run-program "/bin/echo" nil) and then run it like "sbcl --load code.lisp" - it will work
1:48:07
malice
for clim - I remember trying to debug something in there with *standard-input* and *standard-output*, and it looked like they were changed somehow
1:48:37
malice
so e.g. #'print wouldn't print anything to standard-output, at least with slime, but slime changes *standard-output* too
1:49:19
malice
I mean, if the simple "echo" program works for you in SBCL then other programs should work too
1:51:41
caffe
no, as in when a bash script i'm trying to execute (or just read itself) just goes nowhere. it doesn't respond to input
1:59:55
malice
well, if I do (run-program "/usr/bin/python" nil :input t :output t) in my terminal, it opens Python interpreter just fine
2:01:48
fiddlerwoaroof
but this doesn't: sbcl --eval '(run-program "/usr/bin/python" '"'"'() :input *standard-output* :output *standard-input*)'
2:03:38
fiddlerwoaroof
This doesn't work: sbcl --eval '(run-program "/usr/bin/python" '"'"'() :input *standard-input* :output *standard-output*)'
2:05:13
caffe
now, one more question... is there a way to do this and have it return to sbcl's prompt upon exiting?
2:06:16
malice
If I run the bin/python example and then call quit() in Python, it returns to REPL just fine
2:06:40
malice
fiddlerwoaroof: this *might* have something to do with "If t, the standard output for the current process is inherited." bit (I'm guessing though)
2:10:30
malice
caffe: then I don't really know what to do. (run-program "usr/bin/python" nil :input t :output t) pasted into SBCL after running "sbcl" command
2:16:50
fiddlerwoaroof
it's really annoying to me that the python library cffi interferes with the lisp one in google search results