jackdaniel changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language<http://cliki.net/> logs:<https://irclog.whitequark.org/lisp,http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.5, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
kushal has quit [Remote host closed the connection]
kushal has joined #lisp
azimut has joined #lisp
regreg has joined #lisp
fikka has joined #lisp
eschulte has quit [Ping timeout: 272 seconds]
fikka has quit [Ping timeout: 252 seconds]
lumm has quit [Quit: lumm]
Lycurgus has quit [Quit: Exeunt]
<AeroNotix> wish I could combine my two passions, lisp and snooker
<regreg> AeroNotix: write a snooker video game in lisp :)
<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
trocado has quit [Ping timeout: 252 seconds]
<regreg> AeroNotix: even better then, you will have less coding to do
<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.
<regreg> AeroNotix: you could publish it and make money from it
<AeroNotix> regreg: yeah me and the five other open source and snooker nerds would love it
<Bike> dive bars don't have such niceties
<AeroNotix> snooker isn't played in dive bars!
<Bike> we'll see about that
<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.
<AeroNotix> and it can take a lot of back and forth between replays to get the positions just right
<AeroNotix> the balls are brightly coloured, the game is literally played on a green screen. Seems like it should be trivial
<Bike> nothing about image processing is "trivial", but i'm sure it's possible
<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
<Bike> this uses lasers rather than just a camera
<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
<AeroNotix> or as a training aid. Snooker schools in the UK are big deals
<Bike> i mean, lasers to detecxt the ball positions, if i have this right
<Bike> i guess you could also make a fancy table
<Bike> something something magnets
<Bike> for extra fancy, let it move the balls too, for infinite cheating opportunities
<AeroNotix> Bike: I wondered about putting something inside the balls but pros would be up in arms about stuff like that
<Bike> yeah
<AeroNotix> there are regulations about ball weight and deviation
<Bike> cheatin'
<AeroNotix> snooker rarely has any cheating going on. It's a very civilized sport
<Bike> again, we'll see about that
<AeroNotix> often players will claim their own fouls even when the ref misses it
<AeroNotix> anyway ot
<AeroNotix> in other news my lisp z80 emulator can now run my z80 brainfuck interpreter code ;)
<regreg> AeroNotix: I'm making an OS that is supposed to run on Z80!
<AeroNotix> regreg: interesting
<AeroNotix> link?
<regreg> AeroNotix: from Z80 up to zArch mainframes
<regreg> a sort of powerful DOS that has optional need for an MMU
<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.
<AeroNotix> regreg: real hardware?
<regreg> AeroNotix: ZX Spectrum
<AeroNotix> oh ok
<AeroNotix> English then?
<regreg> no, Romanian, ZX Spectrum compatibles were very popular in EEU
<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
<AeroNotix> just mentioned English cause the speccy was dead popular in the UK
<regreg> I'm thinking of providing a powerful BASIC dialect
<AeroNotix> screw basic
<AeroNotix> lisp
<AeroNotix> take a look at ulisp. Something like that would be cool
<regreg> I intend to extend the DEF FN command so that it can implement arbitrary functions
<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
<regreg> I see..
<regreg> I'm not a big fan of lisp
<regreg> I'm more of a TCL fan
<Bike> why are you in this channel...?
<vsync> AeroNotix: ooooh
<regreg> Bike: there are cool people here :)
<AeroNotix> sick burn
<Bike> to talk about lisp
<Bike> anyway, what subset?
<regreg> I like CLOS a lot
<AeroNotix> Bike: functions, some iteration primitives, control forms, structs
<Bike> i mean, i think all the base semantics aren't too hard to implement
<Bike> or could just throw cleavir at it
<AeroNotix> yeah. To be honest calling it a "subset of CL" is a bit strong. It's more "a shitty version of lisp"
<Bike> look on the bright side. lisp started as a shitty version of lisp too
<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
<Bike> well yeah the main thing would be not doing all thousand functions
<Bike> who really needs format
<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
<AeroNotix> Bike: format on z80 might be fuken rad actually
<AeroNotix> but probably also 500 bytes on its own
<vsync> AeroNotix: can you get more RAM by bank switching?
<AeroNotix> vsync: yes
<vsync> guess that might be "cheating"... depends the goal of your project
<regreg> cheating
<regreg> will it load from tape?
<regreg> :)
* vsync learned from Computer Science that the tape can be infinite
<AeroNotix> vsync: it's just more complicated to create. With only a handful of chips you can create a useful z80 "computer"
<AeroNotix> I need to actually get some hw. I've mostly been focused on creating the emulator and development tools
pierpal has quit [Ping timeout: 240 seconds]
|3b|` has joined #lisp
|3b| has quit [Ping timeout: 264 seconds]
ozzloy has quit [Ping timeout: 268 seconds]
dvdmuckle has quit [Ping timeout: 272 seconds]
dvdmuckle has joined #lisp
xificurC has quit [Remote host closed the connection]
Roy_Fokker has quit [Quit: Leaving]
|3b|` is now known as |3b|
it3ration has joined #lisp
it3ration has quit [Ping timeout: 272 seconds]
<gendl> Hi, is there a portable way to delete a package nickname?
buffergn0me has joined #lisp
logicmoo has quit [Read error: Connection reset by peer]
<Bike> rename-package
phax has joined #lisp
dmiles has joined #lisp
stardiviner has joined #lisp
lonjil has quit [Ping timeout: 252 seconds]
igemnace has joined #lisp
joast has quit [Quit: Leaving.]
joast has joined #lisp
<pjb> But notice that rename-package has "undefined consquences if new-name or any new-nickname conflicts with any existing package names."
fikka has joined #lisp
<vsync> of all the things to leave undefined
<pjb> I interpret that strictly, to mean that if there is already a package with the same name or nickname, rename-package can fail.
<vsync> I like almost everything about the package system fine, except nicknames
<Bike> hm?
dddddd has quit [Remote host closed the connection]
<pjb> So I call it twice, using a temp name, like in com.informatimago.common-lisp.cesarum.package:add-nickname
<pjb>
<pjb> But perhaps "nickname conflicts" are only when the name-package association is different?
<pjb> In that case, removing a nickname could be done conformingly with (rename-package package (package-name package) (remove old-nickname (package-nicknames package)))
<pjb> + :test (function string=) ; sorry.
fikka has quit [Ping timeout: 272 seconds]
jeosol_ has joined #lisp
pierpal has joined #lisp
pierpal has quit [Remote host closed the connection]
phax has quit [Quit: phax]
meepdeew has joined #lisp
bradcomp has joined #lisp
pyx has joined #lisp
meepdeew has quit [Ping timeout: 252 seconds]
bradcomp has quit [Ping timeout: 252 seconds]
pierpa has quit [Quit: Page closed]
Pixel_Outlaw has joined #lisp
krwq has joined #lisp
pyx has quit [Quit: WeeChat 2.1]
buffergn0me has quit [Ping timeout: 250 seconds]
danielxvu has quit [Remote host closed the connection]
SaganMan has joined #lisp
danielxvu has joined #lisp
<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.
<aeth> I can't do that in my particular case here, though, because I have (binding thing &key ...) instead of (binding thing)
<aeth> The next best thing I can think of is having some symbol imply repetition, e.g. (foo * :some-key 42)
<aeth> What symbol would be the most intuitive for not writing foo twice when I'm binding foo to the variable foo?
<no-defun-allowed> is it possible to tell sbcl to do sin with single-floats?
<no-defun-allowed> i can coerce from double to single but i think that's a waste
<Bike> you mean, pass it a double and have it return a single?
Pixel_Outlaw has quit [Quit: Leaving]
jkordani_ has quit [Read error: Connection reset by peer]
v0|d has quit [Ping timeout: 244 seconds]
APic has quit [Ping timeout: 255 seconds]
igemnace has quit [Quit: WeeChat 2.2]
it3ration has joined #lisp
bradcomp has joined #lisp
it3ration has quit [Ping timeout: 246 seconds]
APic has joined #lisp
buffergn0me has joined #lisp
anewuser has joined #lisp
<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?
Bike has quit [Quit: Lost terminal]
* |3b| finds DO at the end of previous clause pretty scary in LOOP :p
* |3b| 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
<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.
<mfiano> Yes, I think `do` at the end of a clause is quite scary as well.
<aeth> Well I get my LOOP style from Python and in Python you put the : at the end of a line
<aeth> loop is just an ALGOL language.
<Fade> I don't see it.
<aeth> And in ALGOL you put DO at the end, too. https://en.wikipedia.org/wiki/ALGOL
<aeth> "FOR A:= 0.0 STEP D UNTIL 6.3 DO"
<|3b|> DO ... AND COLLECT makes more sense to me than UNLESS ... AND COLLECT
<|3b|> (which is how i read it)
<aeth> |3b|: Honestly, I think that's an issue with SLIME's loop indentation
<aeth> and should line up with the setf not with the unless
* |3b| would be equally confused then
<aeth> even if I violate ALGOL style and put the DO at the start of the line, that still won't happen
<|3b|> if loop clauses are at the left, it is easier to scan the loop logic
<|3b|> *clauses start at the left
<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
<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).
meepdeew has joined #lisp
<mfiano> Which makes it so much more readable
<aeth> mfiano: ime, the keyword ones aren't formatted correctly
<|3b|> you could do part of the destructuring in the LOOP and only parse the keys in the inner part
<aeth> mfiano: I rarely write loops so it could have changed
<|3b|> might also canonicalize the slot first instead of constantly checking for listp
<|3b|> for .slot in slots for slot = (if (atom slot) (list slot slot) slot) ... or whatever makes the rest work without testing
<aeth> oh good point, that removes one of the two tests
<|3b|> then for (binding slot-name . keys) = slot and only destructure keys
<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.
<|3b|> (still seems a bit messy, but hard to clean up more without writing it out)
meepdeew has quit [Ping timeout: 252 seconds]
<aeth> mfiano: oh, hmm, keywords work correctly
<aeth> I guess I'll use keywords
<aeth> I guess I'll put the first with on its own line so it lines up
caltelt has joined #lisp
<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
<Fade> have any of you guys built abcl lately?
* |3b| also wonders about the semantics of that macro with duplicated slot names
<|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?)
<mfiano> Also wonder why you spend this much time refactoring macros into a completely different form from using mapcar.
<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
<aeth> The only thing that I changed in my refactoring is adding :elt so that I could use destructuring-bind
<|3b|> aeth: what is the corresponding macroexpansion for that use?
<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.
<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.
<|3b|> ah, maybe that DO at end confused me again
<aeth> The row (or index if it's 1D) is called "ID" because in my engine it almost always represents an ID
meepdeew has joined #lisp
<aeth> oh sorry, it's called "index" isn't it
<aeth> This is what happens when you have a large program gradually refactored over many years
<aeth> My engine is about as consistent as a team of people writing it in one year
* |3b| should probably go sleep instead of failing to read code correctly :)
<mfiano> It doesn't help that you have changed game ideas 3-4 times since I heard you talking about your engine
<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
<Fade> it looks like anything > jdk8 is a no go zone.
<aeth> mfiano: do you think it would look better if I have (loop\n so that all of the keywords line up?
<mfiano> No, just no.
<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
<mfiano> Wow, your SLIME is very strange.
<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 :/
<aeth> mfiano: This macro and the ECS macros are just inherently incredibly complicated.
<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
<mfiano> No, I'm talking purely style and proper indentation.
<aeth> ah
<mfiano> No modifications made
<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
<mfiano> If I made modifications to the style, it would be arguably even easier to read
X-Scale has quit [Ping timeout: 246 seconds]
ealfonso has joined #lisp
<_sfiguser> guys which compiler do you suggest for lisp i see that the most common ones are "abcl" "ccl" "clisp" "ecl" "sbcl"
<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?
<_sfiguser> which one should i use ?
<_sfiguser> i m new to lisp
<ealfonso> _sfiguser I use sbcl and I'm happy with it
<jgkamat> _sfiguser: sbcl is the most 'mainstream' one
<jgkamat> I like clisp as well
<_sfiguser> is mainstream but i heard is the one not anymore mantained ?
<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).
<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
<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.
<aeth> Quite a few libraries don't work in ABCL, CLISP, or CMUCL.
<aeth> (In case I was unclear, CCL compiles faster. SBCL's compiler produces faster code, in general.)
<_sfiguser> okok thanks a lot aeth ! i will stick to sbcl then
<beach> Good morning everyone!
<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.
Lycurgus has joined #lisp
stardiviner has quit [Remote host closed the connection]
<_sfiguser> also the racket lang seems uinteresting
<beach> _sfiguser: There is a huge difference.
<beach> _sfiguser: Common Lisp is a language with a standard, published by an independent standards orginaization.
<_sfiguser> what about racket?
<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.
<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.
<beach> Because that project leader puts the product and sometimes the entire company in a very difficult situation.
FreeBirdLjj has joined #lisp
nebunez has joined #lisp
<buffergn0me> Like everyone stuck on Python 2.7 right now
<_sfiguser> ok beach but for exmple does python have a standard ? the one you talk about ?
<beach> _sfiguser: Python does not have an independent standard.
<buffergn0me> Have a client with a system on 2.7 right now, the "upgrade" path is to rewrite in node.js...
<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.
<_sfiguser> buffergn0me, who uses lisp in industry and for what reason ?
<buffergn0me> For pretty much anything?
<beach> _sfiguser: People already answered that question for you.
<buffergn0me> I started out in Lisp because of Mirai (3d graphics/animation system)
<beach> Google, Grammarly, ...
<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.
<buffergn0me> The client I mentioned is a charter airline tour operator
<buffergn0me> That runs their reservation system on Common Lisp
<beach> Oh, and Igor (score editor) is written in Lisp as well.
<_sfiguser> is common lisp performance comparable to C ?
<beach> _sfiguser: Yes, it can be. Read the articles by Didier Verna.
<_sfiguser> okok thans
<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
<beach> _sfiguser: Besides, as I often say in my talks, it is impossible to write a C++ program that is both fast and maintainable.
<aeth> Very comparable to Java, except AOT instead of JIT.
<jackdaniel> imho in moderate size applications and bigger most bottlenecks come from bad architecture / data structures / algorithms
<buffergn0me> Technically every Common Lisp implementation with a compiler is a JIT
<buffergn0me> There are just no CL implementations that do tracing or profile-guided optimizations
<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!)
<jackdaniel> buffergn0me: I'd say "may be a jit" not "is a jit"
<aeth> The unavoidable overhead is the GC, but there are better GCs that could be used.
<buffergn0me> jackdaniel: good point
<jackdaniel> clisp does some jit compilation with gnu lightning afaik
<jackdaniel> (unreleased version at least)
<_sfiguser> thanks guys
<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.
<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
<beach> .. there is a paper stating that...
<jackdaniel> aeth: where lisp looks really ugly is where you need to cut some bullshit abstraction hidden behind macros
<jackdaniel> (and mixin spaghetti)
<buffergn0me> jackdaniel: Does lightning do tracing? I thought it was just an assembler-as-a-library
<aeth> jackdaniel: as long as it's not a code-walker it's not normally bad. Code walkers are evil, though.
<aeth> Anything beyond symbol-macrolet shouldn't be done
<jackdaniel> buffergn0me: I'd expect JIT on clisp part *using* gnu lightning; but I'd have to read into clisp to confirm that
Lycurgus has quit [Quit: Exeunt]
<jackdaniel> buffergn0me: ↑
_sfiguser has quit [Quit: Leaving]
<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.
<aeth> (With all that volume maybe 1f-6% is useful.)
<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.
<buffergn0me> aeth: Yeah, CL-JavaScript is definitely a JIT JS implementation. And it was faster than Seamonkey when it first came out.
<buffergn0me> IDK if it's still faster now, but it certainly is a lot more memory efficient
it3ration has joined #lisp
<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.
<aeth> buffergn0me: Probably not. I'm reminded of https://accidentallyquadratic.tumblr.com/post/142387131042/nodejs-left-pad
<drmeister> I have alists that look like (list (cons "x" <value>) (cons "y" <yvalue>) ... )
<drmeister> I need to go (setf ([] alist "key") value)
<drmeister> If the value doesn't appear in alist - then I need (cons "key" value) to be pushed into the alist.
<drmeister> Or does anyone know if such a macro exists somewhere?
<drmeister> I'm kind of stuck with strings as keys because I'm translating a bunch of stupid Python to Common Lisp.
<jackdaniel> drmeister: (let ((list ())) (setf (alexandria:assoc-value list :foo) 4) list) ;?
it3ration has quit [Ping timeout: 252 seconds]
<jackdaniel> assoc-value takes test predicate too
<drmeister> Yeah - that's been suggested to me - but I'd like to bury the test in the macro.
<drmeister> I have a hundred of these.
<drmeister> It makes me miss x[y] = z
<drmeister> I'll dig the code out of alexandria
<jackdaniel> then take define-alist-get assoc from alexandria and tweak its define-setf-expander expansion to suit your needs
<buffergn0me> drmeister: sounds like you need a property list instead of an alist
parjanya has quit [Remote host closed the connection]
<drmeister> buffergn0me: No - I'm kind of stuck with alists - it's the closest thing to Python's dictionaries that work with **keys.
<drmeister> jackdaniel: Good suggestion - I did that.
dale has quit [Quit: dale]
<dim> drmeister: what about using an hash table there?
<dim> I guess I don't understand what makes the **keys calling convention in Python something interesting for your CL design here
<buffergn0me> I'm confused, property lists seem like a better fit for ** than alists
<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.
<dim> very small dicts, alist and plist might be better than hash tables, yeah
<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
<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.
<dim> but I tend to be too lazy about it
<phoe> drmeister: so, basicall, you have an alist (("a" . 1) ("b" . 2) ("c" . 3))
<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)
<drmeister> phoe: Yep
<phoe> And you go (setf ([] alist "d") 4)
<phoe> At which point you just push ("d" . 4) into the alist
<jackdaniel> s/separate lists/separate conses/
<drmeister> Yeppers
<dim> drmeister: how much work would you anticipate moving from alist to your own abstraction would be here?
<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)
<drmeister> It would be quite a lot - and we don't have the time.
<phoe> Do I understand it correctly?
<drmeister> Phoe: Yes.
<drmeister> I already have the setf code in place - stolen from Alexandria
<buffergn0me> Haha, that is a fair point. I was just reading an article by Wirth about how no one ever uses abstract data types...
<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?
<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).
<dim> sorry about not answering your immediate question here, that said
<drmeister> In total - it's about 30,000 lines of code that uses these alists extensively.
<drmeister> Anyone want to volunteer to switch to hash-tables?
<buffergn0me> That is so 70s style
<dim> as you said we're not sure hash-table is going to be better
<phoe> drmeister: I think you can use alexandria's SETF ASSOC-VALUE
<dim> lots of small one, the cost of building them might be just too big
<aeth> I would suspect that hash-table would benchmark better in almost every case in SBCL
<phoe> except you wrap the actual code in a check, (unless (rassoc-value alist key) ...)
<drmeister> I don't think a hash-table would be better - they have a large constant cost.
<phoe> this means to me, "do all of the mutation unless the key is already present in the alist somewhere"
<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
<jackdaniel> phoe: what's the point of such juggling if he can simply hardcode test in setf expanded copied from alexandria?
<phoe> AFAIR, for less than 20 entries in a dictionary, hashtables are going to be slower
<drmeister> dim: It made the code very hard to read with all the (cdr (assoc key table :test 'string=))
<phoe> jackdaniel: that's what I mean - he can insert that test into the setf-expander from alexandris
<phoe> alexandria
<drmeister> I changed it to ([] table key)
<buffergn0me> The last number I encountered from someone that benchmarked was 100 entries for list vs hash table break-even
<dim> (defstruct param key value) (defstruct dict params) and some api on-top?
<jackdaniel> I've seen a lot of "if, unless, conditionally", sounds much more compliacted. but maybe I'm not following careful enough
<dim> drmeister: oh that's what your [] is? ugly but to the point ;-)
<buffergn0me> That was about a decade ago, it's probably even worse for hash tables today because of larger cache sizes
<phoe> Xach: did you already release the dist update?
<dim> drmeister: do you know of https://github.com/gwkkwg/cl-containers ?
<dim> I think you might find https://github.com/gwkkwg/cl-containers/blob/master/tests/test-containers.lisp#L142 relevant to your current situation
<drmeister> dim: What should I draw from that?
<dim> API hints to solve your setf push-or-replace situation, I guess, mostly
<dim> your main immediate problem is providing an API that handles both push or replace a value for a given dictionnary key, right?
<dim> (your dictionnary currently being an alist)
<drmeister> Yes ([] dict "a") is ugly - it makes me almost wish for Python's dict["a"].
<drmeister> 1 point to house Slytherin for compactness.
<dim> well anyway good luck, my day is done. You seem to always have interesting problems to solve drmeister, have fun!
<drmeister> Good night - thanks for the feedback!
nebunez has quit [Ping timeout: 244 seconds]
doubledup has joined #lisp
vlatkoB has joined #lisp
nika has joined #lisp
caltelt has quit [Ping timeout: 240 seconds]
meepdeew has quit [Remote host closed the connection]
azimut has quit [Ping timeout: 240 seconds]
azimut has joined #lisp
lonjil has joined #lisp
orivej has joined #lisp
buffergn0me has quit [Ping timeout: 250 seconds]
azimut has quit [Ping timeout: 245 seconds]
lonjil has quit [Ping timeout: 252 seconds]
anewuser has quit [Ping timeout: 246 seconds]
lonjil has joined #lisp
azimut has joined #lisp
itruslove has quit [Remote host closed the connection]
it3ration has joined #lisp
it3ration has quit [Ping timeout: 272 seconds]
pjb has quit [Read error: Connection reset by peer]
dddddd has joined #lisp
itruslove has joined #lisp
asarch has joined #lisp
krwq has quit [Remote host closed the connection]
Copenhagen_Bram has quit [Ping timeout: 245 seconds]
orivej has quit [Ping timeout: 244 seconds]
aindilis has quit [Ping timeout: 260 seconds]
lavaflow has quit [Ping timeout: 240 seconds]
rumbler31 has joined #lisp
orivej has joined #lisp
light2yellow has joined #lisp
housel has quit [Read error: Connection reset by peer]
housel has joined #lisp
azimut has quit [Ping timeout: 246 seconds]
<_death> [] is a terrible name.. there is an association between trying to ape other languages and envy of them
asarch has quit [Quit: Leaving]
doubledup has quit [Quit: Leaving]
doubledup has joined #lisp
random-nick has joined #lisp
ismay has joined #lisp
rumbler31 has quit [Remote host closed the connection]
nowhere_man has joined #lisp
josemanuel has joined #lisp
SaganMan has quit [Ping timeout: 240 seconds]
azimut has joined #lisp
yoonkn has joined #lisp
it3ration has joined #lisp
SaganMan has joined #lisp
yoonkn has quit [Read error: Connection reset by peer]
yoonkn has joined #lisp
it3ration has quit [Ping timeout: 252 seconds]
nowhere_man has quit [Ping timeout: 246 seconds]
lumm has joined #lisp
azimut has quit [Ping timeout: 252 seconds]
nopf has joined #lisp
azimut has joined #lisp
orivej has quit [Ping timeout: 245 seconds]
yoonkn has quit [Ping timeout: 245 seconds]
ismay has quit [Remote host closed the connection]
Jachy has quit [Remote host closed the connection]
Manny8888 has quit [Remote host closed the connection]
no-defun-allowed has quit [Read error: Connection reset by peer]
nowhere_man has joined #lisp
yoonkn has joined #lisp
quazimodo has quit [Ping timeout: 244 seconds]
quazimodo has joined #lisp
lavaflow has joined #lisp
X-Scale has joined #lisp
lavaflow has quit [Ping timeout: 240 seconds]
Manny8888 has joined #lisp
<Xach> phoe: yes - why do you ask?
<phoe> Xach: nothing of big importance
<Xach> this was not as smooth as i would like
<Xach> stiil recovering from hardware failure to a degree :(
<phoe> ouch
pierpal has joined #lisp
makomo has joined #lisp
nika has quit [Quit: Leaving...]
lnostdal has quit [Ping timeout: 245 seconds]
pjb has joined #lisp
doubledup has quit [Ping timeout: 240 seconds]
lnostdal has joined #lisp
doubledup has joined #lisp
lnostdal has quit [Ping timeout: 252 seconds]
trittweiler has quit [Ping timeout: 244 seconds]
lnostdal has joined #lisp
it3ration has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
yoonkn has quit [Ping timeout: 272 seconds]
lnostdal has quit [Ping timeout: 252 seconds]
lnostdal has joined #lisp
it3ration has quit [Ping timeout: 245 seconds]
lonjil has quit [Ping timeout: 252 seconds]
lnostdal has quit [Ping timeout: 252 seconds]
hvxgr has quit [Ping timeout: 252 seconds]
lnostdal has joined #lisp
Inline has quit [Quit: Leaving]
Inline has joined #lisp
yoonkn has joined #lisp
hvxgr has joined #lisp
<pjb> drmeister: you have 3 solutions: 1- wrap your (cdr (assoc key table :test 'string=)) in a functional abstraction. 2- intern those strings into some package (intern key "PYTHON-SYMBOL"). 3- internalize the strings themselves: (setf (gethash key *interned-strings*) key) with (defparmeter *interned-strings* (make-hash-table :test 'equal) or 'equalp for case insensitivity.
housel has quit [Read error: Connection reset by peer]
<pjb> then (cdr (assoc (intern key "PYTHON-SYMBOLS" table))) or (cdr (assoc (gethash key *interned-strings* table)))
<pjb> (yes, apply 1- in any case).
<pjb> drmeister: it's rather trivial to write either a macro or a reader macro so that dict["a"] can be interpreted as ([] dict "a").
xificurC has joined #lisp
trittweiler has joined #lisp
Bike has joined #lisp
lonjil has joined #lisp
<oni-on-ion> cool
Lycurgus has joined #lisp
Arcaelyx has joined #lisp
yoonkn has quit [Remote host closed the connection]
nowhere_man has quit [Ping timeout: 244 seconds]
Achylles has joined #lisp
pfdietz has quit [Ping timeout: 250 seconds]
pjb has quit [Remote host closed the connection]
elfmacs has joined #lisp
elfmacs has quit [Ping timeout: 260 seconds]
lavaflow has joined #lisp
jeosol_ has quit [Quit: Page closed]
lavaflow has quit [Ping timeout: 246 seconds]
shlemas has joined #lisp
varjag has joined #lisp
it3ration has joined #lisp
it3ration has quit [Ping timeout: 272 seconds]
<easye> Anyone know of any open concolic testing CL code <https://en.wikipedia.org/wiki/Concolic_testing>?
makomo_ has joined #lisp
mkolenda has quit [Remote host closed the connection]
<easye> err, the language tested doesn't have to be Common Lisp (actually I am interested in many others: JavaScript, EVM, etc.), but is there any concolic testing analysis expressed in CL?
mkolenda has joined #lisp
makomo has quit [Ping timeout: 240 seconds]
lnostdal has quit [Ping timeout: 245 seconds]
bradcomp has quit [Ping timeout: 246 seconds]
rumbler31 has joined #lisp
rumbler31 has quit [Remote host closed the connection]
shlemas has quit [Quit: shlemas]
<drmeister> pjb: Thank you - but I've welcomed S-expressions into my heart.
kushal has quit [Remote host closed the connection]
kushal has joined #lisp
lnostdal has joined #lisp
veinofsony is now known as veinof
Pixel_Outlaw has joined #lisp
Roy_Fokker has joined #lisp
edgar-rft has quit [Remote host closed the connection]
cage_ has joined #lisp
Lycurgus has quit [Quit: Exeunt]
lavaflow has joined #lisp
igemnace has joined #lisp
pjb has joined #lisp
<phoe> drmeister: fun trivia, dict["a"] is an M-expression, which was the proposed syntax for Lisp back in the day
<pjb> and it reads as (dict "a").
Achylles has quit [Ping timeout: 252 seconds]
spm_ has joined #lisp
ebrasca has quit [Remote host closed the connection]
Achylles has joined #lisp
acolarh has quit [Ping timeout: 252 seconds]
acolarh has joined #lisp
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
astalla has joined #lisp
asarch has joined #lisp
light2yellow has quit [Quit: gtg]
Achylles has quit [Remote host closed the connection]
acolarh has quit [Ping timeout: 240 seconds]
acolarh has joined #lisp
it3ration has joined #lisp
<gendl> Hi, any idea why asdf would suddenly start ignoring asdf/output-translations:*output-translations* ?
<gendl> asdf/output-translations:*output-translations*
<gendl> (((#P"/Users/dcooper8/.cache/common-lisp/ccl-1.11-f96-macosx-x64/**/*.*" T) (T T) (T #P"/Users/dcooper8/.cache/common-lisp/ccl-1.11-f96-macosx-x64/**/*.*")))
<gendl> ^ that's my current value of *output-translations*
<gendl> but:
<gendl> (asdf:output-files 'asdf:monolithic-compile-bundle-op :pro) -->
<gendl> (#P"/Users/dcooper8/genworks/gdl/frosting/pro/pro--all-systems.dx64fsl")
<gendl> same thing with compiling systems etc -- the fasls are just going directly in with the sources
<gendl> i'm not sure when this started happening, as far as I know I didn't touch my asdf version... have been running 3.3.1 for a while.
it3ration has quit [Ping timeout: 240 seconds]
bradcomp has joined #lisp
bradcomp has quit [Ping timeout: 246 seconds]
gingerale has joined #lisp
Achylles has joined #lisp
<gendl> ... working on it... Just started a bare vanilla lisp with asdf, and the output-file is working correctly. So, apparently we're doing something to step on the output-translations at some point. Tracking it down...
rozenglass has joined #lisp
madearl has joined #lisp
<gendl> Just cleared all old .fasl files, in ~/.cache/common-lisp, quicklisp/cache/, and the ones which were ending up next to source files, restarted, and now it seems back to normal.
<gendl> apparently something was reading one or more stale .fasl files which was causing things to get wedged.
Copenhagen_Bram has joined #lisp
<pjb> ok.
azimut has quit [Ping timeout: 246 seconds]
SenasOzys has joined #lisp
Oladon has joined #lisp
azimut has joined #lisp
fortitude_ has joined #lisp
azimut has quit [Ping timeout: 252 seconds]
rocx has joined #lisp
aijony has joined #lisp
pjb has quit [Read error: Connection reset by peer]
pjb has joined #lisp
easye has quit [*.net *.split]
Xof has quit [*.net *.split]
easye has joined #lisp
dueyfinster has joined #lisp
madearl has quit [Quit: ERC (IRC client for Emacs 26.1)]
kristof has joined #lisp
jinkies has joined #lisp
jinkies has quit [Read error: Connection reset by peer]
bradcomp has joined #lisp
buffergn0me has joined #lisp
it3ration has joined #lisp
lavaflow has quit [Ping timeout: 245 seconds]
bradcomp has quit [Ping timeout: 246 seconds]
it3ration has quit [Ping timeout: 244 seconds]
lavaflow has joined #lisp
thodg has joined #lisp
luis has quit [*.net *.split]
Oddity has quit [*.net *.split]
umpc has quit [*.net *.split]
johs has quit [*.net *.split]
ecraven has quit [*.net *.split]
ft has quit [*.net *.split]
exit70 has quit [*.net *.split]
mjl has quit [*.net *.split]
billstclair has quit [*.net *.split]
emma has quit [*.net *.split]
dueyfinster has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
luis has joined #lisp
SenasOzys has quit [Ping timeout: 272 seconds]
Lycurgus has joined #lisp
ecraven has joined #lisp
umpc has joined #lisp
<gendl> I finally found the issue. aserve.asd from https://github.com/franzinc/aserve is disabling output-translations.
ebrasca has joined #lisp
wws has joined #lisp
Oddity has joined #lisp
ebrasca has quit [Remote host closed the connection]
ebrasca has joined #lisp
orivej has joined #lisp
rpg has joined #lisp
<pjb> gendl: that's how you know it's a low quality library.
<pjb> How much time did that make you lose?
thodg has quit [Remote host closed the connection]
azimut has joined #lisp
<gendl> pjb: way more than i'd like to admit.
<gendl> tbf the aserve.asd is not used by Franz themselves - it was just contributed by somebody.
<gendl> I assume Franz includes it in their distribution as a courtesy.
<gendl> but yeah, doing that sort of thing borders on malicious.
<gendl> although I don't assign any malicious intent to anyone in this case, the effect it has can be felt as malicious.
<gendl> the library itself is anything but low-quality, when used with Allegro (or now, zacl).
Achylles has quit [Ping timeout: 252 seconds]
<gendl> I'm going to lodge a pull request to delete that (asdf:disable-output-translations) - I don't see where it serves any possible useful purpose. Maybe 20 years ago it did.
<gendl> there are a few other minor tweaks needed to make current aserve work with zacl on SBCL and CCL - someone (and it might end up being me as well) needs to lodge a pull request for those as well.
<gendl> otherwise a very slightly forked version of aserve will have to be carried by Quicklisp.
<fe[nl]ix> I remember a complaint buy sombody at Franz a few years ago, that output translations broke their special build system which relied heavily on symlinks
<fe[nl]ix> so I'm pretty sure they use ASDF internally to some extent
<gendl> Hmm well the original contributor of that aserve.asd file was James Anderson.
<gendl> If anyone knows if/where he's still around, I can ask him his original intention there (if he remembers from 20+ years ago).
joni has joined #lisp
<fe[nl]ix> hahaha
<fe[nl]ix> James likes to use logical output translations and ASDF doesn't work with those
<gendl> I can understand people wanting to disable or tweak output-translations for certain build environments, but 1) it sure doesn't seem like that should ever be done in an actual .asd file(!), and 2) there should be some temporary way to do it, which "bounces back" when the special build environment comes out of scope (I'm not sure the canonical way to tweak or disable output-translations "temporarily").
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rpg has joined #lisp
runejuhl has quit [Quit: WeeChat 2.1]
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
v0|d has joined #lisp
SenasOzys has joined #lisp
azimut has quit [Ping timeout: 245 seconds]
gravicappa has joined #lisp
cage_ has quit [Quit: Leaving]
azimut has joined #lisp
joni has quit [Ping timeout: 246 seconds]
groovy2shoes has quit [Ping timeout: 252 seconds]
Fare has joined #lisp
pierpa has joined #lisp
Manny8888 has quit [Remote host closed the connection]
Elon_Satoshi has joined #lisp
Copenhagen_Bram has quit [Ping timeout: 252 seconds]
igemnace has quit [Quit: WeeChat 2.2]
Achylles has joined #lisp
ft has joined #lisp
Achylles has quit [Remote host closed the connection]
Elon_Satoshi is now known as Copenhagen_Bram
aleamb has joined #lisp
dale has joined #lisp
* aleamb nas
doubledup has quit [Remote host closed the connection]
Manny8888 has joined #lisp
dreamcompiler has joined #lisp
doubledup has joined #lisp
vlatkoB has quit [Remote host closed the connection]
it3ration has joined #lisp
aleamb has quit [Ping timeout: 240 seconds]
aleamb has joined #lisp
it3ration has quit [Ping timeout: 260 seconds]
rumbler31 has joined #lisp
joni has joined #lisp
rumbler31 has quit [Remote host closed the connection]
kristof has quit [Ping timeout: 240 seconds]
Fare has quit [Ping timeout: 250 seconds]
gravicappa has quit [Ping timeout: 246 seconds]
Fare has joined #lisp
Jesin has quit [Quit: Leaving]
Jesin has joined #lisp
bradcomp has joined #lisp
bradcomp has quit [Ping timeout: 246 seconds]
orivej has quit [Ping timeout: 240 seconds]
makomo_ has quit [Quit: WeeChat 2.2]
makomo has joined #lisp
josemanuel has quit [Quit: leaving]
it3ration has joined #lisp
it3ration has quit [Ping timeout: 245 seconds]
shlemas has joined #lisp
dreamcompiler has quit [Quit: dreamcompiler]
kushal has quit [Remote host closed the connection]
kushal has joined #lisp
joni has quit [Ping timeout: 250 seconds]
random-nick has quit [Ping timeout: 244 seconds]
peccu has quit [Ping timeout: 264 seconds]
<makomo> hello. a question regarding the style of "read-modify-write" macros. c/p incoming.
<makomo> http://clhs.lisp.se/Body/05_ac.htm lists a couple of "read-modify-write" macros, describes their general form as "(operator preceding-form* place following-form*)" and defines the order of evaluation of their subforms. what i'm interested in particular is points (3) and (4) -- do you think (3) (4) is a better order than (4) (3)?
<makomo> personally i think the order (3) (4) is weird, because one would expect the value to be read (point (4)) right after the place's subforms are evaluated (before (3)), and not at the end of evaluating "following-forms" (after (3)).
<makomo> even define-modify-macro defines macros that work this way because their general form is (disregarding the multiple evaluation problem of the place's subforms) "(setf ,reference (function ,reference ,arg1 ,arg2 ...))". the order here is (2) (4) (3).
<makomo> the page above doesn't even list any macros that have "following-forms" and that use (3) (4) and i don't know of any examples off the top of my head. are there even any?
<makomo> this question of style might vary from macro to macro, but as a concrete example, what order would you expect from the macro "_f" given by https://i.imgur.com/ucUEOP0.png? disregard the actual implementation and try to only look at the call to the macro. here are the two implementations but with the modification that "op" isn't a symbol but a form that is evaluated to get a function:
<makomo> the macro "_f" is from On Lisp, p. 171
bradcomp has joined #lisp
<drmeister> How would I get a slot-definition given the slot name and the class of an object?
<drmeister> Do I need to loop through the clos:class-slots ?
<Bike> the find thing you were already doing
<Bike> find with :key #'slot-definition-name
<drmeister> Ah - ok.
<v0|d> drmeister: mind the diff btw slot-def and effective-slot-def.
<drmeister> What is the difference?
<drmeister> My copy of AMOP is a couple of miles away.
<v0|d> Basically, default values are copied into effective one while subclassing.
<Bike> effective slot definitions incorporate information from superclasses
<Bike> class-slots return them, and they're what you usually care about
doubledup has quit [Remote host closed the connection]
bradcomp has quit [Ping timeout: 250 seconds]
dale has quit [Quit: dale]
<drmeister> Thank you
nowhere_man has joined #lisp
stardiviner has joined #lisp
varjag has quit [Ping timeout: 272 seconds]
astalla has quit [Ping timeout: 240 seconds]
lemonpepper24 has quit [Ping timeout: 252 seconds]
shlemas has quit [Quit: shlemas]
<pjb> makomo: I don't understand it. (let ((v (vector 0 0 0 0 0 0)) (i 0)) (incf (aref v (incf i)) (incf i)) v) #| --> #(0 2 0 0 0 0) |# (in all implementations).
<pjb> makomo: that shows that (incf i) are evaluted strictly from left to right.
<pjb> (inside the outer incf form).
gector has quit [Read error: Connection reset by peer]
gector has joined #lisp
Oladon has quit [Quit: Leaving.]
Oladon has joined #lisp
<makomo> pjb: the analogy in your example would be "when is the place given by (aref v (incf i)) read?
<makomo> is it right after all of the subforms of AREF are evaluated, or only when all of the subforms of the outer INCF have been evaluated?
<makomo> you have nothing in your example that would affect the AREF place though, so it's not a very good example
<makomo> take a look at my example that i linked
<pjb> How would you have anything affecting the operator of the place, when the purpose of define-modify-macro (and other setf-expanders), is to make sure that the subforms are evaluated once for all?
<pjb> Any evaluation occuring on the right just cannot affect them.
<pjb> Only the read itself.
<pjb> (let ((v (vector 0 0 0 0 0 0)) (i 0)) (incf (aref v (incf i)) (progn (setf (aref v 1) 42) (incf i))) v) #| --> #(0 44 0 0 0 0) |#
<pjb> So this is what is specified by 5.1.3.
<pjb> The preceding-forms are actually the subforms of the place expression.
buffergn0me has quit [Ping timeout: 250 seconds]
<makomo> pjb: from what i can see in 5.1.3 that's not correct. preceding-forms are handled in (1). the subforms of the place are handled in (2)
<makomo> what i'm talking about is the ordering of (3) and (4)
<makomo> i get that incf & co. work however they work, but i'm wondering about defining your own place-based macros
<pjb> makomo: I don't know if (4) (3) would be better than (3) (4), but the later order, as specified, seems more logical to me.
<makomo> pjb: none of the macros listed in the figure ever use (3), because they don't have any following-forms
<makomo> and i don't know of any from the CL that do
<pjb> Ok, they evaluate the subforms of the place in (2). I don't know what the preceding-forms in (1) are.
<pjb> or incf, it's the increment.
<pjb> (incf place following-form)
<pjb> where's the preceding-form?
<makomo> it doesn't exist, that's why there's a "*" on the syntax
<makomo> but take PUSH for example
<makomo> (push obj place)
<makomo> obj is a preceding-form
Fare has quit [Ping timeout: 245 seconds]
<pjb> (push preceding-form place) ; ok.
<makomo> but no place-based macro has a following-form, so i don't have any examples (3) (4) vs. (4) (3)
<makomo> place-based macro within the CL spec, that is
<makomo> however, the macro _f i gave does have following-forms
<makomo> and now i'm wondering whether (3) (4) or (4) (3) is better style
<pjb> incf decf remf have following forms.
<makomo> oh wait, you're right
<pjb> with (3) (4) we get: (let ((v (vector 0 0 0 0 0 0)) (i 0)) (incf (aref v (incf i)) (progn (setf (aref v 1) 42) (incf i))) v) #| --> #(0 44 0 0 0 0) |#
<pjb> with (4) (3) we'd have: (let ((v (vector 0 0 0 0 0 0)) (i 0)) (incf (aref v (incf i)) (progn (setf (aref v 1) 42) (incf i))) v) #| --> #(0 2 0 0 0 0) |#
<makomo> i got stuck thinking that incf and decf increment/decrement by 1, bleh...
<pjb> so the setf would be inoperative. The first option gives us more semantic alternatives.
<pjb> Also, 5.1.3 specifies two separate phases: evaluation of the forms an subforms. Then read-compute-storee. Both phases can be performed thus easily by different parts: a macro for the eval, a function for the update.
<pjb> It would be harder to implement with (4) (3).
it3ration has joined #lisp
<makomo> i also prefer to use "compute" instead of "modify" :-)
<pjb> Now, who will write a modify macro where there are both preceding-forms and following-forms?
<makomo> hm, i guess that makes sense
<makomo> pjb: take a look at my link :-)
<makomo> this one
<makomo> idk, in this case i think i would prefer (4) (3), because _f almost looks like a normal function call, except that is modifies its first argument (which is given as a place)
<makomo> it*
<pjb> Yes. Nice example. Indeed, if you want to be consistent with 5.1.3, you will have to use _f34.
<makomo> right, but i think _f43 is more intuitive.
<makomo> so i wanted to hear what other people think and what they would expect
<pjb> Well, there's always the left-to-right order of evaluation. At least, _f34 respects that.
<makomo> hm what do you mean? don't they both respect the left-to-right order? (i'm not treating reading the place as an evaluation btw. i'm only taking into account the subforms of the macro and the place)
it3ration has quit [Ping timeout: 252 seconds]
<pjb> Sorry, I've got a harder time understanding what the values of (car yo) will be in the various subexpressions of _f43.
<pjb> I see what you mean. Yes, perhaps it's easier in _f43.
<makomo> i agree that both examples are pretty horrible :-D, but f43 might be a little easier to think about
stacksmith has quit [Ping timeout: 276 seconds]
<pjb> Are you sure such a macro would be useful? Instead, you could write a macro to generate a bunch of define-modify-macro forms for all the functions you need?
<pjb> Will you have things like: (_f43 (case (random 3) (0 (function sin)) (1 (function cos)) (3 (function atan))) (car yo)) ?
<makomo> hm well, i'm not sure yet, but wouldn't that be like defining lots of little useless functions instead of just using LAMBDA?
<makomo> i.e. _f allows you to use a function "on-the-spot", without having to define a one-off read-compute-update macro for it
<pjb> The question is whether the functions will always be known at compilation time, or whether they will be decided at run-time. In the former case, I don't think a macro like _f43 or _f34 is justified.
<makomo> hm why not?
<pjb> perhaps yes. Choose a good name for it!
<makomo> btw, from what i can see, (4) (3) is how it's implemented in On Lisp https://i.imgur.com/LXmuDG8.png
<makomo> assuming "OP" has left-to-right evaluation semantics of course
<makomo> otherwise you're screwed :D
<pjb> Yes. :-)
<makomo> (Graham's _f uses a symbol instead of a function)
<pjb> (no both remarks).
<pjb> So for consistency you could still want to use _f34. Just so (incf …) and (_f34 '+ …) give the same results.
<pjb> s/no/to/
<makomo> i guess that's a good point. i'm not sure whether that or "it almost looks like a function call and i expect left-to-right evaluation" is more compelling