Xach changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/>
acolarh has quit [Ping timeout: 252 seconds]
william1_ has joined #lisp
acolarh has joined #lisp
william1_ has quit [Ping timeout: 260 seconds]
torbo has joined #lisp
eddof13 has quit [Ping timeout: 258 seconds]
EvW has quit [Ping timeout: 245 seconds]
bitmapper has joined #lisp
karlosz has quit [Remote host closed the connection]
smazga has quit [Ping timeout: 268 seconds]
Lycurgus has joined #lisp
karlosz has joined #lisp
karlosz has quit [Remote host closed the connection]
karlosz has joined #lisp
Nilby has quit [Read error: Connection reset by peer]
asdf_asdf_asdf has quit [Quit: asdf_asdf_asdf]
karlosz has quit [Quit: karlosz]
Lycurgus has quit [Remote host closed the connection]
karlosz has joined #lisp
cg505 has quit [Quit: ZNC 1.6.5+deb1+deb9u2 - http://znc.in]
cg505 has joined #lisp
turona has quit [Ping timeout: 246 seconds]
turona has joined #lisp
stepnem has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
stepnem has joined #lisp
krisfris1 has quit [Quit: WeeChat 1.9.1]
krisfriss has joined #lisp
froggey has quit [Ping timeout: 260 seconds]
dilated_dinosaur has quit [Ping timeout: 260 seconds]
dilated_dinosaur has joined #lisp
Kundry_Wag has joined #lisp
froggey has joined #lisp
krisfris_ has quit [Quit: leaving]
karlosz has quit [Remote host closed the connection]
krisfris has joined #lisp
anewuser has quit [Quit: anewuser]
gnufr33d0m has quit [Quit: gnufr33d0m]
karlosz has joined #lisp
krisfriss has quit [Quit: WeeChat 1.9.1]
Codaraxis has quit [Quit: Leaving]
saravia has joined #lisp
ebzzry has quit [Ping timeout: 240 seconds]
raghavgururajan has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
asarch has joined #lisp
Kundry_Wag has joined #lisp
papachan has quit [Quit: Leaving]
<asarch> Is there any way to get the PNG file of the (com.informatimago.common-lisp.picture.cons-to-ascii:draw-list *values*)?
<pjb> asarch: there is no PNG file, it's TEXT output!!!
<pjb> People who paste text as png should be hung very short!
<asarch> Yes I know, I just was wondering...
<pjb> asarch: otherwise, there are ascii-art web services that will convert that into a svg and png…
<asarch> Django (Python's web framework) has a tool to get the relationships in the model
bitmapper has quit [Ping timeout: 260 seconds]
Kundry_Wag has quit [Ping timeout: 268 seconds]
<no-defun-allowed> pjb: Well yes, screenshotting text is annoying, but no need to hang people who do that.
<asarch> Bingo!: "Graphviz generates graphs from your data.", from Land of Lisp
<no-defun-allowed> It might not be what you want for a cons diagram.
<asarch> D'oh! :-(
<pjb> You can use ditaa too.
william1_ has joined #lisp
<pjb> You can use: (progn (with-open-file (*standard-output* "/tmp/aa.txt" :direction :output :if-does-not-exist :create :if-exists :supersede) (com.informatimago.common-lisp.picture.cons-to-ascii:draw-list *values*)) (uiop:run-program "ditaa /tmp/aa.txt") (uiop:run-program "open /tmp/aa.png"))
saravia has quit [Remote host closed the connection]
william1_ has quit [Ping timeout: 265 seconds]
acolarh has quit [Ping timeout: 240 seconds]
jebes has quit [Quit: ZNC 1.7.5 - https://znc.in]
krisfris has quit [Quit: WeeChat 1.4]
krisfris has joined #lisp
krisfris has quit [Client Quit]
krisfris has joined #lisp
saravia has joined #lisp
smazga has joined #lisp
<asarch> WOW!!! Ditaa is awesome!
acolarh has joined #lisp
<aeth> none of them look as good as the cons diagrams I've drawn myself
<aeth> I guess it's time to NIH a cons diagram program :-p
smazga has quit [Ping timeout: 258 seconds]
gnufr33d0m has joined #lisp
kajo has quit [Remote host closed the connection]
<LdBeth> It seems to be the only comprehensive book on macro assemblers http://www.davidsalomon.name/assem.advertis/AssemAd.html
krisfriss has joined #lisp
krisfriss has quit [Client Quit]
krisfris has quit [Remote host closed the connection]
krisfris has joined #lisp
krisfris has quit [Client Quit]
krisfris has joined #lisp
anewuser has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
Khisanth has quit [Ping timeout: 240 seconds]
EvW has joined #lisp
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 260 seconds]
Lord_of_Life_ is now known as Lord_of_Life
Khisanth has joined #lisp
ahungry has joined #lisp
anewuser has quit [Ping timeout: 265 seconds]
Bike has quit [Quit: Lost terminal]
imherentlybad has joined #lisp
slyrus has joined #lisp
oni-on-ion has quit [Remote host closed the connection]
slyrus_ has quit [Ping timeout: 265 seconds]
oni-on-ion has joined #lisp
EvW has quit [Ping timeout: 248 seconds]
imherentlybad has quit [Ping timeout: 268 seconds]
grabarz_ has joined #lisp
grabarz has quit [Ping timeout: 265 seconds]
atgreen has quit [Remote host closed the connection]
william1_ has joined #lisp
william1_ has quit [Ping timeout: 240 seconds]
dddddd has quit [Remote host closed the connection]
adam4567 has joined #lisp
Qudit314159 has joined #lisp
Qudit271828 has joined #lisp
Qudit271828 has quit [Read error: Connection reset by peer]
smazga has joined #lisp
Qudit271828 has joined #lisp
Qudit271828 has quit [Client Quit]
Qudit314159 has quit [Ping timeout: 258 seconds]
smazga has quit [Ping timeout: 260 seconds]
jbayardo has joined #lisp
gravicappa has joined #lisp
quazimodo has quit [Ping timeout: 260 seconds]
quazimodo has joined #lisp
Josh_2 has quit [Read error: Connection reset by peer]
narimiran has joined #lisp
torbo has quit [Remote host closed the connection]
ggole has joined #lisp
karlosz has quit [Quit: karlosz]
karlosz has joined #lisp
cyraxjoe has joined #lisp
MightyJoe has quit [Ping timeout: 268 seconds]
jbayardo has quit [Quit: Bye!]
rixard has quit [Read error: Connection reset by peer]
<asarch> Those old Lisp machines... what was the name of their file system?
<asarch> Is it still available their file system?
<asarch> (In fact, are those old Lisp operating systems still available?)
<no-defun-allowed> I think there was a front-end processor file system which was probably for booting and a LMFS which was for user data.
<no-defun-allowed> The MIT CADR stuff got released to http://www.unlambda.com/cadr/, and I guess the (relatively) newer Symbolics machine OS is still available if you can find a lispm or can spend $5,000 on the emulator.
<White_Flame> symbolics emulator builds are well out in the open, on github, docker, etc
rixard has joined #lisp
<beach> Good morning everyone!
brown121408 has joined #lisp
brown121407 has quit [Ping timeout: 240 seconds]
<HiRE> is there a reason someone would need a symbolics emulator?
<remexre> hm, I think I might have a memory leak in my interfacing w/ an FFI lib on SBCL; is there an easy way of determining where it's coming from?
<HiRE> call it naive but I figured they would've at least upgraded to something else.
<remexre> (to clarify, I definitely have a memory leak; I'm only assuming it's from FFI)
<beach> HiRE: Who would have upgraded what?
<White_Flame> HiRE: the emulator was around way back, ever since x86 started getting faster than the lisp hardware
<remexre> since (ROOM) shows dynamic space using of abt 1/10 of what htop shows as RSS
<HiRE> beach, someone mentioned a $5000 symbolics emulator
<White_Flame> (well, the emu is written on Alpha specifically)
<HiRE> no-defun-allowed did
<HiRE> White_Flame, I see so it was there to maintain compatibility with old hardware during the transition
<White_Flame> well, they knew they had to change from a hardware company to something else
<White_Flame> since their processors couldn't keep up with general processors
<HiRE> my AI professor routinely talked about symbolics machines but I was surprised when it was mentioned someone might still be using one :P
<White_Flame> oh, I'm sure they're used for novelty and to explore lost computing benefits
<beach> HiRE: The environment is still unprecedented.
<White_Flame> not necessarily for "real work"
<HiRE> beach, how so?
saravia has quit [Remote host closed the connection]
<beach> HiRE: The way the tools are integrated can not be replicated on Unix-like systems because of the process model of those systems.
<HiRE> oh that's interesting. I'm guessing you mean the native lisp interpreter behavior?
gnufr33d0m has quit [Quit: gnufr33d0m]
<beach> There is no interpreter.
<HiRE> :o
<beach> Or maybe there is, but generally speaking, things are compiled, just like with SBCL.
<HiRE> oh wow peeking at the wiki
<beach> HiRE: I mean, the process model of "modern" operating systems requires tools to turn everything into a sequence of bytes in order to communicate with others.
<HiRE> symbolics did a load of good with their systems
<HiRE> beach, that sort of confuses me. How did the symbolics machine differ? I figured it'd still need to translate lisp code down to CPU language
<HiRE> or did it have a lisp CPU?
<beach> It has specific instructions, but that is unimportant.
<HiRE> > Symbolics' initial product, the LM-2, introduced in 1981, was a repackaged version of the MIT CADR Lisp machine design. The operating system and software development environment, over 500,000 lines, was written in Lisp from the microcode up, based on MIT's Lisp Machine Lisp.
<no-defun-allowed> It's not really much of a CPU problem as much as it is an OS problem, but they did have CPUs that had instructions that mapped closer to Lisp functions.
<beach> The important thing is that an application can just hand a pointer to another application.
<asarch> Can you "emulate" a Lisp machine with nowadays Arduino/Raspberry/etc device?
<HiRE> that seems incredibly efficient beach
<beach> HiRE: You will find some arguments here: metamodular.com/closos.pdf
<no-defun-allowed> The OS didn't have seperate memory spaces and had a global garbage collector (I don't think they were first to it, but the lispms had generational collection very early on), so it was possible to pass objects around very easily between threads and functions.
oxum has quit [Remote host closed the connection]
oni-on-ion has quit [Ping timeout: 245 seconds]
<HiRE> oo im gonna have to dig into that
<HiRE> a lisp operating system
<beach> HiRE: There are already two such systems, Movitz and Mezzano, but what I am planning is a bit more sophisticated.
<beach> Three if you count Genera of course.
<HiRE> I'm only aware of mezzano which is honestly impressive.
<HiRE> Very small ASM bootstrap (needed) and the rest is lisp
<HiRE> asm*
gravicappa has quit [Ping timeout: 268 seconds]
<beach> There is no particular reason to write a Common Lisp system any other way.
<HiRE> what impresses me most about mezzano is how fast it appears on the youtube videos
<HiRE> propaganda against lisp would say otherwise.
<HiRE> hopefully the project takes off. Novel operating systems are awesome.
<beach> Common Lisp can be almost as fast as C.
<HiRE> yep! I was impressed with SBCL's performance against gcc
<HiRE> once the garbage collector is tuned right its quick.
<beach> HiRE: Here is one problem: People see the interactive REPL. Then they think "interpreter", and then, of course "interpreter" implies "slow".
<no-defun-allowed> A Lisp operating system could be faster than a Un*x system in several ways, too.
<beach> HiRE: The problem is that "interactive" does not imply "interpreter".
<HiRE> beach, yeah. A similar argument was made a few years back for haskell. Unfortunately the "REPL = Slow" argument is pervasive.
ahungry has quit [Remote host closed the connection]
<beach> HiRE: This implication is incorrectly assumed by ignorant people who do not know much about language implementation.
<asarch> What is the native file system of Mezzano?
william1_ has joined #lisp
<HiRE> beach, right. Whats even more amazing is even talking to graduates in CS the belief is still pervasive.
<beach> Indeed. Even CS professors.
<HiRE> no-defun-allowed, how do you think a lisp operating system could be faster than *nix? I have no dog in the fight I'm just curious.
<loke> HiRE: less memory access fault
<loke> s
<no-defun-allowed> Again, data sharing is faster as it's literally moving a pointer, with no serialisation or memory spaces to deal with.
<beach> HiRE: No context switches.
sauvin has joined #lisp
<HiRE> wow what a mind bend. I'm going to have to dig more into this.
<HiRE> I can't imagine an operating system without context switching
<beach> That would be great!
orivej has quit [Ping timeout: 268 seconds]
<loke> HiRE: You could use an Atari ST right now. No context switcihing (yes, I know, it's a joke)
<no-defun-allowed> A tracing garbage collector is typically much faster than "typical" manual memory management, so some programs which cons a lot can expect to run faster (but avoiding consing is sometimes a good optimisation strategy).
<beach> HiRE: I keep saying this here, but that's because everyone is so convinced that we have to program as if we have access to the entire memory (including the stack) of a physical machine, just like we did 60 years ago.
william1_ has quit [Ping timeout: 268 seconds]
<HiRE> Does the concurrency model change for a lisp OS?
<no-defun-allowed> Then when threads are involved, they can probably be made much more light-weight than in Un*x, so context switches would be much faster when they are necessary.
<beach> HiRE: No processes. Just threads.
<HiRE> oh interesting
<White_Flame> genera still has multithreaded support, so it does context switching in that aspect, but doesn't change any global config like processes
<White_Flame> *like unix processes
<HiRE> page 2 of that pdf beach linked is going into this stuff
<White_Flame> it's also effectively a single-user OS
<HiRE> wow neat
<White_Flame> and of course a single-address space OS
<White_Flame> although other people can network in and get their own REPLs and desktop and such, it's all in the same flat image
grabarz_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<HiRE> damn its too late to change my concentration to operating systems
<HiRE> lol
<HiRE> I guess because I never experienced a lisp machine I never thought of processes as anything different than a nix system
<no-defun-allowed> And to clarify, not requiring context switches between different, well I'll call them "contexts" while I search the book to see if there is a better word, such as between file system and user code or a hardware interrupt handler and a server that uses that hardware, decreases latency too.
<HiRE> it makes sense. I can see why you said a garbage collector can perform better than other memory management forms
<HiRE> the model nix uses seems antiquated in hindsight.
<beach> It was even when it was invented.
<no-defun-allowed> That alone could make datacenter peoples' eyes roll into dollar signs as they do in cartoons.
<beach> It was invented so that the Bell Labs people could use as large a subset as possible of Multics, but on a tiny machine.
<White_Flame> the entire OS is basically made up of the same plain function calls as everything else
<White_Flame> unix is great if your entire model of computing is expressable in individual, independent lines of plain 7-bit text
<beach> Exactly!
<HiRE> beach, right without an MMU they'd need to swap stuff in and out (which is what we learned in CS undergrad)
<White_Flame> and your workload is in the same vein
<no-defun-allowed> https://cacm.acm.org/magazines/2017/4/215032-attack-of-the-killer-microseconds is relevant to that; the authors have figured that fast storage devices won't play nicely with current designs.
<HiRE> this is great. Keep sending me reading material
<HiRE> I ordered a few lisp books off ebay yesterday
<loke> Imagine getting something like core memory, but enough for all storage
<HiRE> drinking the koolaid by the bowlful
<loke> no difference between RAM and disk.
<loke> All of a sudden, transactional memory bocemes a thing.
<no-defun-allowed> To be honest, I would rather have lighter threads than "asynchronous" code, since the latter usually involves special language constructs, CPS-converting in the programmer's head or both.
<loke> All kinds of threads need that, unless you're tlaking about "green" threads (i.e. cooperative)
<loke> How else would you handle cache coherency?
<loke> (sorry, not coopertive. I meant single-core)
* no-defun-allowed probably shouldn't have mentioned it; any threading more complex than lparallel:pmap hurt her head.
<HiRE> multiprocessing is a very interesting topic
<HiRE> good first round interview gutcheck is to explain the difference between concurrency and parallelism
<no-defun-allowed> Typically articles like that try to create solutions that would work in a Un*x environment, maybe because it is less drastic to do so.
oxum has joined #lisp
smazga has joined #lisp
<no-defun-allowed> Oh dear....is concurrency when some tasks can run "simultaneously", splitting up resources over time, and parallelism when they can truly run at the same time?
<White_Flame> concurrent = "at the same time"
<HiRE> yeah
<no-defun-allowed> Phew.
<HiRE> parallelism is truly running at the same time
<HiRE> fwiw I've never had such an interesting question in an interview :P
<White_Flame> huh, yeah I guess the GC terms are a bit different when it comes to "concurrent"
<White_Flame> as a GC thread can run while the rest of the program is
smazga has quit [Ping timeout: 265 seconds]
dale has quit [Quit: My computer has gone to sleep]
<no-defun-allowed> Yeah, a GC is "concurrent" if it can run at the same time as the mutator, but "incremental" if it splits up time between itself and the mutator.
<HiRE> Opinion here but GC is a dirty word just like interpreted. I wish more people would learn that good GCs exist and it's just most of them are bad
<HiRE> lol
vivit has quit [Ping timeout: 258 seconds]
vlatkoB has joined #lisp
<ck_> I mean how can they be safe if they don't even beep while reversing
<White_Flame> now I'm trying and failing what GC would look like in reversible computing
<White_Flame> *to see what
<asarch> How would you implement low-level code in the REPL for the processor? Would it be available in an own package? (cpu:int :address 80 :data my-code)?
<White_Flame> you would generally generate an array of bytes that represent the machine code, and fiddle internal flag bits to get it in the exeuction stream
<White_Flame> lisp implementations have various degrees of intermediate representation, and cpu-specific back ends, like any other compiler
<White_Flame> they just happen in process with all the runtime stuff, too
<asarch> Is it available the code of any Lisp implementation written in Lisp?
<White_Flame> which code? many of them are open source, and the DISASSEMBLE function will show you the compilation output
<White_Flame> (be it bytecode, intermediate form, or raw assembly, varying by implementation)
<White_Flame> in SLIME, with your implementation fully installed with source references, you can use M-. to jump into the implementation Lisp code just as easily as your own code
<no-defun-allowed> https://www.memorymanagement.org/ is a good reference for GC jargon and design.
imherentlybad has joined #lisp
<no-defun-allowed> asarch: Yes, most Common Lisp implementations are written almost entirely in Lisp.
<no-defun-allowed> https://github.com/sbcl/sbcl is (a mirror to) the SBCL source repository, and https://github.com/robert-strandh/SICL is the repository for SICL which might be easier to understand.
<asarch> I was watching a video of the classic Street Fighter II video game and wondering if it was possible that they used Lisp (in some secret way) to develop the game
<White_Flame> why?
william1_ has joined #lisp
<asarch> That game in its time was advanced (music, sprites, the speed when you pressed a button, etc)
<White_Flame> most games back then were very low latency from input to display
<no-defun-allowed> I wouldn't consider that an indicator of development tools.
Qudit314159 has joined #lisp
<asarch> The sequential order you have to send signals to the game through out the keyboard
<White_Flame> (partially due to CRTs)
<asarch> I mean, the development phase of the game, you know
<asarch> When the programmers were entering all the required code so the game could run successfully
<White_Flame> game development (and HPC) is typically very married to the specifics of the hardware, especially in that era
<White_Flame> I guess a lot less so today
<White_Flame> with all the multiplatformism
<no-defun-allowed> There are lot of little tricks intricate knowledge of the hardware involved could give you. One simple example is that a programmer could provide more colours across the screen by counting the vertical lines drawn (which are generated sequentially) and changing palettes at specific counts.
<White_Flame> so I wouldn't expect a very high level language, but rather a system of byte tokens driving states & animations
JohnMS_WORK has joined #lisp
<no-defun-allowed> Assembler macros are fairly popular, so I would expect some use of those to make assembler less annoying while knowing exactly what code is generated.
<no-defun-allowed> Those aren't related to Lisp macros, which is a good reminder that we are here to talk about Lisp.
manualcrank has quit [Quit: WeeChat 1.9.1]
<asarch> And my next question about the game was, "can we nowadays with an Arduino/Raspberry/etc device emulate the conditions those programmers had and make a mini version of the game using Common Lisp instead of Assembly?"
<asarch> That's why I asked about the file system
<no-defun-allowed> A Raspberry Pi can already run many Common Lisp implementations (though, sadly, only Clozure and ECL seem to work on 32-bit with threads).
<HiRE> I don't see a reason you couldn't. I mean wasn't autocad originally written in lisp?
<asarch> Wow! Really?
<HiRE> yeah, it still supports a small subset of lisp for programming the interface/building macros
<no-defun-allowed> An Arduino is right out though, unless you can deal with an interpreter and a very small heap.
<no-defun-allowed> AutoLISP is quite scary.
<asarch> I read in the "The Unix Haters Handbook" book it was made with C
<HiRE> (called AutoLISP iirc)
<White_Flame> Common Lisp is a language with a large set of high level core features, and I would not expect it to run on stuff smaller than a rpi
<asarch> Lisp was not available for MS-DOS, right?
<HiRE> mulisp-90
<White_Flame> I fiddled with a dos-based lisp at some point way back, but I don't know if it was a common lisp
<no-defun-allowed> There was a CLtL1 implementation in DOS if memory serves me right.
<asarch> Back old days when Borland C++ for MS-DOS was the major compiler, I used to start the graphic mode using its BGI device, draw a filled box, enabled the mouse pointer thought a DOS INT and tried to move this box around the screen, however, I never could repaint the area where the box was
<asarch> I could never understand how a mask work (and I hope someday I could through McCLIM)
<no-defun-allowed> Remember a real-mode machine only has access to 640KB memory, and a Raspberry Pi has more than 1GiB memory (unless you have a RPi 1). There are a few magnitudes of difference between them.
<HiRE> wasnt real mode 64k
<HiRE> 640k seems quite large
<HiRE> its been so long since I've had to remember that I forgot
<no-defun-allowed> It has 16 64kB segments, and from memory, 10 of those can be RAM.
<HiRE> lol
<White_Flame> uh, not really :)
<HiRE> oh neat
<HiRE> good to know
<White_Flame> a segment was basically the high 16-bits of a 20-bit pointer (so shift the segment address left 4 bits to get the start of the segment), then the offsets are plain 16-bit byte pointers
<no-defun-allowed> That's probably more correct.
milanj has joined #lisp
<White_Flame> so you could slide around 64KB windows in the 20-bit address space, at a granularity of 16 bytes
<White_Flame> 20 bits = 1MB, but above 640KB was special reserved stuff
<White_Flame> the 640KB thing seemed to be part of the IBM PC hardware design, not a limitation of the x86 chip itself
imherentlybad has quit [Ping timeout: 260 seconds]
<asarch> Is it the same for Arduino/etc?
<no-defun-allowed> The Arduino has a split code/data model which would make native code generation impossible, ignoring the obvious memory constraints.
<asarch> So, after all, it would be a great project, right?
<no-defun-allowed> I would use the adjective "futile" for trying to run Common Lisp on such a small device.
<p_l> no-defun-allowed: any lisp implementation that works on recent OpenBSD without modifying system would be good candidate for arduino :)
<p_l> (recent OpenBSD attempts to force data/code split in software)
<no-defun-allowed> μLisp could work though, and it is almost a subset of Common Lisp if you ignore the single function and value namespace: http://www.ulisp.com/
dmiles has quit [Ping timeout: 268 seconds]
<asarch> SBCL works on OpenBSD
gxt has quit [Ping timeout: 240 seconds]
ebzzry has joined #lisp
<p_l> asarch: without disabling enforced non-writeable executable pages?
<asarch> D'oh! :'-(
another-user has joined #lisp
<asarch> Anyway. Thank you, thank you very much for all the info guys, thank you. Have a nice day! :-)
asarch has quit [Quit: Leaving]
<another-user> hi
scymtym has quit [Ping timeout: 258 seconds]
flamebeard has joined #lisp
<reepca> Is there a way to conditionally indent within a line with the pretty-printer? I'm pretty-printing some unstructured code that alternates between instructions and labels. I need the labels to be on their own line at a certain lesser indentation, and the code to be on its own line (but with multiple instructions on the same line as much as possible). However, labels can come one after the other, so setting the indentation prior to
<reepca> finishing one label doesn't work, since it's necessary to know whether the next line will have another label or instructions.
<another-user> i tried to write bf2 CL benchmark for https://github.com/kostya/benchmarks but it's slower than Racket, how can i speed this up? https://dpaste.org/rsEY
<another-user> they used unsafe-vector-* but otherwise the program looks sameish: https://github.com/kostya/benchmarks/blob/master/brainfuck2/bf.rkt
jprajzne has joined #lisp
orivej has joined #lisp
<reepca> the way I have it currently it all looks okay until labels are adjacent to each other, at which point there are blank lines between them because I use ~& and an indented line isn't "fresh". But if I finish a label without the indentation, how do I indent that line? Indentation only occurs by the pretty-printer after newlines apparently.
<White_Flame> start by declaring most of those functions as inline
<no-defun-allowed> Have you tried to spot the slow parts using a profiler?
<White_Flame> espeically the little 1-liners
<White_Flame> your time is including the read, parse, & run
<White_Flame> it might be that the parse is dominating or something
<p_l> hmm, there were CL implementations that worked within 640kB MS-DOS
<White_Flame> oh, and you're using adjustable & fill-pointer, that makes all of your arefs expensive
<no-defun-allowed> You could change the representation to use structures, which might be faster than accessing a list.
<White_Flame> p_l: yeah, wouldn't surprise me. But I also wouldn't expect a modern compiler
<p_l> depends how we define "modern compiler"
<p_l> some methods used now wouldn't work well, because they are big memory users
<White_Flame> right
<White_Flame> as well as raw compilation speed
<p_l> but that doesn't make a compiler designed for low memory system "old"
<reepca> perhaps the ~T directive would work?
shifty has joined #lisp
rumbler31 has joined #lisp
<reepca> is there a way to get the "current indent level", if that makes sense?
rumbler3_ has quit [Ping timeout: 268 seconds]
<no-defun-allowed> another-user: Are you required to simulate an infinite tape?
<smokeink> reepca: you can check out the "out" macro in ytools, it has some functionality related to indenting if I remember well
heisig has joined #lisp
<jackdaniel> cl:format - introductory course to APL :-)
<no-defun-allowed> Using a fixed tape of 4,096 fixnums drops the execution time to about 6.5 seconds from 15.
<p_l> BTW, regarding CL on microcontrollers, remember that writing compilers is a classic Lisp technique ;)
<no-defun-allowed> You could probably drop the "interpreting" overhead entirely by converting the Brainfuck program to a Lisp program and passing it to COMPILE.
<White_Flame> that's basically what I do in my ivory emulator
decent-username has joined #lisp
<aeth> no-defun-allowed: yes, that's what I do with my Brainfuck... I just compile it down to a lisp program that's like (incf (aref a *position*) 1) etc.
<no-defun-allowed> In a chip8 interpreter I wrote long ago, naive compilation gave me at least a 10x speedup over interpretation.
<aeth> no-defun-allowed: idk how far I go, there are basically a ton of optimizations you can do to produce better output. e.g. instead of incf'ing one at a time, you can see how many +++s there are and incf by that amount
<no-defun-allowed> Inlining as White_Flame suggested first drops it again to 4.3 seconds.
<another-user> White_Flame, no-defun-allowed: thank you for tips! algo must be similar between implementations - other impls use infinite tape
* no-defun-allowed will test compiling next. She really likes making compilers for some reason.
<aeth> another-user: I think generally, the tape that's used in Brainfuck is wrapping tape rather than truly infinite. So some large circular buffer as an array.
william1_ has quit [Ping timeout: 268 seconds]
frgo has joined #lisp
<White_Flame> if you manually manage the tape growth, instead of using vector-push-extend, then your arefs will be simple inline accessors
<White_Flame> base + offset
<aeth> Yes, but if you have a fixed length tape and you compile the Brainfuck as a function, then there are no length checks at all because the tape doesn't grow. Even if it can change from program to program, the AREF specific to that program will know the length (assuming it's all in one function or there are declarations)
grabarz has joined #lisp
adam4567 has quit [Ping timeout: 260 seconds]
lemoinem has quit [Ping timeout: 258 seconds]
lemoinem has joined #lisp
<no-defun-allowed> another-user: A compiler takes it to 1.8 seconds. Howzat?
<another-user> no-defun-allowed: wow, that's really cool!
<no-defun-allowed> I would also read the code directly from the stream, a la the Lisp reader.
<another-user> no-defun-allowed: i tried https://dpaste.org/tTEB but it didn't win much time(~1s)
<no-defun-allowed> I'll show you my code after I write that kind of reader. The other two big wins are inlining everything and using a simple-array to get AREF really fast.
<another-user> no-defun-allowed: awesome, thank you!
scymtym has joined #lisp
orivej has quit [Ping timeout: 258 seconds]
<no-defun-allowed> You can add the unsafe declaration to the generated code in compile-bf-program, which takes it to 1.35 seconds, but admittedly I don't think it's usually worth doing so in real programs.
gravicappa has joined #lisp
<another-user> no-defun-allowed: thank you!
<another-user> it looks great
<no-defun-allowed> Surprisingly, it's shorter than the interpreter.
<another-user> yeah :)
<no-defun-allowed> Is there such a thing as a regular expression that operates on lists, and is there an implementation of that?
<aeth> no-defun-allowed: what do you want to do?
<jackdaniel> no-defun-allowed: somethink like optima?
<jackdaniel> something*
* jackdaniel hurries to get his coffee
<no-defun-allowed> aeth: I would want to merge all the tape-inc instructions together, preferably by writing a rule like (:many (tape-inc ?x)) => `(tape-inc ,(reduce #'+ ?x))
<no-defun-allowed> That might be too much wishful thinking, and I could probably write it somehow without it.
william1_ has joined #lisp
<aeth> no-defun-allowed: well, you could also do actual regular expressions and instead of parsing #\+ as (tape-inc whatever) you'd parse "++++" as (tape-inc whatever 4)
<no-defun-allowed> True.
<aeth> obviously, there can be infinite +'s so regexes won't be sufficient
rwcom8 has joined #lisp
<aeth> you'd still reduce the problem to a rare case of e.g. sets of 10's
<beach> no-defun-allowed: Check out the works by Jim Newton. That's exactly what they are doing.
<no-defun-allowed> I suppose I will.
smazga has joined #lisp
rwcom has quit [Ping timeout: 268 seconds]
rwcom8 is now known as rwcom
<no-defun-allowed> aeth: I modified the reader to merge multiple + characters together into one operation, and that takes the execution time to 0.8 seconds.
<smokeink> in sbcl loading a .lisp file that has (declaim (optimize (safety 3) (debug 3) (speed 0) (space 0))) , should actually change the policy? when I do (describe-compiler-policy), it's not changed
<beach> smokeink: No, DECLAIM is per file.
<smokeink> if I run sbcl with (declaim (optimize (safety 3) (debug 3) (speed 0) (space 0))) in sbclrc , it works, the policy is changed
<beach> Yes, when you do it at the REPL, it changes globally.
<beach> If you want it to change when you load the file, use PROCLAIM instead.
<no-defun-allowed> So, another-user, using a compiler such as that one creates code that runs 30x faster than the C++ interpreter in that repository.
<jackdaniel> beach: to be precise, declaim is guaranteed to take effect for a file at compile time in which it is a top-level form, it is not specified whether effect lingers after the file is compiled
smazga has quit [Ping timeout: 268 seconds]
<White_Flame> no-defun-allowed: and the execution time includes the compilation time?
<beach> jackdaniel: I see. Let me go read the Common Lisp HyperSpec.
<aeth> no-defun-allowed: There are some other idioms you can detect other than just a bunch of +s and -s in a row. The more you can detect, the better it will run. I mean, for someone who tries to "structure" Brainfuck rather than code golf.
varjag has joined #lisp
<White_Flame> ah, I see it does include it
<jackdaniel> (that said, our statement is true at least for ECL!)
<jackdaniel> your*
<no-defun-allowed> White_Flame: Yes.
<smokeink> I thought declaim is a macro equivalent to proclaim
<another-user> no-defun-allowed: that's really impressive!
<jackdaniel> smokeink: you've linked LispWorks documentation
<White_Flame> declaiming non-optimization stuff liek types does stick past the file context, iirc
<jackdaniel> that is how *they* implement it
<jackdaniel> and it is not non-conforming
<smokeink> well, that certainly confuses people who search on google
<jackdaniel> White_Flame: it *may* stick, it doesn't necessarily stick (you can't portably rely on that) - use proclaim in eval-when to assure that they stick
<beach> White_Flame: The standard allows for the startup environment and the compilation environment to be separate.
<beach> White_Flame: They typically aren't though, for historical reasons.
<beach> White_Flame: The are (or will be) in SICL though.
<beach> clhs 3.2.1
<smokeink> (eval-when (:compile-toplevel :execute :load-toplevel)
<smokeink> (proclaim '(optimize (safety 3) (debug 3) (speed 0) (space 0))))
<smokeink> I'm loading this, in sbcl, it has no effect
<smokeink> loading the file containing that eval-when
<no-defun-allowed> Folding the other characters like that yields only a .02 second improvement, but hopefully that is more than what was expected for the benchmark.
<smokeink> (describe-compiler-policy) still shows other numbers
<beach> smokeink: So?
<no-defun-allowed> The readme does say "It interepter all bf instructions, one by one, without any squash or other hacks", but it's not *my* fault those other languages can't let you use the compiler at runtime.
<beach> smokeink: It seems that in SBCL, this particular aspect is separate in the run-time environment and the compilation environment.
<smokeink> beach: if I do sbcl --no-userinit --no-sysinit --load ~/.sbclrc (.sbclrc contains that eval-when) it has no effect. but if i just do sbcl , it has effect
jonatack has quit [Ping timeout: 252 seconds]
<beach> smokeink: I see.
<smokeink> I need it to have effect when I use --load , because I do some stuff before loading it
<smokeink> I do this --eval '(require :sb-aclrepl)' , before --load
<smokeink> and in .sbclrc I have some configuration for :sb-aclrepl (which is really useful)
quazimodo has quit [Ping timeout: 260 seconds]
Qudit314159 has quit [Quit: Quit]
quazimodo has joined #lisp
hhdave has joined #lisp
<smokeink> SBCL 2.0.0.73-7d05b4c https://paste.ofcode.org/uc2PrgJASAaWgkS5FsUBGA during macroexpansion of (SB-PCL::%DEFMETHOD-EXPANDER INSPECT-OBJECT-USING-STATE ...)) failed AVER: (= SB-C::COMPONENT-TLF-NUM SB-C::TLF-NUM) This is probably a bug in SBCL itself.
<smokeink> beach: which sbcl version are you using?
<phoe> smokeink: throw the failed AVER at #sbcl
quazimodo has quit [Ping timeout: 268 seconds]
<smokeink> throwed it
<smokeink> threw it *
<beach> smokeink: I may have the same "problem" as you do.
<smokeink> ok;
<smokeink> fine then; let's fix sbcl
<beach> I think it is conforming behavior. So "fix" may not be the right way to express it.
<smokeink> ok, how about the second issue
<smokeink> can you run that code ?
<jackdaniel> smokeink: did you try to load the dependencies and compile the file after that without the quickload forms?
<smokeink> no, let me try
<jackdaniel> I can imagine that first macros are expanded with old definitions, then quickload is executed and some internal references become bonkers
<jackdaniel> so further execution fails miserably
<jackdaniel> I suppose bonkers is not very strict technical term :)
<smokeink> just quickloadining clouseau triggers that bug
<smokeink> I'll delete the cache, and try again
davepdotorg has joined #lisp
<edgar-rft> bonkers should be added to the CLHS glossary
<smokeink> jackdaniel: quickloading first, works, but the generic methods don't get called, the mean and standard deviation doesn't show up in clouseau
<smokeink> *don't show up
ralt has joined #lisp
jonatack has joined #lisp
<smokeink> I just wanna play a little with clouseau, what's a sbcl version that works well with it ?
<smokeink> a version that can run the above snippet and shows the standard deviation and mean, would be enough for me today
<jackdaniel> scymtym may have some ideas as he is the author of clouseau
<scymtym> i believe this is an SBCL bug but i haven't been able to reproduce it so far
oxum has quit [Read error: Connection reset by peer]
oxum has joined #lisp
oxum has quit [Remote host closed the connection]
<smokeink> yes , I believe so too
<smokeink> scymtym have you tried the latest mcclim from github?
<smokeink> the quicklisp one is older. try with the newest mcclim and the newest sbcl
<ralt> how can I look at the description of a quicklisp package without downloading it?
<smokeink> \
<smokeink> \
<scymtym> smokeink: i didn't change those methods recently and i also load Clouseau from McCLIM master daily. i think this is about SBCL, not Clouseau
imherentlybad has joined #lisp
<smokeink> scymtym: it certainly is about sbcl
<ralt> (ql:system-apropos "...") will list the relevant packages, but no way that I can see to check the descriptions.
<jackdaniel> ralt: I don't think that quicklisp stores that information
<imherentlybad> is there a away to add a directory where quicklisp scans for projects, much like quicklisp/local-projects/ ?
<ralt> ok :(
<jackdaniel> you need to download the asd file in order to see the description option
<ralt> google it is then...
<ralt> anyway, looks like there's no good git library
<jackdaniel> smokeink: proposed solution in this so thread involves downloading the system
<ralt> thanks
imherentlybad has quit [Changing host]
imherentlybad has joined #lisp
<Shinmera> imherentlybad: ql:*local-project-directories*
<imherentlybad> I assume I have to add that to my .sbclrc?
<Shinmera> that's one way.
tiwEllien has joined #lisp
<imherentlybad> would I add to that list with cons or...?
<Shinmera> clhs push
<smokeink> push
<imherentlybad> thanks!
imherentlybad has quit [Quit: WeeChat 2.6]
smokeink has quit [Remote host closed the connection]
oxum has joined #lisp
smokeink has joined #lisp
smokeink has quit [Remote host closed the connection]
Nilby has joined #lisp
smazga has joined #lisp
tumdum has quit [Ping timeout: 260 seconds]
amerlyq has joined #lisp
<flip214> what's the short form for (APPLY #'fn1 (M-V-L (fn2)))? Isn't there some MULTIPLE-VALUE-
<flip214> thing that passes multiple return values as multiple arguments?
<reepca> flip214: multiple-value-call?
smazga has quit [Ping timeout: 265 seconds]
<reepca> (multiple-value-call #'fn1 (fn2))
m00natic has joined #lisp
tumdum has joined #lisp
tumdum has quit [Changing host]
tumdum has joined #lisp
dmiles has joined #lisp
<flip214> reepca: ah, thanks, misread the description.
oxum has quit [Remote host closed the connection]
rtra has joined #lisp
seok has joined #lisp
jonatack has quit [Ping timeout: 240 seconds]
jonatack has joined #lisp
another-user has quit [Quit: WeeChat 2.7]
brown121408 has quit [Read error: Connection reset by peer]
brown121407 has joined #lisp
oxum has joined #lisp
dddddd has joined #lisp
rtra has quit [Quit: WeeChat 2.3]
rtra has joined #lisp
ebrasca has joined #lisp
shangul has joined #lisp
HiRE has quit [Quit: Later]
rtra has quit [Ping timeout: 268 seconds]
HiRE has joined #lisp
oxum has quit [Read error: Connection reset by peer]
oxum has joined #lisp
raghavgururajan has quit [Remote host closed the connection]
oxum_ has joined #lisp
orivej has joined #lisp
oxum has quit [Ping timeout: 260 seconds]
oxum has joined #lisp
jayspeer has joined #lisp
rtra has joined #lisp
oxum_ has quit [Ping timeout: 265 seconds]
mingus has joined #lisp
cartwright has quit [Ping timeout: 240 seconds]
shangul has quit [Ping timeout: 268 seconds]
cartwright has joined #lisp
william11 has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
rtra has quit [Ping timeout: 268 seconds]
Necktwi has quit [Ping timeout: 258 seconds]
montaropdf has joined #lisp
brown121407 has quit [Ping timeout: 265 seconds]
<pjb> minion: memo for asarch: genera and instructions can be found at: https://cliki.net/VLM_on_Linux
<minion> Remembered. I'll tell asarch when he/she/it next speaks.
notzmv has quit [Ping timeout: 240 seconds]
smazga has joined #lisp
seok has quit [Remote host closed the connection]
oxum has quit [Remote host closed the connection]
brown121407 has joined #lisp
smazga has quit [Ping timeout: 268 seconds]
oxum has joined #lisp
oxum has quit [Remote host closed the connection]
oxum has joined #lisp
ebrasca has quit [Ping timeout: 258 seconds]
william11 has quit [Ping timeout: 265 seconds]
milanj has joined #lisp
Cymew has quit [Remote host closed the connection]
ebrasca has joined #lisp
Cymew has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
oxum has quit [Remote host closed the connection]
oxum has joined #lisp
oxum has quit [Remote host closed the connection]
decent-username has quit [Ping timeout: 252 seconds]
oxum has joined #lisp
rwcom8 has joined #lisp
DGASAU has quit [Remote host closed the connection]
rwcom has quit [Ping timeout: 268 seconds]
rwcom8 is now known as rwcom
papachan has joined #lisp
nickerpro has joined #lisp
<lieven> minion: memo for asarch: for recent X versions, you need to patch genera. See https://archives.loomcom.com/genera/genera-install.html#org783aa06
<minion> Remembered. I'll tell asarch when he/she/it next speaks.
chimneys has joined #lisp
<chimneys> hey
<chimneys> I have to know how lisp is more powerful, say if I write a program to open 1000 emails in python it works, so programs can do things that cannot be done manually , similarly give an example in which lisp can generate programs 1000's of them which simply can't be done using python manual programming.
lucasb has joined #lisp
<Shinmera> no
_jrjsmrtn has joined #lisp
<lieven> python is turing complete and so can trivially do anything Common Lisp can, if necessary by implementing Common Lisp in python. See Greenspun's rule and the blub paradox.
<chimneys> no lisp can do something more much easily hence metaprogramming
__jrjsmrtn__ has quit [Ping timeout: 265 seconds]
DGASAU has joined #lisp
<ralt> python can't trigger an infinite loop in compilation phase
<beach> chimneys: As lieven says, Common Lisp is no more powerful than any other Turing-complete language, so there is nothing that can be done in Common Lisp that can't also be done in any other Turing complete language. It might be more convenient to do certain things in Common Lisp than in (say) Python, but those things can still be done in other languages.
<beach> ralt: Shocking!
<ralt> Ten Things You'll Never Do In Python!
<ralt> #1: smooth backwards compatible upgrade
<chimneys> then why learn lisp
<beach> chimneys: You must have missed the "convenient" part of my answer.
<beach> chimneys: If you think that the language doesn't influence your productivity, you should probably not waste your time learning Common Lisp.
<chimneys> for example you could say I can make million email-ids using mouse and keyboard, yes but it will take forever. so is there any metaprogram that generates programs that can't be generated but manually one by one
oxum has quit [Ping timeout: 268 seconds]
<chimneys> so it takes forever, it's turing complete but impossibel to implement
<Shinmera> I feel like this discussion is also a waste of time
* beach agrees with Shinmera.
<beach> chimneys: It sounds like you need to read up a bit.
<lieven> ralt: python function annotations can run arbitrary code at function definition time so close enough I guess
<chimneys> Shinmera: you never participated
<Shinmera> It's still a waste of time
<Shinmera> for everyone reading it included
<chimneys> come on dude
<beach> chimneys: Shinmera is (rightly so) concerned about other #lisp participants wasting valuable time from their respective projects.
terpri has quit [Ping timeout: 260 seconds]
<jayspeer> heh, and you guys wonder why so few people use lisp :D get that stick out of your a**
kslt1 has joined #lisp
<nickerpro> i came to lisp because i thought i could do cool thing in it, they say ti's turing complete like python so nothing special
<beach> I think I have a fairly good idea as to why relatively few people use Common Lisp. And it is nothing that could be fixed by participating in this kind of discussion.
<flip214> chimneys: IMO one of the major advantages is that CL allows for a much bigger bandwidth of abstractions. You can easily build very high-level abstractions (classes, and macros for eg. control flow), but also influence the generated machine code.
<nickerpro> but i wanted to do cool shit
<beach> nickerpro: Did you also miss the "convenient" part of my utterance?
<nickerpro> no
<beach> That's the "special" part.
<nickerpro> you mean that's the "cool" part
<nickerpro> which part exactly are you talking
<lieven> sed is turing complete. I do not advocate encoding many computations in sed.
<Shinmera> jayspeer: We get this same shit every week. It doesn't help, and it's mind numbingly boring noise.
<beach> No, "special". You said "so nothing special". And I am saying there is something special, but it is not Turning completeness.
<flip214> chimneys: as an example, macros in lisp allow you to build an abstraction for defining classes and methods on them
<jayspeer> Shinmera: maybe bot can automatically message user with relevant links? It would both take it off us and provide useful information
<pjb> There's such a thing as the Turing tar pit…
<pjb> chimneys: have also a look at http://cliki.net/Performance
DGASAU has quit [Read error: Connection reset by peer]
<beach> jayspeer: I think an answer from a real person is more valuable, and why try very hard to give good answers to good questions. Besides, the kind of people who have bizarre questions probably wouldn't read the document that the link refers to.
DGASAU has joined #lisp
<beach> s/why/we/
<beach> *sigh*
<pjb> Responses from a real person are good only if the telepathic link can be established, so that the response given may lead the asker to the real answer to the actual question he had.
Bike has joined #lisp
<beach> Shinmera: Interesting observation that there is more stuff like this during the weekend.
<Shinmera> A mini september, perhaps
<phoe> Lisp doesn't generate programs on its own
<phoe> if anything, Lisp helps the programmer write Lisp quicker and more efficiently
<chimneys> so lisp has a better programmer performance than python?
<jackdaniel> bad programmers may write more confusing code in CL than in python ,)
<phoe> when it comes to the languages themselves, I'd say so, yes - the interactivity is really fun when you get to play with the language
<jackdaniel> good programmers will write good code in both, although cl could be much of an aid to do so
<beach> chimneys: There are almost no scientific studies that compare the productivity of programming languages, and the ones I know of do not feature Python. So it boils down to personal preference.
<phoe> I love myself an interactive debugger&inspector combo that's always present and allows you to inspect the stack, check on the values bound to the variables there
<phoe> plus the REPL that's a part of developing in the language - you never really go "$ python my-script.py" like I did when writing Python, you run Lisp once and have it running in the background all the time while you compile a function after a function into the Lisp image, likely playing with it in the REPL after each compilation to check if it does what you hope it does
<pjb> and the few studies used really small population samples.
<beach> That too.
<beach> It's too bad though. Some national or union-wide agency should invest in such a study.
<beach> It could save a lot of money.
<phoe> it's less of tweaking a Massive File Full Of Code™ and more of playing with individual forms that you then send into Lisp - more like a conversation with the language that runs in the background than starting from a clean slate every single time when you run a program written in Python or C++ or another non-interactive language from scratch
keja has quit [Ping timeout: 248 seconds]
<phoe> emacs's slime package is pretty fun that way.
X-Scale` has joined #lisp
<phoe> chimneys: anyway, that's my opinion on the matter
<phoe> a lot of that also boils to personal proficiency and preference, so is highly variable
xkapastel has joined #lisp
<phoe> but after trying both python and lisp I like the lisp environment more due to the interactivity and the amount of introspection that's available in there
X-Scale has quit [Ping timeout: 240 seconds]
X-Scale` is now known as X-Scale
<jayspeer> phoe: that was very well said
<phoe> jayspeer: at the same time I understand some people who are tired of this sort of discussion, mostly due to the "fame" that Lisp has on the Internet
<phoe> "OMG it's t3h language that makes the impossible possible and the possible trivial, it's the MAGIC SECRET SAUCE™©® known only to some W I Z A R D S"
<beach> phoe: What "fame" is that. I believe #lisp is known to be a very friendly channel.
<pjb> Once upon a time, I made a #clnoobs channel so that newbies could ask their newbie questions there without bothering the serious and advanced #lisp programmers…
<phoe> beach: I don't mean friendliness/unfriendliness
<beach> Ah, so what then?
<phoe> I mean marketing Lisp as something that it is not
rwcom5 has joined #lisp
<beach> Oh? Someone does that?
<phoe> I got that sort of impression from e.g. reading multiple Graham writings, and I directly blame him for that sort of popularity. He didn't write it like that literally, of course, but he certainly attributes too much to to Lisp itself.
rwcom has quit [Ping timeout: 260 seconds]
rwcom5 is now known as rwcom
EvW1 has joined #lisp
<phoe> Using a particular language won't instantly cause you to become a better programmer. Sure, working with Lisp for some time will have an effect on your overall code quality, but there's no "enlightenment" that is mentioned somewhere, there's no magic in here that will suddenly pour down into your fingers and all over your keyboard.
shifty has quit [Ping timeout: 265 seconds]
<pjb> There's enlightenment! It can be achieved reading sicp (or wathching the sicp lectures).
<jackdaniel> it is not said that said effect will be positive
LiamH has joined #lisp
<pjb> That doesn't exclude other ways.
FreeBirdLjj has joined #lisp
<phoe> jackdaniel: I'd imply it's positive, since e.g. in Lisp it's easy to try and express the same idea in multiple ways due to the fact Lisp is multi-paradigm. At least in my case, I got a few "ah-ha!" moments when I realized that the same problem can be approached from a different way and the language doesn't stand in my way when I want to go functional, or object-oriented, or declarative, or even linear or via a
<phoe> state machine.
<jackdaniel> so it is easier to build pile of trash
<phoe> that too - that's why I really enjoy the #lisp part of Lisp
<phoe> where I can consult other people and actually figure out if the idea I'm trying at the moment is worthwhile or trashy.
<jackdaniel> my remark was about overall effect, not enjoyment
<phoe> anyway, about the magic - Lisp has multiple advantages over the years, so many that other languages have copied many features from it that are now considered "industry standard". I think that's one thing to keep in mind when glancing at the language
<phoe> jackdaniel: you're correct
<phoe> s/enjoy the #lisp part of Lisp/notice that consulting with the folk of #lisp has a direct positive effect on the quality of my code/
FreeBirdLjj has quit [Ping timeout: 268 seconds]
<phoe> but then, code review is important in *any* programming language you're writing - so nothing that is really particular about Lisp in this case
<phoe> chimneys: hope this answers the original question somewhat well
hlavaty has joined #lisp
<phoe> as well as provides some context about the "aw shit, here we go again" reactions that happen on this channel - and why I blame Graham for that sort of stuff (;
<dlowe> pjb: you made the #clnoobs channel, eh? That's not what ChanServ says.
<dlowe> or the topic creator
<Nilby> I think it's reasonable to say those that ask questions without basic understanding: "Don't use Lisp. Thank you. Please go away." For me, and likely those of you who are rebellious enough to write a lot of Lisp code, such an answer would only serve to increase my determination to learn it. But people who ask about how to cons, cdr, etc. should be treated with great kindness.
<phoe> nowadays it's #clschool
<dlowe> yes, I made that one too.
<beach> Nilby: I am convinced that you are not alone in reacting that way.
<dlowe> I am being surprised that pjb is taking credit for my creation
<pjb> dlowe: I might misremember.
<pjb> dlowe: perhaps it was discussed here, and I said somebody should make a #clnoobs channel, and somebody did?
<phoe> it must have been years ago
<phoe> I remember #clnoobs being a thing years ago, at least
<phoe> since I remember learning stuff there
milanj has quit [Quit: This computer has gone to sleep]
stepnem_ has joined #lisp
stepnem has quit [Ping timeout: 268 seconds]
<pjb> phoe: yes, sorry, I definitely misremembered it.
<pjb> You clearly created it from your own initiative.
<phoe> no no, wasn't me
<pjb> Yes, sorry, it was dlowe.
pfdietz has joined #lisp
<luis> Anyone have recommendations on which base64 enconding library to use?
bitmapper has joined #lisp
<dlowe> Sheesh. Started May 2012. Doesn't seem like that long.
<phoe> luis: popularity-wise, 49 systems depend on cl-base64, 6 systems depend on s-base64
<dlowe> luis: doesn't ironclad have one built-in?
<phoe> dlowe: doesn't seem so
<dlowe> ah, no, it has a hex string converter
rwcom5 has joined #lisp
rwcom has quit [Ping timeout: 265 seconds]
rwcom5 is now known as rwcom
EvW1 has quit [Ping timeout: 245 seconds]
<luis> phoe: thanks
SlashLife has quit [Ping timeout: 260 seconds]
<phoe> luis: (ql:system-apropos "base64") followed by a series of (length (ql:who-depends-on ...))
<phoe> this doesn't include transitive dependencies but in this case I guess the inaccuracy is bearable
<jdz> luis: I also have some updates to cl-base64 here: https://github.com/jdz/cl-base64
JohnMS_WORK has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
FreeBirdLjj has joined #lisp
jonatack has quit [Ping timeout: 260 seconds]
<luis> jdz: thanks. Have you tried submitting them to Kevin?
<luis> seems like s-base64 can't encode character streams. It might be a reason to use cl-base64 instead.
<jdz> luis: I've sent an email to Kevin, but it might have gone into a spam bin or somesuch.
mingus` has joined #lisp
mingus has quit [Ping timeout: 265 seconds]
<luis> jdz: cl-base64 has a stream-to-base64-{stream,string} symbols but no defined functions. Am I missing something?
smazga has joined #lisp
<ralt> is it possible to (save-lisp-and-not-die)?
<ralt> (i.e. dump an image but keep running)
<luis> ralt: in SBCL?
<ralt> yes
<Bike> i think sbcl recommends you fork a process so that can die.
<luis> ralt: you can fork() first if you're on Unix
<ralt> I guess that works
<ralt> thanks
<luis> ralt: slime/swank/sbcl.lisp has some code that does that.
<ralt> was trying to think of a way to debug a production image without bothering production environment
<ralt> dumping an image and restoring that image elsewhere would provide that
<ralt> luis: let me check
<Shinmera> you can't slad while threads are active though
<jdz> luis: I think they're in the exports list, but I've never seen them defined anywhere.
milanj has joined #lisp
<luis> jdz: I think I'll use s-base64 then. :)
<ralt> Shinmera: ah, right, there's this annoying limitation
<jdz> luis: It might not be hard to add that...
<jdz> Oh, right, I remember: I only need to decode stuff, and I've added stream versions for that.
smazga has quit [Ping timeout: 258 seconds]
<luis> jdz: you might want to publish your fork on Quicklisp, maybe? You can call it jdz-base64 or amR6LWJhc2U2NA== or something :)
<phoe> or convince Xach to switch over to your fork
<phoe> (if possible and viable)
<luis> Yeah, that might be nicer.
<pjb> ralt: alternatively, you can use clisp who knows how to save images without killing itself.
<ralt> does it know how to dump an image with threads?
<pjb> I don't remember. It can re-open the open files, if they still exist when you reboot the image.
<pjb> (but not sockets of course).
<ralt> nice
random-nick has joined #lisp
oni-on-ion has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
Lord_of_Life_ has joined #lisp
ralt has quit [Remote host closed the connection]
rvirding has quit [Remote host closed the connection]
chewbranca has quit [Remote host closed the connection]
tazjin has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
Lord_of_Life has quit [Ping timeout: 268 seconds]
Lord_of_Life_ is now known as Lord_of_Life
oni-on-ion has quit [Ping timeout: 245 seconds]
madage has quit [Ping timeout: 240 seconds]
stepnem_ has quit [Ping timeout: 258 seconds]
rvirding has joined #lisp
stepnem has joined #lisp
chewbranca has joined #lisp
tazjin has joined #lisp
ralt has joined #lisp
FreeBirdLjj has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
gareppa has joined #lisp
adolby has quit [Ping timeout: 265 seconds]
nickerpro has quit [Ping timeout: 260 seconds]
adolby has joined #lisp
heisig has quit [Quit: Leaving]
chimneys has quit [Ping timeout: 265 seconds]
gnufr33d0m has joined #lisp
edgar-rft has quit [Quit: Leaving]
gareppa has quit [Remote host closed the connection]
gxt has joined #lisp
shangul has joined #lisp
ralt has quit [Remote host closed the connection]
tazjin has quit [Remote host closed the connection]
rvirding has quit [Remote host closed the connection]
chewbranca has quit [Remote host closed the connection]
shangul has quit [Read error: Connection reset by peer]
mangul has joined #lisp
manualcrank has joined #lisp
rvirding has joined #lisp
tazjin has joined #lisp
chewbranca has joined #lisp
ralt has joined #lisp
jprajzne has quit [Quit: Leaving.]
ebzzry has quit [Ping timeout: 260 seconds]
dale_ has joined #lisp
dale_ is now known as dale
secsaba has joined #lisp
montaropdf has left #lisp ["WeeChat 2.4"]
smazga has joined #lisp
gigetoo has quit [Ping timeout: 260 seconds]
jmercouris has joined #lisp
<jmercouris> optima vs trivia? thoughts on pattern matching libraries in general?
<luis> jmercouris: I've only played with optima and it's pretty nice.
<jmercouris> luis: I see, thank you for the input
<jmercouris> we are using trivia in our project, and I really don't like the 'trivial-x' libraries or the "_" as OTHERWISE
mingus`` has joined #lisp
vaporatorius has quit [Ping timeout: 265 seconds]
rtra has joined #lisp
karlosz has quit [Quit: karlosz]
mingus` has quit [Ping timeout: 260 seconds]
gxt has quit [Remote host closed the connection]
jayspeer has left #lisp ["ERC (IRC client for Emacs 26.3)"]
<galdor> does it use "_" as a general way to ignore an element in a pattern ?
<galdor> using it just as alias of OTHERWISE is strange indeed
<galdor> (more precisely _ should match any element and be ignored)
<jmercouris> galdor: A variable-pattern matches any value and binds the value to the variable. "_" and "otherwise" are special variable-patterns (a.k.a wildcard-pattern) which match any value but don't bind.
<jmercouris> it seems they are therefore the same, it's I guess like T at the end of a COND
secsaba has quit [Quit: Leaving]
jonatack has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
<galdor> when you say you do not like it, what's the problem ?
<galdor> I personnally do not like OTHERWISE in general, looks too much like "we did not have a better solution so let's introduce a special symbol"
anewuser has joined #lisp
flamebeard has quit []
asdf_asdf_asdf has joined #lisp
rtra has quit [Ping timeout: 268 seconds]
<jmercouris> It does look a lot like that
<jmercouris> however "_" looks even worse than otherwise
Josh_2 has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
gigetoo has joined #lisp
<galdor> another possibility would be ?<name> or ? alone
<remexre> is there a standard macro for "set this value in this place if the place's current value is nil"?
vaporatorius has joined #lisp
vaporatorius has quit [Changing host]
vaporatorius has joined #lisp
karlosz has joined #lisp
karlosz has quit [Client Quit]
<Bike> i don't think so, remexre.
<remexre> ok
anewuser has quit [Read error: Connection reset by peer]
<jmercouris> remexre: I don't believe so either, I would use a WHEN or UNLESS
<remexre> yeah, I've just got a bunch of these in a row
<remexre> I guess I could actually probably turn this into a loop w/ mop, hm
<Bike> i mean you could write the macro yourself.
<remexre> yeah, that too
<Bike> (defmacro supercalifragilisticexpialidocious (place value) `(unless ,place (setf ,place ,value)))
<Bike> or setf expansion crap if you wanna be conscientious about it
<pjb> Bike: wrong: it evaluates place twice. use get-setf-expansion.
vaporatorius has quit [Read error: Connection reset by peer]
<pjb> Or I guess what you said could be interpreted as such.
<Bike> it sure could!
<remexre> alright, thanks!
madmonkey has joined #lisp
stepnem_ has joined #lisp
madage has joined #lisp
stepnem has quit [Ping timeout: 260 seconds]
oxum has joined #lisp
davepdotorg has quit [Remote host closed the connection]
oxum has quit [Ping timeout: 258 seconds]
<jackdaniel> uh oh, finally a macro with long name I couldn't possibly remember name of
hlavaty has quit [Remote host closed the connection]
<Xach> (deffish humuhumunukunukuapuaa () ...)
<Bike> at first i spelled it incorrectly, but spell check saved me
<phoe> (define-german-numeral siebentausendzweihundertvierundfünfzig 7254)
EvW has joined #lisp
<eeeeeta> oh god
<eeeeeta> phoe: you could probably write a macro to programmatically generate the numeral
<phoe> eeeeeta: I could probably write a macro to programmatically generate 80% of German speech
zmv has joined #lisp
<eeeeeta> true
<phoe> with the remaining 20% being the necessary special forms
jmercouris has quit [Remote host closed the connection]
hhdave has quit [Quit: hhdave]
<asdf_asdf_asdf> Hi. How pass argument to (loop for i in '(1 2 3) #'func :arg arg...?
kajo has joined #lisp
<Xach> asdf_asdf_asdf: i would like to help but can't understand the question.
frgo has quit [Ping timeout: 268 seconds]
<asdf_asdf_asdf> Xach, I want skip for example second argument while iterating over list.
<Xach> asdf_asdf_asdf: every second element or only the first second element?
<asdf_asdf_asdf> '(1 2 3) collecting i => (1 2 3) '(1 2 3) by #'skip-arg-1 collecting i => (1 3).
<Xach> asdf_asdf_asdf: what is the result of '(1 2 3 4 5)?
<asdf_asdf_asdf> (1 3 4 5)
<beach> asdf_asdf_asdf: (loop for element in '(1 2 3) for i from 0 unless (= i 1) collect element)
<HiRE> I suppose this is an on topic question - what does `collecting xyz` do?
<HiRE> It seems to repeat whatever is after the collecting part in the list you're looping over
<beach> It takes the argument and sticks it in a list, which is then returned at the end of the loop.
<HiRE> ah ok
<Xach> asdf_asdf_asdf: (loop for i in '(1 2 3 4 5) by (first-then #'cddr #'cdr) collect i) is one option
<beach> Xach: Really?
<beach> I think the BY argument is only evaluated once.
Domaldel has joined #lisp
Domaldel has left #lisp [#lisp]
<Xach> beach: implementation of the function generator first-then is a good exercise.
<Xach> one possibility: (defun first-then (&rest funs) (let ((fun (pop funs))) (lambda (obj) (prog1 (funcall fun obj) (setf fun (or (pop funs) fun))))))
ggole has quit [Quit: Leaving]
<beach> How does that help if the argument to BY is evaluated only at the beginning of the loop?
<Xach> beach: help with what?
<beach> (first-then #'cddr #'cdr) is evaluated only once, at the beginning of the loop, so how can this implementation of it solve the problem that asdf_asdf_asdf has?
<Bike> the returned closure has the effect of cddr the first time and cdr subsequent times. there is only one closure but it maintains its own state, so the loop doesn't need to evaluate the function more than once. makes sense to me.
<Xach> beach: by implementing the desired semantics
<beach> Ah, I see.
<Xach> i think it is some kind of monad or combinator or maybe both???
<beach> Clever!
<Xach> i am not clever enough to know the name
<eeeeeta> Xach: and, thankfully, Lisp is a language where you can get away with not knowing that sort of thing? :p
<Xach> eeeeeta: it will be on the final exam though :(
<eeeeeta> Xach: aha, for what
* eeeeeta suggests Xach turn in the source code of quicklisp instead and leave it at that :D
<Xach> oh god, that would earn me a very poor grade - the fact that people find it useful counts for nothing
varjag has joined #lisp
<eeeeeta> fair enough
<Xach> there are zero monads (but maybe there are, i don't know what qualifies)
<jackdaniel> just throw at them first-then function and pray for the best ,-)
ebrasca has quit [Remote host closed the connection]
<eeeeeta> well, this is the difference between CS and software engineering I suppose
<jackdaniel> I've head it is some kind of monad or combinator, or maybe both.
<zmv> the famed monadinator
<HiRE> ah yes, monads are quite simple. They are just monoids in the category of endofunctors
<HiRE> very simple >_<
m00natic has quit [Remote host closed the connection]
<asdf_asdf_asdf> Thank You Beach, Xach. I want Xach's example. How pop n item from list using keyword "by"?
<asdf_asdf_asdf> (pop (nth 3 lst))
* ck_ puts "by implementing the desired semantics" into the book of phrases for a rainy day
<asdf_asdf_asdf> (loop for i in '(1 2 3 4 5) by (nth 3 :default-list) collect i) => '(1 2 3 5)
terpri has joined #lisp
Achylles has joined #lisp
amerlyq has quit [Quit: amerlyq]
<asdf_asdf_asdf> phoe, thanks. I want example above, but with (nth x y), not always second item.
<phoe> asdf_asdf_asdf: that implementation of CDNTH and (SETF CDNTH) in the above answer seems correct though
ebrasca has joined #lisp
montaropdf has joined #lisp
ebrasca has quit [Remote host closed the connection]
<phoe> don't use POPNTH from up there since it suffers from double evaluation.
ebrasca has joined #lisp
gareppa has joined #lisp
vivit has joined #lisp
gareppa has quit [Remote host closed the connection]
brown121407 has quit [Ping timeout: 260 seconds]
brown121407 has joined #lisp
asarch has joined #lisp
montaropdf has quit [Quit: WeeChat 2.4]
jmercouris has joined #lisp
william11 has joined #lisp
jmercouris has quit [Remote host closed the connection]
brown121408 has joined #lisp
brown121407 has quit [Read error: Connection reset by peer]
ebrasca has quit [Remote host closed the connection]
william11 has quit [Client Quit]
william1 has joined #lisp
ebrasca has joined #lisp
mangul has quit [Ping timeout: 265 seconds]
<pjb> asdf_asdf_asdf: (cons (first list) (rest (rest list)))
<pjb> asdf_asdf_asdf: no need for a loop!
<pjb> asdf_asdf_asdf: (nconc (subseq list 0 n) (subseq list (1+ n)))
<asdf_asdf_asdf> pjb, working. Thank You.
<pjb> beach: I can't even find where in clhs the semantics of for in by and for on by is defined. It's present in 3 loop clauses; by is described for 6.1.2.1.1 The for-as-arithmetic subclause, but doesn't say if the form is evaluated once or each time (but the example are as if evaluated once).
<pfdietz> "Each expression is evaluated only once and must evaluate to a number. "
<pfdietz> (for-as-arithmetic)
SlashLife has joined #lisp
<Xach> asdf_asdf_asdf: you could use (first-then #'cdr #'cdr #'cdr #'cddr #'cddr)! but that is ugly.
<_death> hmm, sbcl won't do on (loop for i from #C(1 0) by #C(1 1) repeat 10 collect i)
<_death> gotta (loop for i = #C(1 0) then (+ i #C(1 1)) repeat 10 collect i)
<Xach> oops, final #'cddr should be #'cdr
asarch has quit [Quit: Leaving]
<asdf_asdf_asdf> Thanks.
<Xach> asdf_asdf_asdf: what kind of problem prompts your questions?
<asdf_asdf_asdf> I do solve task from hackerrank.com.
<Xach> oh
brown121407 has joined #lisp
jello_pudding has quit [Ping timeout: 260 seconds]
sauvin has quit [Read error: Connection reset by peer]
<pjb> pfdietz: ah, good. Thanks.
brown121408 has quit [Ping timeout: 265 seconds]
<no-defun-allowed> Am I too late to suggest a base64 library?
trittweiler_ has joined #lisp
<Xach> we have moved on to radix64
<no-defun-allowed> cl-base64 has a helper function to convert a base64 string into a string, but I believe it's broken for non-ASCII characters.
<no-defun-allowed> So, to use either library with text, you will also need to use the Babel library to convert an array of octets to a string and back.
milanj has quit [Quit: This computer has gone to sleep]
vivit has quit [Ping timeout: 272 seconds]
karlosz has joined #lisp
g0d_shatter has joined #lisp
oni-on-ion has joined #lisp
test1600 has joined #lisp
<galdor> iirc base64 operates on octets, not on characters, so having a base64 encoding functions taking a string as parameter is surprising
X-Scale` has joined #lisp
<Xach> galdor: i can understand it as a convenience to skip a step (as long as it works properly)
<galdor> of course the library could automatically decode the string, but it requires an encoding parameter (and probably a system such as babel)
<galdor> yep, but people are rarely aware of the encoding aspect, they are used to the "everything is utf-8" approach of many "modern" languages
efm has quit [Remote host closed the connection]
efm has joined #lisp
<galdor> I was thinking today it's too bad there is no standard mechanism to configure external formats
g0d_shatter has quit [Quit: Leaving]
<galdor> you always end up relying on babel because it's impossible to use :external-format on e.g. OPEN in a portable way
X-Scale has quit [Ping timeout: 268 seconds]
X-Scale` is now known as X-Scale
rtra has joined #lisp
asdf_asdf_asdf has left #lisp [#lisp]
<_death> latin-1 ftw
vlatkoB has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
ralt has quit [Quit: Connection closed for inactivity]
efm has quit [Read error: Connection reset by peer]
rtra has quit [Ping timeout: 265 seconds]
zmv has quit [Remote host closed the connection]
davisr has joined #lisp
brown121407 has quit [Read error: Connection reset by peer]
brown121407 has joined #lisp
ebrasca has quit [Read error: Connection reset by peer]
ebrasca has joined #lisp
<karlosz> anyone know a good reference for load-time-value and eval-when outside of the spec? there are some trickier examples that i've wondered if someone already compiled a list of ambiguous situations
kmeow has joined #lisp
efm has joined #lisp
<Bike> if there is one i haven't seen it. the most substantial writing i remember on eval-when is fare's blog post saying it sucks. what tricks are you looking at?
kmeow has quit [Remote host closed the connection]
kmeow has joined #lisp
milanj has joined #lisp
ebrasca has quit [Remote host closed the connection]
rtra has joined #lisp
<karlosz> specifically i'm looking at what order toplevel clauses have to be evaluated with respect to load-time-value. i guess to give context i just added block compilation to sbcl and wondering whether im running afoul of certain ansi specified load-time vs compile time distinctions
<pfdietz> I don't think it's specified.
<pjb> Indeed load-time-value expressions can be evaluated at any moment during load time.
<Bike> in clhs load-time-value: "It is guaranteed that the evaluation of form will take place only once when the file is loaded, but the order of evaluation with respect to the evaluation of top level forms in the file is implementation-dependent."
<karlosz> for example, on CMUCL block-compiling a struct (say, foo) and defun f () (load-time-value (make-foo)) gives a load time error in cmucl
<karlosz> saying that make-foo is not defined
<pfdietz> " the order of evaluation with respect to the evaluation of top level forms in the file is implementation-dependent."
<pjb> Now of course, if you write: (defparameter *foo* (load-time-value (+ 1 1)) You can assume that (+ 1 1) is evaluated before the load-time effects of defparameter *foo* can occur!
<pfdietz> clhs load-time-value
<karlosz> and i'm pretty sure it's illegal but not sure what language in the spec specifically forbids that
<karlosz> because the spec says undefined
test1600 has quit [Quit: Leaving]
<Bike> i think cmucl's behavior is allowed.
<pfdietz> Yes
<Bike> i think it would also be allowed for it to work.
<karlosz> of course, that's only when block-compiling
Jesin has joined #lisp
<no-defun-allowed> "Undefined" means an implementation can do whatever.
ljavorsk has joined #lisp
scymtym has quit [Ping timeout: 248 seconds]
<pjb> Perhaps adding an (eval-when (:load-toplevel) around your defun foo) would help?
<Bike> i don't see how that would change anything.
<karlosz> i mean i'm asking from the perspective of an implementor what will run me afoul of the spec i guess
<Bike> the spec doesn't define an order, so you can't run afoul of it in this aspect. go where your heart calls
<karlosz> especially because CMUCL was the only other implementation that abused compile time name resolution as aggressively as it did
asdf_asdf_asdf has joined #lisp
clothespin has joined #lisp
ljavorsk has quit [Ping timeout: 268 seconds]
gravicappa has quit [Ping timeout: 260 seconds]
narimiran has quit [Ping timeout: 260 seconds]
whiteline has quit [Remote host closed the connection]
whiteline has joined #lisp
whiteline has quit [Remote host closed the connection]
whiteline has joined #lisp
kslt1 has quit [Ping timeout: 260 seconds]
vaporatorius has joined #lisp
vaporatorius has quit [Changing host]
vaporatorius has joined #lisp
whiteline has quit [Remote host closed the connection]
rtra has quit [Ping timeout: 258 seconds]
whiteline has joined #lisp
kajo has quit [Ping timeout: 245 seconds]
whiteline has quit [Remote host closed the connection]
rtra has joined #lisp
whiteline has joined #lisp
jebes has joined #lisp
whiteline has quit [Read error: Connection reset by peer]
frgo has joined #lisp
rtra has quit [Ping timeout: 260 seconds]
frgo has quit [Read error: Connection reset by peer]
frgo has joined #lisp
frgo has quit [Remote host closed the connection]
frgo has joined #lisp
kajo has joined #lisp
kmeow has quit [Remote host closed the connection]
kmeow has joined #lisp
efm has quit [Ping timeout: 260 seconds]
whiteline has joined #lisp
vms14 has joined #lisp
<vms14> I'm writing an abomination :D
william1_ has quit [Ping timeout: 265 seconds]
bitmapper has quit [Remote host closed the connection]
<HiRE> hmm, upon defining a class (defclass blankaccount () (customer-name balance)) and loading it into SLIME
<pjb> vms14: right. I would have used OO. All those functions are just methods of the same generic function generate taking arguments php-node
<pjb> .
<HiRE> trying to use (make-instance 'bank-account) gives class not found
<pjb> of course.
<pjb> (eq 'bank-account 'blankaccount) #| --> nil |#
<Xach> HiRE: you have to use the same name
<HiRE> oh I mistyped
<HiRE> its bankaccount in my code
<HiRE> I just didnt copypaste
<Xach> HiRE: show the code.
<pjb> Use emacs. It can auto-complete.
<HiRE> (defclass bankaccount ()
<HiRE> (customer-name
<HiRE> balance))
<HiRE> duh
<HiRE> wrong name
<HiRE> again
Odin- has quit [Ping timeout: 268 seconds]
<HiRE> rubberduck debuggin is very powerful
<Xach> i am a rubber chicken
<pjb> You can use termbin.
<HiRE> I use emacs + SLIME. Its very nice
<pjb> #!/bin/bash \n nc termbin.com 9999 | tr -d '\000'
<pjb>
<pjb> to paste…
<Xach> i like it very much
<HiRE> oh never knew about termbin
<HiRE> that is a good idea
<pjb> HiRE: Yes, but did you activate auto-complete-mode?
<vms14> pjb: OOP for doing what kind of thing?
<vms14> also did you tried sly?
<vms14> try*
<HiRE> pjb, if I press tab it gives suggestions so I guess so?
<pjb> When I type (make-instsance 'ba it completes alone, I just type TAB to finish it without typo.
<pjb> HiRE: ok.
<HiRE> oh it pops open a new buffer
<pjb> vms14: your paste.
<HiRE> it would be nice for it to autocomplete by itself
<pjb> vms14: see for example: linc.
<vms14> pjb: yes, my paste, but I have no idea how to translate that to CLOS
<vms14> they're just functions writing dirty php code
<pjb> So of course, you need to define classes for the syntactic elements: https://github.com/informatimago/lisp/blob/master/languages/linc/c-syntax.lisp#L173
<pjb> And write a parser or macros to convert a sexp into a tree of instances of those classes.
<vms14> hmm, I see
<pjb> Then you just (generate php-program) <- the root of the syntactic tree.
<vms14> so the entire AST is a bunch of CLOS instances?
<pjb> (generate (parse '(defun foo (x y) (+ y x)))) -> <php?>number foo(x:number,y:number){return y+x;}</php> or whatever the php syntax is.
<pjb> Yes.
<vms14> I'll think about this, thanks for the hint
<vms14> will be an abomination anyway :D
madmonkey has quit [Remote host closed the connection]
cosimone has joined #lisp
<pjb> It will be cool. Add it to https://cliki.net/s-exp%20syntax when done.
<pjb> (other examples there).
<vms14> It seems much better way than how I'm doing, but I have to think now, I have no idea about where to start
<pjb> You could start from the php grammar, if you want to implement a complete syntax. (This can be useful if you want to be able to parse php back to sexps).
efm has joined #lisp
<pjb> Or you can just choose a sane subset. For example, for C or C++, it would be crazy to use the actual language grammar. Instead, you can define the grammar for a subset language as is used by human programers.
<pjb> +m
<pjb> Similarly, the sexps syntax you will define can be able to express only a subset of the whole syntax (the subset you would use as a human programmer, or you need to generate), it doesn't necessarily have to cover the whole syntax.
<pjb> So you go sexp -> ast-objects -> generate-php-source.
<pjb> You can also implement a php-parser and generate the sexp from it: php-source -> ast-objects -> sexp.
<vms14> no xD
<vms14> just lisp-to-php
<pjb> So you can parse php, get a sane sexp, edit or transform it automatically, and generate back the php.
<pjb> Ok.
<vms14> would be nice, but also more complicated to write both, and I don't know if I'll need that
<vms14> I'm going to write some kind of blog framework, or blog generator
<pjb> ok. So sexp->ast-oo->php is enough.
efm has quit [Ping timeout: 240 seconds]
efm_ has joined #lisp
<vms14> I'd use hunchentoot, but I'm aiming to free hostings and alike, so php or perl cgi
<vms14> and I was tempted to choose perl over php, maybe I'll rethink that
<pjb> See the sexpc files for examples of sexpified-C sources.
<vms14> I'm looking ad c-amplify
<vms14> at*
Codaraxis has joined #lisp
<vms14> btw the AWK Lisp homepage is dead
gxt has joined #lisp
efm_ has quit [Quit: Konversation terminated!]
bitmapper has joined #lisp
slyrus_ has joined #lisp
slyrus has quit [Ping timeout: 265 seconds]
<vms14> meh, I need theory for writing ASTs
random-nick has quit [Ping timeout: 240 seconds]
bitmapper has quit [Remote host closed the connection]
<pjb> vms14: it's easy. In the case of lisp sexps, eg. if: (if <test> <then> [<else>]) -> (defclass lisp-if (lisp-expression) ((<test> :initarg :test :reader if-test) (<then> :initarg :then :reader if-then) (<else> :initarg :else :initform nil :reader if-else)))
<White_Flame> I probably wouldn't even bother with classes for that
<pjb> vms14: then: (defmacro my-sexpified-language:if (<test> <then> &optional <else>) (make-instance 'lisp-if :test <test> :then <then> :else <else>))
Bike has quit [Quit: Bike]
<pjb> Having classes has the big advantage that you can write generic functions dispatching on them, to do all kind of stuff on the programs thus represented. You can generate them in different languages, compile them to lisp or native code, pretty print them, transform them, etc.
<White_Flame> I find it often yields smaller, more manageable code to do the same thing with plain data structures and manual functions
<White_Flame> and you can handle weird edge cases easier, too
<White_Flame> since it doesn't have to follow a homogenous OO model
<pjb> I master the OOP well enough…
<White_Flame> I've done OO for long enough that I consider myself post-OO
<White_Flame> but yeah, it's still a tool in the toolbox. Just don't go all Java "OO = Object Obsessed" ;)
<vms14> I don't see many advantadges using CLOS instead of just functions transpiling directly to what I want
<vms14> but I have no idea about compilers, so I cannot appreciate it
<pjb> vms14: the advantage is instead of having a procedural style, you can have a data driven style, where you have an internal representation of the program you want to generate. So you can manipulate it.
<vms14> and something is telling me it's a more correct way than the shit I was doing
shifty has joined #lisp
<pjb> You don't have to hard-code the php output you want.
<vms14> xD my idea was to hard-code the stuff I needed, but I know it will be a mess
<pjb> Instead of hardcoding stuff such as: (php-if (php-equal (php-var "a") (php-integer 0)) (php-function-call (php-function "foo") (php-var "b") (php-integer 42))), you can have some data |# (let ((php-code '(if (= a 0) (foo b 42)))) #| and process it: |# (generate (parse-php-sexp php-code)))
bitmapper has joined #lisp
varjag has quit [Ping timeout: 268 seconds]
<vms14> I had this (defun php-if (test &rest statements) (format nil "if(~a){~{~a~}}" test statements))
<vms14> xD
<pjb> So, this being lisp, you could consider the sexp as the ast.
<pjb> You could generate the php directly from: (if (= a 0) (foo b 42))
<vms14> I'll think about writing an AST, because I'd like to learn more about compilers and metaprogramming
<vms14> but I'm not able to do that stuff now, and I'd like to have some working stuff
<vms14> even if it makes people cry
<pjb> (case (first sexp) ((if) (format …)) ((= /= + - * / …) (format …)) (else #|mustbe funcall|# (format …)))
scymtym has joined #lisp
<pjb> Or, you could (defgeneric (op &rest args) (:method ((op (eql if)) &optional then else) …) …)
<pjb> + generate
<pjb> and call (apply (function generate) sexp).
<vms14> the heredocs are because I wanted "" for the html and variable interpolation, but they make the code even uglier
<vms14> still maybe I should use perl
LiamH has quit [Quit: Leaving.]
william1 has quit [Ping timeout: 240 seconds]
vaporatorius has quit [Ping timeout: 240 seconds]
madagest has joined #lisp
<HiRE> could someone provide me a few links of github repos or whatever with really well written modern CL code?
<HiRE> in particular SBCL code, but im not picky.
<HiRE> I'd like to get a feel of what good CL looks like.
<mason> HiRE: There are books worth reading. Here, for example: http://www.gigamonkeys.com/book/
<HiRE> currently on chapter 17
<Xach> HiRE: cl-ppcre is a nice read
<HiRE> thanks Xach. Reason I ask is I'd like to take on a project to write a simple DNS server in CL for my own use.
<HiRE> I wanted to write it well though instead of just hamfisting it
madage has quit [Ping timeout: 240 seconds]
<HiRE> thank you mason
<Xach> HiRE: there is no shame in hamfisting if it works!
<Xach> i have a DNS client i can share but it is slightly hammy
Kundry_Wag has joined #lisp
<Xach> it can parse and assemble packets so maybe that would be helpful
<HiRE> Xach, I'd love to take a look. One thing I was beginning to look at was even how to get started reading/writing packets in CL
<mason> FFI! =cough=
<Xach> I don't like FFI, I would rather do it in CL.
<Xach> so i did!
<HiRE> mason, that was my initial idea but I'd like to keep it pure CL if possible. I really like CL and FFI seems like a last ditch effort for me.
<mason> HiRE: I was being sarcastic. You've got the right idea.
<HiRE> thank you pjb
<HiRE> awesome, I'll take a look. What are these *.asd files I see all over
<HiRE> ?
Bike has joined #lisp
<Xach> *.asd files are input to a program that can compile and load multiple files in the right order
<Xach> and more
papachan has quit [Quit: Leaving]
<HiRE> oh I see so they are files to help the compiler out?
rtra has joined #lisp
<Xach> ssssort of
<Xach> for typical lisp development you start with a running intractive system and then teach it new things to do
<Xach> *.asd files are part of how you load those things to teach it
wxie has joined #lisp
<HiRE> oh I see. So instead of having to load a buffer complete in say SLIME you use *.asd to help suggest it stuff?
<HiRE> For example if you are working in one file but need another file?
<pjb> HiRE: they are like makefiles.
<HiRE> ah pjb I see
<Xach> HiRE: no. more like someone says "i have a library that does X" and you get that library, the system can use the *.asd file to load that library
<HiRE> oh got it
<HiRE> makes distribution easier I see
<Xach> and if that library needs a library that does Y, the *.asd files arranges to load that first too
<Xach> and so on, until it's done
<Xach> if something is missing, it will signal an error
<Xach> quicklisp is a program that handles that error and downloads libraries to make them available to load
<HiRE> Ah I see. Is quicklisp a special implementation or more like a package manager?
<pjb> Well, getting dependencies is something my makefiles do too…
kmeow has quit [Quit: Leaving]
<Xach> quicklisp is a program that can be loaded into any implementation
<Xach> it downloads libraries automatically for you.
<HiRE> oh sweet, yeah found the website. Seems like a package manager similar to NPM or something
<HiRE> cool
<HiRE> I was wondering how you managed dependencies in lisp cleanly
notzmv has joined #lisp
<Xach> i don't know about clean, but it works ok for certain styles of work
rtra has quit [Ping timeout: 260 seconds]
<Xach> i wrote that dns client because i had a web service that fetched images from the web, and i wanted things arranged so that things wouldn't get hung up by DNS or TCP timeouts
<Xach> so i also had a bit that managed the IO timeouts with linux epoll
<vms14> so HiRE you're a new lisper?
<HiRE> vms14, yep
Codaraxis has quit [Read error: Connection reset by peer]
<vms14> nice :D, welcome to lisp
<HiRE> thank you :D
<vms14> I'm a newbie too, but I love it
<HiRE> Xach, I want to write one to help get around the DNS hijacking going on by my ISP lol.
<HiRE> Im tired of their really poor resolution times and "enhanced content injection"
<HiRE> through the miracle of monopoly I dont have any other options :/
<Xach> HiRE: interesting. where would you run your server? how would you use it?
<Xach> maybe these things drift offtopic...we can discuss it via private messages if you're inclined.
<HiRE> sure if you want to take it PMs I'd be happy to
<Xach> i used to work at an ISP, and i know a little about networking, so it is interesting to me.
wxie has quit [Ping timeout: 258 seconds]
aeth has quit [Read error: Connection reset by peer]
aeth has joined #lisp
rtra has joined #lisp
jtecca has joined #lisp