freenode/#lisp - IRC Chatlog
Search
19:09:34
vsync
I'm building a system that has some similarity in terms of a hierarchical ordered set of operations and want to learn any lessons from it
19:09:37
jasom
aeth: https://pastebin.com/dFqXmixc <-- more complicated than loop, but not by much IMO.
19:09:47
aeth
jasom: What's probably needed is a library of minimal macros and/or higher order functions for iteration that look like they could have been in the standard. Most could be very trivial, e.g. do-hash-table (like dolist) is just a tiny wrapper on top of maphash
19:10:14
jasom
I find loop to be 1000x more readable than dolist since I don't need to remember the order of parameters
19:10:23
vsync
in particular why is a plan just a list of steps and not nested, and what were the tradeoffs of traverse to full depth before execute vs build a top level plan then go to execute and make little plans then
19:10:41
phoe
jasom: https://github.com/fare/asdf/blob/53f72684bbab75ae375673634e24305e0d276943/uiop/utility.lisp#L148
19:14:57
vsync
jasom: yeah, I have a memory of finding such, but all I can find presently is the manual and a few slide shows
19:16:18
vsync
hmm a little bit here http://fare.tunes.org/files/asdf3/asdf3-2014.html#(part._traverse)
19:16:52
pjb
https://medium.com/@kinwo/historical-development-of-ai-planning-and-search-a5e2b97b9483
19:18:28
pjb
Here is what I had in mind: https://en.wikipedia.org/wiki/Planner_(programming_language)
19:19:00
vsync
did you have a list of those bookmarked or is it embarrassingly like page 1 of Web search "planning things"
19:20:13
vsync
and at least the simple-planners looks like I can shallowly exploit what I want quickly
19:20:35
_sfiguser
hello all, which are alive lisp languages? is common lisp and scheme still active projects and viable options ?
19:20:36
pjb
vsync: well, you might have a look at the system construction systems, things like make, scons, maven, ants, etc. You might find some more specific algorithms.
19:21:51
phoe
_sfiguser: actively developed and used? yep, both CL and Scheme fall into that category
19:22:10
pjb
But really, what you have is the description of a hopefully acyclic graph, with labelled nodes and edges, and you have to determine goals (from the current state of the file system or other objects (eg. compiled functions and source sexp in a lisp image).), and then build a plan to obtain those goals by flowing the graph util you reach only existing nodes.
19:22:40
pjb
_sfiguser: yes, but here we will advise you to use Common Lisp, more survival stamina in there…
19:24:44
pjb
_sfiguser: CL has older roots than scheme. It has more genes. It is and will be able to survive longer. Scheme is already at its 7th revision (ie. already 8 versions of the language!) while CL has a single standard and that's it.
19:25:08
pjb
_sfiguser: Furthermore, you can run in CL lisp programs that are more than 40 years old!
19:25:24
pjb
_sfiguser: https://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html
19:26:20
pjb
So my bet is that it will be able to run the programs you write today in 60 years. Enough until you die programming or until the singularity whichever occurs first.
19:28:24
pjb
_sfiguser: for example: https://www.google.com/flights#flt=/m/05qtj..2018-09-16*./m/05qtj.2018-09-20;c:EUR;e:1;ls:1w;sd:0;t:h
19:29:29
pjb
phoe: the most difficult one AFAIK, would be (setf gethash), but since it fmakunbound only symbols, we're safe.
19:32:21
aeth
_sfiguser: If you don't want famous but just want some examples, there are some games you can play right now. https://dto.itch.io/
19:33:14
sjl
can't just negate OUTPUT-STREAM-P because bivalent streams. there's no (portable) INPUT-STREAM type for TYPEP
19:36:49
phoe
(defun input-stream-p (stream) (handler-bind (progn (make-concatenated-stream stream) t) (error () nil)))
19:45:35
phoe
Bike: if you accidentally (fmakunbound 'cl:handler-bind), other than it being UB, you have no portable means of reimplementing it
19:51:06
phoe
would be pointless for them to promote something not made in Lisp as a Lisp success story
19:54:42
pjb
sjl: Well, for binary streams, input-stream-p is hard: you have to read a byte. For character streams, you can use peek-char.
19:58:51
aeth
_sfiguser: Games generally use the host's OpenGL driver as well as some portability library like SDL to access windows/input/etc., so they can't really be done 100% in any language except C (and even that doesn't work because some drivers/libraries/etc. are C++)
20:00:17
_sfiguser
what do you like about lisp that is not in other programming languages which are not lisp dialects ?
20:02:47
oni-on-ion
real live coding; ie. able to change everything in runtime, class definitions too. and real macros. the `, syntax is perfect for flipping modes which i think a lot of people dont realise is very important at least cognitively
20:04:31
oni-on-ion
Julia is my favorite, it is very close to perfect in most ways, it is a truly awesome language, but without those two specific things it can't be my number 1 tongue that lisp is
20:06:38
jasom
_sfiguser: SLIME is easily the most productive development environment I've used; really a focus on good development environments seems peculiar to the lisp and smalltalk communities
20:07:49
jasom
_sfiguser: Also, the language is malleable. I started using python in 2.2, and it's gotten a lot of useful features since then, but many of the things in python that had to be language features could be implemented as a library in lisp.
20:10:10
pjb
_sfiguser: have you have a look at http://cliki.net and http://cliki.net/Getting+Started already?
20:25:32
_sfiguser
the only thing i don't like is that since i'm used to vim i find editing slow in emacs
20:26:12
jasom
_sfiguser: if you install evil-mode to emacs you are fairly vim compatible keystrokes
20:26:44
jasom
_sfiguser: control-g intsead of escape is the only real difference at that point (i.e. C-g is what you want to do to cancel where you would hit escape in vim)
20:28:09
jasom
_sfiguser: I prefer message-passing concurrency; IIRC clojure's is based upon STM; not sure if there is a library in lisp for it.
20:29:11
jasom
_sfiguser: pretty much everything is used for web programming today, since the web is kind of taking over the world
20:32:11
_sfiguser
can you make an example in code for which something is really simple in lisp but owuld be complicated in other languages ?
20:32:49
jasom
python 2.2 did not have a with statement; you could not add it to python 2.2 with a library. Implementing a new statement like that in lisp is trivial
20:33:21
shka_
_sfiguser: well, it is difficult to explain, but mind set is that instead of writing something IN lisp you are writing it ON lisp
20:36:13
aeth
_sfiguser: CL has dolist but it doesn't have an equivalent for hash tables. That's as trivial as (defmacro do-hash-table ((key value hash-table &optional result) &body body) (let ((maphash `(maphash (lambda (,key ,value) ,@body) ,hash-table))) (if result `(progn ,maphash ,result) maphash)))
20:36:32
aeth
(It's harder than it would have been if dolist didn't have an optional return value for the result)
20:39:00
pjb
(defmacro do-hash-table ((key value hash-table &optional result) &body body) `(progn ,(maphash (lambda (,key ,value) ,@body) ,hash-table) ,result))
20:39:19
aeth
Similarly, CL doesn't have something like foreach (unless you count loop as one), but you can implement a do-sequence as easily as (defmacro do-sequence ((var sequence &optional result) &body body) (let ((map-nil `(map nil (lambda (,variable) ,@body) ,sequence))) (if result `(progn ,map-nil ,result) map-nil)))
20:39:53
aeth
(I'd count do-sequence as a true foreach and not count dolist because do-sequence will work on every sequence like MAP does)
20:40:06
pjb
What I find more regretable in the dolist etc macros, is that there's a result expression, but no provision to bind a result variable. So you often have to (let (result) (do… (var … result) …(setf result …)))
20:40:30
pjb
in which case, it would be as well to write (let (result) (do… (var …) …(setf result …)) result)
20:41:23
aeth
_sfiguser: you can read it in multiple lines here: https://gitlab.com/zombie-raptor/zombie-raptor/blob/2915b4e53ed1e5113e30348a2cb470329bedb727/util/util.lisp#L245-252
20:41:24
pjb
_sfiguser: I guess he means, metalinguistically. Have a look at Structure and Interpretation of Computer Programs http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/
20:41:51
pjb
of course, just copy and paste the expressions in an emacs lisp-mode buffer, insert a few new lines, and have emacs indent it.
20:42:08
ym
In what constraint logical programming system, implemented on top of CL I can use Prolog's CLPx libraries?
20:42:09
shka_
_sfiguser: kinda difficult to explain, but boils down to the fact that many lisp libs are more akin to language extensions
20:43:04
aeth
_sfiguser: For trivial macros like this, you just need to understand quasiquotation. Sometimes you don't even need that. You could just have (defmacro foo (&rest forms) (some-function-that-takes-in-a-list-and-returns-a-list forms))
20:43:11
pjb
_sfiguser: the idea is that you make the language evolve toward your problem domain, at the same time you implement your solution, so in the end, your program is not so much written in CL as in a domain specific language implemented on CL.
20:43:46
pjb
_sfiguser: and you can write macros, reader macros, and compiler macros in CL ! There are 3 different types of macros.
20:46:30
_sfiguser
do you think structure and interpretation of computer programs can be still considered a modern book? or it explains old concepts ?
20:47:35
russellw
_sfiguser, still modern, because the concepts it explains are timeless fundamentals, like algebra
20:48:11
aeth
_sfiguser: Lisp isn't popular for the same reason Google+ or Diaspora isn't popular. Network effects matter.
20:48:30
shka_
ym: one is logic programming and stuff, the other is constraints programming and stuff
20:48:31
aeth
For a programming language that matters on multiple levels. Resources, tooling, training, jobs, libraries, etc.
20:58:03
aeth
shka_: I saw https://news.ycombinator.com/item?id=17881197 and I was wondering what the equivalent in CL would be
21:02:07
shka_
aeth: i don't want to read whole blog post right now, but it does not look all that interesting
21:16:17
_sfiguser
AeroNotix, no i'm not, if i were like that i was not here... just keep into account industry
21:16:24
oni-on-ion
aeth: also i think that inheritence in CLOS is using before/after method chaining isnt it ? can be entirely customized but that 'inheritence' is just the default.
21:17:24
aeth
_sfiguser: I would check https://old.reddit.com/r/lisp/ and https://old.reddit.com/r/Common_Lisp/ as well as http://planet.lisp.org/
21:17:45
aeth
_sfiguser: The important research usually ends up at https://www.european-lisp-symposium.org/
21:18:16
aeth
Note that some things are Lisp family but majority CL and some of these things are strictly Common Lisp.
21:18:54
AeroNotix
_sfiguser: my suggestion is just learn CL and discover what it means for you and what place you find it useful.
21:19:25
aeth
_sfiguser: The most active subcommunity online is probably the Lisp games community with the IRC channel #lispgames and with regular game jams on itch.io such as https://itch.io/jam/lisp-game-jam-2018
21:19:53
aeth
_sfiguser: Most commercial activity is probably websites, but #lispweb is a dead channel. I guess it's not as fun to talk about.
21:20:37
oni-on-ion
lots of nice CL web frameworks though. radiance, weblocks, cowboy2 .... hunchentoot, cl-who, etc..
21:20:47
aeth
The wiki can also be useful but it's a mix of up-to-date and things that are 10 years out of date ime. https://cliki.net/
21:20:50
AeroNotix
and using lisp for web programming just seems an absolute waste, too. I think it was David Nolen who said "give someone the most powerful programming language and they'll make a web framework"
21:21:16
oni-on-ion
i think CL is great for web programming. especially not having to restart the server, and a lot of work with textual data.
21:22:13
AeroNotix
sure, it's a reasonable language to do it in but I dunno, feels like a disservice to the language/environment if having lots of web frameworks is a selling point
21:22:47
no-defun-allowed
I'd run SBCL through tmux and rlwrap and copy paste fixes in. Now I know about remote SLIME but it worked
21:22:49
oni-on-ion
'having lots of web frameworks as a selling point' ? maybe i am missing something herre. =)
21:23:08
aeth
Lisp is great at generating strings from s-expressions and using that as essentially an alternative to templates (e.g. for XML, HTML, CSS, JSON, SQL, and even JavaScript)
21:23:33
oni-on-ion
im going to run the lisp image on my tablet win7.1 for gfx but i will use my desktop to swank/slime it from there. so its like having two screens. fwiw ^_^
21:23:45
no-defun-allowed
It was very easy using format to convert internal data formats into text and html. Very pleasant experience.
21:24:28
no-defun-allowed
The server would also write out s expressions to a file to backup proxy lists.
21:25:04
oni-on-ion
if i really had to choose something else for webdev i would do node.js, but erlang or prolog for hardcore server stuff. i would choose CL for web sites and pages for sure. haskell was fun tho that one time =)
21:26:08
oni-on-ion
AeroNotix: perhaps i should have aimed at aeth, now im not sure, i thought you talked about it first for some reason =)
21:27:25
no-defun-allowed
Adding authentication was one time where lisp shined, I just wrapped everything in a with-authentication macro which checked for a cookie, or directed the user to log in.
21:28:26
no-defun-allowed
The bot uses hunchentoot for serving, drakma for remote calls, mini.css for aesthetics and some other stuff too.
21:30:14
no-defun-allowed
If you had a queue and something went wrong, the erroneous request would go to the back of the queue. The Lisp bot would put it to the front of the stack (just with CONS) which was much nicer given we're drawing pixels on a game board as quickly as possible.
21:31:26
oni-on-ion
AeroNotix: eh wot? i mentioned them after i read your comment about lisp web dev. idk homie
21:32:19
oni-on-ion
AeroNotix: nah i guess not. my bad; it should have indeed been aimed at aeth , my apologies
21:32:30
no-defun-allowed
I had to maintain a bot managing several bases and I only got to use it a few times to make the stupid ancap base say things like "USE EMACS" instead of "BUY BITCOIN"
21:33:33
oni-on-ion
no-defun-allowed: didnt realise that many are probably automating their efforts. hm. i remember the initial version from HN sometime ago
21:34:58
no-defun-allowed
My bot exposes an API for getting captcha tokens and also one for using a specific service too. We decided against using a captcha service cause they got expensive quickly and they weren't very humane.
21:35:26
no-defun-allowed
I have been experimenting with using pocketsphinx to solve audio captchas but it needs further training, and I'm getting into offtopic.
21:36:27
oni-on-ion
chinese clickfarms are shops with walls full of connected registered cell phones. buy mindshare
21:36:33
Jachy
Some people in the states probably too, doubt mechanical turk cares much where you're from.
21:36:45
no-defun-allowed
https://www.theguardian.com/technology/2018/jul/06/artificial-intelligence-ai-humans-bots-tech-companies
21:36:51
aeth
[image] please enter the numbers in this image to prove that you're not a bot and continue using IRC
21:36:58
no-defun-allowed
This is as far as I'm going to talk about captchas. Back to Lisp on the web thanks.
21:37:01
AeroNotix
no-defun-allowed: I'm aware of those but are you saying you didn't include captchas on a service you expose because you knew people would use clickfarms against them?
21:38:22
no-defun-allowed
AeroNotix: we had to clear captchas ourselves for the linked bot to work effectively we didn't want to support clickfarms.
21:38:55
no-defun-allowed
Occasionally the server will request a captcha token, so we take one from a queue that's not too old.
21:39:43
no-defun-allowed
We did use a two queue system for a service but that got expensive: $30 for the first day.
21:40:35
no-defun-allowed
The bot in its final days controlled more than 2000 proxies on one server without breaking a sweat (as measured by htop).
21:42:36
AeroNotix
no-defun-allowed: right so it's an online game that allows you set a pixel or something and you were using a suite of bots to bypass rate limiting?
21:46:46
no-defun-allowed
So yes, lisp helped the bot certainly get big. Stacks are more aesthetically pleasing and lisp (on portacle) was much easier to set up.
21:50:24
AeroNotix
_sfiguser: implementations of lisp or applications written on those implementations?
21:54:48
AeroNotix
_sfiguser: arguably the most popular implementation is sbcl, its development is over at https://github.com/sbcl/sbcl
21:57:08
aeth
SBCL is much more popular than CCL which is much more popular than any of the rest. The only thing that would be hard to determine is what the #3 implementation is.
21:57:37
AeroNotix
aeth: you mean that you're more sure that it is the most popular or that it isn't?
21:58:21
aeth
AeroNotix: here's some data from Quicklisp. http://blog.quicklisp.org/2018/02/quicklisp-implementation-stats-for-2017.html
21:59:16
aeth
AeroNotix: It does match my expectations that SBCL is 10x CCL which is 10x the rest and you probably can't distinguish between the rest. Well, 10x seems a bit large for SBCL vs. CCL. I wouldn't be surprised if you did a survey of #lisp and it's only 3x more popular
21:59:58
aeth
But I would suspect that if you used many different ways to get incomplete data, you'd probably wind up with SBCL at #1 and CCL at #2. They're the fastest and they have the most helpful errors.
22:00:41
aeth
CLISP in 3rd wouldn't surprise me because so many outdated resources from more than 10 years ago recommended CLISP
22:01:33
aeth
It's a shame that it'd probably be CLISP or a commercial Lisp in third because ECL really deserves the bronze medal there.
22:02:39
aeth
Jachy: If you're running something like Allegro or LispWorks you only really need one customer.
22:03:42
aeth
The people who do enterprise software love it because your customers are in the dozens instead of the millions.
22:04:47
Jachy
But they're not even on annual subscription models like the rest seem to be, so I wonder how many licenses Franz needs to sell per year to stay healthy.
22:05:47
aeth
I suspect they'll simply switch their business model to a subscription one if they start to have trouble.
22:08:58
aeth
_sfiguser: CLISP is still being developed, but it is not actively developed to the point where they are pushing out new releases regularly. I think it has been at least 5 years since its last release. It's imo very far behind a more modern implementation at this point because of all of the optional things and extensions that an implementation like SBCL or CCL supports these days.
22:10:09
aeth
I think lots of libraries at this point use at least one dependency that doesn't support CLISP.
22:13:27
AeroNotix
what is Scienteer lisp? Googling about now there's quite a lot of dead links for it
22:16:16
pjb
It was an expensive high performance commercial implementation. notice that commercial software is out of topic on freenode.
22:19:08
pjb
I don't know of any program written in it. There are more than one implementation though.
22:20:33
_sfiguser
AeroNotix, what do you mean that is very far behind a more modern implementation? i mean does it lack stuff to make it a modern language ?
22:20:38
AeroNotix
pjb: sorry I just saw a reference to it in the quicklisp statistics linked above, had a question, asked a queston
22:27:10
aeth
_sfiguser: There are lots of optional things in CL implementations that CLISP does not support, such as (afaik) single-float and double-float arrays, type checking in places where it is optional, and various popular extensions that are handled in portability libraries (you only really find out this third category if you try to test a large Lisp application in an unpopular implementation)
22:29:00
aeth
Yes, that's the unforgivable thing, making a confusing name that makes it sound like it's a way of talking about the language. It's like if a C compiler was called Cee.
22:29:26
aeth
_sfiguser: On the other hand, CLISP does have some extensions that no one else supports, like arbitrary precision floating point.
22:29:27
vsync
ACTION would never have thought of CLISP as abbreviation for Common Lisp.... seems obviously different
22:30:11
vsync
ACTION used to be inordinately fond of CLISP, probably cuz of trying to run on odd architectures in the days when the choice was that or CMUCL and have fun bootstrapping CMUCL
22:30:29
vsync
haven't run it in a while... sometimes install it just so I can see the menorah for nostalgia
22:30:47
pjb
clisp is not an abbreviation of Common LISP, but of C lisp. Ie. a lisp implemented in C.
22:30:49
vsync
feels like I should care more about running different implementations but don't really
22:33:15
_sfiguser
any good extension to do data analysis in lisp ? like managing csv files cleaning data or machine learning?
22:34:40
aeth
pjb: Yes, but enough people try to use clisp instead of cl as an abbreviation for Common Lisp so that makes me think that the name itself is problematic.
22:34:56
Jachy
Once I confused clisp with GCL. Clisp calls itself "gnu clisp" on its home page too, but it's not gnu common lisp.
22:35:29
aeth
Jachy: GNU has Emacs Lisp, two Common Lisps (CLISP and GCL), and at least three Schemes (Guile, Kawa, and MIT/GNU Scheme). That's not confusing at all.
22:37:43
aeth
I did some of the https://projecteuler.net/ problems in Lisp but that's more about cleverly solving the problem mathematically/algorithmically than learning a language.
22:38:32
aeth
Google has https://github.com/google/lisp-koans but I bet they're in a slightly archaic style because programming languages, even ones with no revision to the standard since 1994, change what's idiomatic over time
22:38:59
aeth
(An example of a style change over time: SETQ used to be about as popular as SETF, but SETF has clearly won at this point.)
22:40:02
Jachy
_sfiguser: http://stevelosh.com/blog/2018/08/a-road-to-common-lisp/ this was a recently popular post on getting started with CL
22:40:49
vsync
aeth: lots of those seem to be about things from the standard slowly increasing popularity
22:41:20
_sfiguser
anyone knows instead about data science or statistics/machine learning stuff with clisp ?
22:41:55
aeth
_sfiguser: CLISP refers to an implementation. CL is the correct short name for Common Lisp.
22:42:32
Jachy
_sfiguser: also a useful resource is https://github.com/CodyReichert/awesome-cl#machine-learning
22:43:15
pjb
It's simple, in Common Lisp, there's a package named "COMMON-LISP" and it has a nickname "CL".
22:43:45
aeth
_sfiguser: if you want to visualize data you can use https://github.com/vydd/sketch or https://github.com/cbaggers/cepl or even use a graphics framework that's more game-oriented in its intent.
22:45:40
aeth
Jachy: It seems to pretty much be a random list of things that people have submitted rather than something opinionated that someone new to CL should read.
22:47:46
pjb
vsync: like in any other programming language: by testing for the base case, and calling the function recursively in the general case.
22:49:53
no-defun-allowed
vsync: you must get one lisp and put it in the other lisp but then the first lisp must also be in the second lisp
22:50:39
pjb
In my father's village, in WWII when the germans arrived, they aligne people, and asked who wanted to be German and who wanted to stay French. All but two went for German (my grandfather stayed French).
22:51:44
pjb
The lesson is that in Alsace-Lorraine, smart people know that it doesn't matter which, Berlin or Paris, they'll have to pay taxes all the same, so let's not contradict the current adminstration.
22:52:25
aeth
pjb: The lesson is that if I want to conquer anything I should start with Alsace-Lorraine, I guess.
22:53:08
pjb
Don't be so sure. We know the German, and we know the French (we're both), but it may be a different story with different people.
22:54:14
aeth
It looks like it would make an interesting border as part of Luxembourg, and it would solve the French-German hostilities because they would no longer border each other. https://upload.wikimedia.org/wikipedia/commons/3/37/German_Empire_-_Alsace_Lorraine_%281871%29.svg
23:08:03
AeroNotix
Ditto for this area. Silesia. Not sure if there's an English name for the area but roughly equivalent to Prussia
23:49:15
no-defun-allowed
how could i smooth off the alpha channel for cl-vep's background replacement function?
0:42:35
AeroNotix
regreg: unfortunately most of the "fun" work is done already. IIRC there's "libbilliards" that takes care of the majority of the ball physics
0:43:22
AeroNotix
I always wondered why there isn't a cheap over head table system that tracks ball positions. For match games where balls need to be reset (foul and a miss) then it's quite a manual job placing the balls back.
0:44:39
AeroNotix
Bike: that overhead table system I was mainly thinking about it being used in big matches. There's a rule in snooker which sometimes requires balls to be reset to their positions they were in before a foul.
0:45:08
AeroNotix
and it can take a lot of back and forth between replays to get the positions just right
0:45:32
AeroNotix
the balls are brightly coloured, the game is literally played on a green screen. Seems like it should be trivial
0:46:18
regreg
AeroNotix: if there are 4 games worth a $20million market, then with one extra good quality game you can take 1/5 of that market, meaning $4million, assuming your game quality is similar or better
0:47:16
AeroNotix
Bike: I was thinking using image processing of the state of the game play by play and use lasers to indicate older positions, if needed
0:48:27
AeroNotix
Bike: I wondered about putting something inside the balls but pros would be up in arms about stuff like that
0:50:30
AeroNotix
in other news my lisp z80 emulator can now run my z80 brainfuck interpreter code ;)
0:52:24
AeroNotix
I'm always looking for bigger and bigger roms to run on the emulator. I'm having isues assembling zexdoc/zexall with linux assemblers. Seems they're designed for ancient windows assemblers.
0:54:03
AeroNotix
indeed. There were loads of them behind the iron curtain. Clones and all sorts. All the way past the 32 bit era. People writing stuff like mortal combat for z80 based machines
0:55:08
AeroNotix
in my z80 emulator I have a plan (currently kind of almost working) where you can write a subset of CL that will compile to z80 machine code
0:57:32
AeroNotix
yeah. To be honest calling it a "subset of CL" is a bit strong. It's more "a shitty version of lisp"
0:58:53
AeroNotix
well, the z80 can by default access 64k of memory. I know in "my" version of lisp that this is oodles of memory, with plenty to spare for user programs
0:59:55
AeroNotix
The idea was just that you would define your own functions (+ a set that make sense built in) that compile directly to machine code
1:02:43
AeroNotix
vsync: it's just more complicated to create. With only a handful of chips you can create a useful z80 "computer"
1:04:13
AeroNotix
I need to actually get some hw. I've mostly been focused on creating the emulator and development tools
2:01:48
pjb
But notice that rename-package has "undefined consquences if new-name or any new-nickname conflicts with any existing package names."
2:02:13
pjb
I interpret that strictly, to mean that if there is already a package with the same name or nickname, rename-package can fail.
2:02:43
pjb
So I call it twice, using a temp name, like in com.informatimago.common-lisp.cesarum.package:add-nickname
2:03:11
pjb
But perhaps "nickname conflicts" are only when the name-package association is different?
2:04:17
pjb
In that case, removing a nickname could be done conformingly with (rename-package package (package-name package) (remove old-nickname (package-nicknames package)))
3:01:26
aeth
So normally I simplify something by making something a symbol or a list. i.e. in ((foo bar) (baz barfoo)) the first sublist binds bar to foo, but (foo (baz barfoo)) would bind foo to foo.
3:02:09
aeth
I can't do that in my particular case here, though, because I have (binding thing &key ...) instead of (binding thing)
3:02:45
aeth
The next best thing I can think of is having some symbol imply repetition, e.g. (foo * :some-key 42)
3:03:20
aeth
What symbol would be the most intuitive for not writing foo twice when I'm binding foo to the variable foo?
3:49:18
russellw
FAQ: 'If using REMOVE and DELETE to filter a sequence, don't use the :test-not keyword or the REMOVE-IF-NOT or DELETE-IF-NOT functions. Use COMPLEMENT to complement the predicate and the REMOVE-IF or DELETE-IF functions instead.' - a curious recommendation. Is there a reason for it?
3:55:30
aeth
As far as scary loops go, how does this one rank? https://gitlab.com/zombie-raptor/zombie-raptor/blob/d5023f05b40a20d3e0cfe96d0a6c4a85e39c4792/util/array.lisp#L115-149
4:00:28
|3b|
ACTION also wonders why it should be correctable if ROW-OF isn't an integer, but if it is any integer other than 2,3,4 that is fatal
4:01:05
aeth
|3b|: It isn't actually correctable because check-type in macros isn't actually correctable, at least in SBCL where I do my testing.
4:04:19
aeth
even if I violate ALGOL style and put the DO at the start of the line, that still won't happen
4:05:37
aeth
What I don't like about the loop I wrote is that I parse slot twice to get the slot-name twice, once in the loop body and once in the destructuring-bind that parses the whole thing if it's a list
4:05:51
mfiano
If you use keyword symbol loop keywords (loop uses symbol-name anyway), with the proper SLIME variable set, your clauses will line up (it might even be the default - it's been a long time since I used SLIME).
4:06:19
|3b|
you could do part of the destructuring in the LOOP and only parse the keys in the inner part
4:07:44
|3b|
for .slot in slots for slot = (if (atom slot) (list slot slot) slot) ... or whatever makes the rest work without testing
4:09:45
mfiano
It seems Sly behaves sanely even without keyword symbol loop keywords https://files.lispcoder.net/images/screenshots/img-20180901000917.png I really don't miss SLIME if it does that.
4:13:56
aeth
|3b|: Your solution is clever but it doesn't actually simplify much because I still collect something differently if it's a list so I still need to do the test the second time
4:16:52
|3b|
(if they can't be meaningfully duplicated, why bother with the hash to avoid making extra gensyms, if they can be, does it actually work as intended?)
4:17:36
aeth
|3b|: The macro looks like this in actual use: https://gitlab.com/zombie-raptor/zombie-raptor/blob/d5023f05b40a20d3e0cfe96d0a6c4a85e39c4792/render/gl.lisp#L195-206
4:17:39
mfiano
Also wonder why you spend this much time refactoring macros into a completely different form from using mapcar.
4:18:06
mfiano
I actually had that file open in my browser for a couple days, and I was looking at the tabs side by side and something didn't add up
4:18:13
aeth
The only thing that I changed in my refactoring is adding :elt so that I could use destructuring-bind
4:20:34
aeth
|3b|: The idea is that when accessing 2D arrays, the row is constant, but the column in the row can change, as can the array.
4:21:58
aeth
It can also be a 1D array (if neither :elt nor :row-of is given) so there can e.g. be a bit array whose index corresponds to another array row number.
4:22:28
aeth
The row (or index if it's 1D) is called "ID" because in my engine it almost always represents an ID
4:23:03
aeth
This is what happens when you have a large program gradually refactored over many years
4:23:56
mfiano
It doesn't help that you have changed game ideas 3-4 times since I heard you talking about your engine
4:24:26
aeth
mfiano: To make them smaller in scope each time. The only substantial change was going from first person to third person motion so I wouldn't need anywhere near as much physics completed
4:27:56
aeth
mfiano: do you think it would look better if I have (loop\n so that all of the keywords line up?
4:30:43
aeth
Okay, so I just switched them to keywords and put the :do at the start of the line https://gitlab.com/zombie-raptor/zombie-raptor/blob/839c898ba33e35003244e630edb58b01d5fce3b6/util/array.lisp#L115-149
4:32:07
mfiano
I really sort of feel sorry for ewhoever has to read that. It's pretty hard to scan and get an idea at a glance...I have to try to understand it :/
4:33:45
aeth
mfiano: One of the reasons it's going to be a *long* time before I encourage anyone to use this is because of some of these macros
4:34:44
mfiano
Copying that into my Emacs: https://files.lispcoder.net/images/screenshots/img-20180901003426.png
4:35:42
aeth
mfiano: well something broke in my .emacs then because the reason I used symbol loops instead of keyword loops is because symbol loops indented properly and now they're both... broken
4:46:08
_sfiguser
guys which compiler do you suggest for lisp i see that the most common ones are "abcl" "ccl" "clisp" "ecl" "sbcl"
4:46:09
ealfonso
I wonder if anyone is active right now... Is there a built-in function to extract a common prefix from a set of pathnames or strings?
4:47:42
aeth
_sfiguser: The most are afaik actually SBCL and CCL in that order. CCL has better support for threading on macOS and has a faster compiler. ECL should be your next choice if neither works. It's designed to be embedded into C programs as a scripting language, hence the "E" in its name. ABCL is niche (the niche is the JVM).
4:48:17
aeth
_sfiguser: CLISP is maintained, but they haven't had a new release in a long time. i.e. its git (or SVN?) is still being updated, but the activity isn't enough for a new actual released version at the moment
4:49:34
aeth
I would personally avoid CLISP and ABCL unless you need what they offer because they have quirks that make them different. (I've run a lot of the same code in almost every Common Lisp, using Roswell.) Yeah, they conform to the standard, but lots of *your* assumptions might not.
4:52:20
aeth
(In case I was unclear, CCL compiles faster. SBCL's compiler produces faster code, in general.)
4:57:44
beach
_sfiguser: You asked before why Lisp is not popular, despite being so good. That question assumes something that is just not true in the real world, namely that people are rational and that they choose the best things for what they need to do.
5:05:36
beach
_sfiguser: Common Lisp is a language with a standard, published by an independent standards orginaization.
5:06:20
beach
_sfiguser: Racket is an implementation that has no independent specification. It can change over night and break all your software. Or it can be abandoned because the current maintainers get tired of it.
5:07:03
beach
_sfiguser: When I give talks to industry, I say that a project leader that chooses a language without an independent published standard should be fired.
5:07:24
beach
Because that project leader puts the product and sometimes the entire company in a very difficult situation.
5:09:24
buffergn0me
Have a client with a system on 2.7 right now, the "upgrade" path is to rewrite in node.js...
5:10:14
buffergn0me
In contrast two weeks ago I migrated another client's Common Lisp system to a new server two weeks ago. Has not been touched in almost a decade and still runs fine.
5:12:30
aeth
_sfiguser: You just got a new reason. Stuff from 1994 will run fine today without any modifications, and stuff before Common Lisp from the 1970s will run with very minimal modifications, if any.
5:15:36
beach
https://pdfs.semanticscholar.org/presentation/fb4b/bf38068e9044acc007c723e8a13cfb14ba48.pdf
5:15:50
aeth
_sfiguser: It's usually in the 3x to 5x slower range, e.g. (as SBCL) https://benchmarksgame-team.pages.debian.net/benchmarksgame/which-programs-are-fast.html
5:16:10
beach
_sfiguser: Besides, as I often say in my talks, it is impossible to write a C++ program that is both fast and maintainable.
5:17:20
jackdaniel
imho in moderate size applications and bigger most bottlenecks come from bad architecture / data structures / algorithms
5:17:56
buffergn0me
There are just no CL implementations that do tracing or profile-guided optimizations
5:18:05
aeth
_sfiguser: For the most part, if it's slower it's because not as much attention is put into compilers compared to something like GCC or LLVM, which will do some amazing optimizations. (Except those optimiziations don't make the language *that* much faster!)
5:19:37
beach
So heisig just told me that there is a paper that allocating an instance in CLOS is faster than allocating an instance in C++, for the simple reason that malloc()/free() is slower than most GC systems used by Common Lisp.
5:19:37
aeth
jackdaniel: Where Lisp really shines is where you need to do something messy but can hide it in a macro so it still is readable
5:20:35
jackdaniel
aeth: where lisp looks really ugly is where you need to cut some bullshit abstraction hidden behind macros
5:20:57
buffergn0me
jackdaniel: Does lightning do tracing? I thought it was just an assembler-as-a-library
5:21:04
aeth
jackdaniel: as long as it's not a code-walker it's not normally bad. Code walkers are evil, though.
5:21:38
jackdaniel
buffergn0me: I'd expect JIT on clisp part *using* gnu lightning; but I'd have to read into clisp to confirm that
5:27:21
aeth
buffergn0me: Do CL implementations have enough to JIT Foo when you have a Foo->CL compiler? e.g. JS->CL. JS basically relies on JIT.
5:30:22
buffergn0me
jackdaniel: Yeah I heard about that. CLISP is using lightning to native code compile their bytecode. So in that sense every CL implementation with a compiler can be a JIT, and Lisp is the "original" JITed language. The problem is today people have started using the phrase JIT to refer to tracing- and/or profile-based runtime optimization. Which is a very different technique.
5:31:34
buffergn0me
aeth: Yeah, CL-JavaScript is definitely a JIT JS implementation. And it was faster than Seamonkey when it first came out.
5:36:11
drmeister
Is anyone good with writing setf forms? I've got one that's not quite what I need and I'm a bit stuck with it.
5:36:53
aeth
buffergn0me: Probably not. I'm reminded of https://accidentallyquadratic.tumblr.com/post/142387131042/nodejs-left-pad
5:37:51
drmeister
If the value doesn't appear in alist - then I need (cons "key" value) to be pushed into the alist.
5:39:13
drmeister
I'm kind of stuck with strings as keys because I'm translating a bunch of stupid Python to Common Lisp.
5:44:08
jackdaniel
then take define-alist-get assoc from alexandria and tweak its define-setf-expander expansion to suit your needs
5:54:25
drmeister
buffergn0me: No - I'm kind of stuck with alists - it's the closest thing to Python's dictionaries that work with **keys.
5:57:22
dim
I guess I don't understand what makes the **keys calling convention in Python something interesting for your CL design here
5:58:37
drmeister
Well, (1) we started with alists and now we are kind of stuck with them (2) we have a LOT of very small dictionaries - so alists aren't such a bad idea.
6:00:04
dim
each time I'm using alist or plist directly I wish I had done some abstraction layer to use a gethash like API on top of them
6:00:05
drmeister
buffergn0me: Yeah - you are right about plists and **keys. There are a couple of other things I haven't mentioned. Namely someone else chose the alists and so we are kind of stuck with them.
6:00:48
jackdaniel
buffergn0me: arguably alists are better organized, each entry has both key and value and there is no mistake about which entry is what (separate lists)
6:01:41
dim
drmeister: how much work would you anticipate moving from alist to your own abstraction would be here?
6:01:49
phoe
Except if you go (setf ([] alist "d") 3) you want this to become a no-op, because the value 3 is already present in ("c" . 3)
6:02:37
buffergn0me
Haha, that is a fair point. I was just reading an article by Wirth about how no one ever uses abstract data types...
6:02:58
dim
drmeister: nobody ever has the time, when you look at it that way, the other angle being how much time are you going to spend because you did NOT move from alist to your own abstraction? how much deeper do you want to dig this hole?
6:02:59
drmeister
See, we translated jupyter widgets to Common Lisp. Then we translated nglview (a molecular viewer) and now we are translating bqplot (Bloomberg plotting library).
6:04:57
phoe
this means to me, "do all of the mutation unless the key is already present in the alist somewhere"
6:05:01
dim
drmeister: my remark is more to the level of “hiding it in a macro”, I think you might consider making it obvious in a data structure / api
6:05:25
jackdaniel
phoe: what's the point of such juggling if he can simply hardcode test in setf expanded copied from alexandria?
6:05:50
drmeister
dim: It made the code very hard to read with all the (cdr (assoc key table :test 'string=))
6:05:53
phoe
jackdaniel: that's what I mean - he can insert that test into the setf-expander from alexandris
6:06:09
buffergn0me
The last number I encountered from someone that benchmarked was 100 entries for list vs hash table break-even
6:06:31
jackdaniel
I've seen a lot of "if, unless, conditionally", sounds much more compliacted. but maybe I'm not following careful enough
6:06:50
buffergn0me
That was about a decade ago, it's probably even worse for hash tables today because of larger cache sizes
6:11:57
dim
I think you might find https://github.com/gwkkwg/cl-containers/blob/master/tests/test-containers.lisp#L142 relevant to your current situation
6:15:35
dim
your main immediate problem is providing an API that handles both push or replace a value for a given dictionnary key, right?
6:18:25
dim
well anyway good luck, my day is done. You seem to always have interesting problems to solve drmeister, have fun!