oselyqualitylesp has quit [Ping timeout: 272 seconds]
psf has joined #commonlisp
poselyqualityles has joined #commonlisp
<mfiano>
Could someone give me a hand with the condition system. I admit I don't use the dynamic parts of it like restarts, and also catch/throw may be more applicable for this usable and I have only used them exactly once before.
<mfiano>
?
<mfiano>
I iterate over a list of symbols, and call a generic function using that symbol as a specializer. If any of the users method bodies calls a particular function (let's call it STOP), I want to immediately terminate the iteration and continue execution beyond that point.
<mfiano>
What would be a nice and idiomatic way to do this, that is what should be in the body of STOP, and what should be near the iteration (DOLIST in this case)?
<Nilby>
mfiano: you could just catch and throw, but using restarts is nicer for debugging. e.g.: (with-simple-restart (stop "Stop doing the thing.") (loop for i from 1 do (print i) (if (zerop (mod i 11)) (invoke-restart 'stop)) (sleep .2)))
<mfiano>
I am not sure how to abstract that away from the user into a STOP function. The user only gets to define methods on these GFs that are called in sequence, with a possibility to call the #'stop function.
<mfiano>
s/these GFs/this GF/
<Nilby>
I guess just call invoke-restart in a stop function or after in wrapping gf
kiki_lamb has joined #commonlisp
<mfiano>
Ok, thank you. Let me play around and see how this works.
<Nilby>
The important thing is that they have the right 'stop symbol.
<mfiano>
One more thing
<mfiano>
This is in a tight loop. While performance isn't too important, which would likely be more eficient, this way or catch/throw?
tyson2 has joined #commonlisp
<Nilby>
most of the weight of the restart is proabbly in the catch/throw context establishment, although of course the restart way is a little more consing. best to just test it.
kiki_lamb has quit [Ping timeout: 240 seconds]
<mfiano>
Ok thanks. I'm deeloping a naive (to start) multi-recipient event bus system that dequeues events and dolists over all recipients, with a recipient having the ability to "consume" and event to stop further propagation.
<mfiano>
developing*
<Nilby>
sounds fun :)
<mfiano>
All events of the queue are dequeued, and all handlers are invoked...all inside a 60hz gui main loop, with handlers having arbitrary logic so yeah...performance is great so far without this possibility to consume, but I also don't have too many/very expensive handlers
<mfiano>
Order is very important though, and also when events are dispatched, so I can't run the queue in a separate thread, nor run the method calls in parallel
<mfiano>
I am always over-optimizing in my mind, before I stop myself doing it in code :)
<Nilby>
in my simple test the overhead of restart vs catch/throw was about 4%
<mfiano>
What does the restart way buy me, if it is not an interactive restart (I don't even need a string)?
<guest74>
hurry up and finish that so I can use it, mkay.
<Nilby>
mfiano: maybe not much if you're just using it as a non-local exit. much of the value of restarts comes from using with conditions
<mfiano>
My understanding of catch/throw is a dynamic scoped variety of block and return/return-from. Is that correct?
<Bike>
pretty much.
<Bike>
plus the reference is evaluated so you can do (throw (get-tag) ...) type stuff
<mfiano>
Yeah, I noticed that and its pretty nice
<Nilby>
if you're making a complex system I bet you'll eventually want to take the tiny performace hit for the debugging niceness
<mfiano>
I started reading CLCS a couple weeks ago and got bored with how it progresses. I should go back to it.
<mfiano>
Alright, well it's late here so I am done coding for the day, but I'll play around with these ideas to see what works the best (I value debuggability over performance in most cases, especially with all the live coding support DSLs I added).
<mfiano>
I think I'll go read some more CLCS before bed. Thank you for the discussion.
yauhsien has joined #commonlisp
<Nilby>
lisp books put me to sleep, so they make good betime stories
<mfiano>
:)
<Nilby>
i did skim CLCS for the racy story bits
yauhsien has quit [Ping timeout: 272 seconds]
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 272 seconds]
molson has quit [Remote host closed the connection]
molson has joined #commonlisp
karlosz has joined #commonlisp
molson has quit [Remote host closed the connection]
molson has joined #commonlisp
<contrapunctus>
adlai: I'm pretty sure facial expressions are almost universally recognized. At any rate, I don't type in #commonlisp too often. I'd still say that the solution providing more convenience to you (across all users, channels, and networks) is for you to configure your client to either display emojis, hide them, or replace them with their standardized textual descriptions. (e.g. "FACEPALM")
<edgar-rft>
/join #clemojis
<Nilby>
speach on earth is trending toward mostly emojis, so better to be prepared. lisp already looks like emojis (- _ -)
<beach>
Good morning everyone!
mrcom has quit [Quit: This computer has gone to sleep]
pranavats has left #commonlisp [Error from remote client]
sjl has joined #commonlisp
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 246 seconds]
semz_ has joined #commonlisp
semz has quit [Ping timeout: 240 seconds]
slowButPresent has quit [Quit: leaving]
oselyqualitylesp has joined #commonlisp
poselyqualityles has quit [Ping timeout: 256 seconds]
triffid has quit [Remote host closed the connection]
tyson2 has quit [Remote host closed the connection]
triffid has joined #commonlisp
kiki_lamb has joined #commonlisp
gko has quit [*.net *.split]
lawt has quit [*.net *.split]
dmgk has quit [*.net *.split]
_death has quit [*.net *.split]
Patternmaster has quit [*.net *.split]
BytesAndCoffee has quit [*.net *.split]
Patternmaster has joined #commonlisp
gko has joined #commonlisp
dmgk has joined #commonlisp
lawt has joined #commonlisp
adeht has joined #commonlisp
BytesAndCoffee has joined #commonlisp
kiki_lamb has quit [Ping timeout: 248 seconds]
xaltsc has quit [*.net *.split]
sirufer has quit [*.net *.split]
hisacro has quit [*.net *.split]
alanz has quit [*.net *.split]
infra_red[m] has quit [*.net *.split]
megeve has quit [*.net *.split]
yitzi has quit [*.net *.split]
Mrtn[m] has quit [*.net *.split]
bldr has quit [*.net *.split]
[smlckz] has quit [*.net *.split]
mht-wtf has quit [*.net *.split]
resttime has quit [*.net *.split]
bldr has joined #commonlisp
megeve has joined #commonlisp
alanz has joined #commonlisp
sirufer has joined #commonlisp
hisacro has joined #commonlisp
mht-wtf has joined #commonlisp
xaltsc has joined #commonlisp
resttime has joined #commonlisp
Mrtn[m] has joined #commonlisp
yitzi has joined #commonlisp
infra_red[m] has joined #commonlisp
z4kz has joined #commonlisp
kg7ski has joined #commonlisp
Bike has quit [Quit: Connection closed]
karrq has joined #commonlisp
z4kz has quit [Quit: Client closed]
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 250 seconds]
ttree has quit [Ping timeout: 276 seconds]
rotateq has quit [Ping timeout: 260 seconds]
oselyqualitylesp has quit [Quit: Using Circe, the loveliest of all IRC clients]
pvalenta has joined #commonlisp
spiaggia has joined #commonlisp
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 260 seconds]
<jackdaniel>
the fun part is that it becomes immedietely obvious that this code is incorrect if you feed it to the pretty printer
<jackdaniel>
stuff like (and '(< 0) …)
akoana has quit [Quit: leaving]
aartaka has joined #commonlisp
<jackdaniel>
Kind Sir, I want to introduce to you our lord and savior - the pretty printer. Sincerely, JD ,)
kiki_lamb has joined #commonlisp
<guest74>
I don't get what's wrong with that?
<jackdaniel>
well, (LAMBDA (!) (IF (AND '(< 0) (< ! 2)) 1 NIL)) looks certainly intimidating until you realize that it is (if (< ! 2) 1 nil)
<guest74>
yes, but what makes it incorrect?
<jackdaniel>
especially when all is put in a single line with with funcall and (not (null …)) called on another constant expression that is always true
<jackdaniel>
semantically it is nonsense
<jackdaniel>
you could dub it "obfuscatable programming language", but that with pretty printer would also fail short
<guest74>
Well yes, they all look like stupid nonsense. I just don't see anything incorrect.
kiki_lamb has quit [Ping timeout: 260 seconds]
<jackdaniel>
let me put it this way, if I were reviewing a code that has (and <constant-expression> …) I'd immedietely demand changes because that's a bogus code (even if it compiles)
<jackdaniel>
there are many types of "incorrect"; "compiles" is a very low bar of correctness
<guest74>
it looks like a website where the person tried very hard and did very bad.
ttree has joined #commonlisp
Cymew has joined #commonlisp
Cymew has quit [Client Quit]
Cymew has joined #commonlisp
rotateq has joined #commonlisp
pve has joined #commonlisp
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 248 seconds]
spiaggia has quit [Ping timeout: 248 seconds]
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 246 seconds]
pranavats has joined #commonlisp
ttree has quit [Ping timeout: 276 seconds]
shka has joined #commonlisp
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 276 seconds]
analogsalad has joined #commonlisp
jmdaemon has quit [Ping timeout: 272 seconds]
OlCe has joined #commonlisp
kiki_lamb has joined #commonlisp
epolanski has joined #commonlisp
kiki_lamb has quit [Ping timeout: 276 seconds]
Inline has quit [Quit: Leaving]
rgherdt has quit [Read error: Connection reset by peer]
rgherdt has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
anticomputer has joined #commonlisp
karlosz has joined #commonlisp
leeb has quit [Ping timeout: 272 seconds]
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 260 seconds]
karlosz has quit [Quit: karlosz]
yagamisato has quit [Ping timeout: 272 seconds]
yagamisato has joined #commonlisp
yagamisato has joined #commonlisp
yagamisato has quit [Changing host]
karlosz has joined #commonlisp
karlosz has quit [Client Quit]
rgherdt has quit [Read error: Connection reset by peer]
karrq has quit [Ping timeout: 250 seconds]
rgherdt has joined #commonlisp
pjb has joined #commonlisp
kiki_lamb has joined #commonlisp
kiki_lamb has quit [Ping timeout: 248 seconds]
Inline has joined #commonlisp
kiki_lamb has joined #commonlisp
semz_ is now known as semz
MajorBiscuit has joined #commonlisp
kiki_lamb has quit [Ping timeout: 256 seconds]
Inline has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 240 seconds]
kiki_lamb has joined #commonlisp
attila_lendvai has joined #commonlisp
Inline has joined #commonlisp
kiki_lamb has quit [Ping timeout: 240 seconds]
Sankalp has joined #commonlisp
kiki_lamb has joined #commonlisp
Inline has quit [Quit: Leaving]
sarahM has joined #commonlisp
<sarahM>
what are some successful projects in common lisp?
<sarahM>
I am struggling as emacs is very old and ancient
<Demosthenex>
it is? wow. i'm surprised.
<jackdaniel>
sarahM: afaik there are also common lisp integrations with other editors like vim or vscode (I don't know details since I don't use these)
<jackdaniel>
re successful projects in common lisp, from the top of my head - franz inc, ravenpack and gramamrly build their products with common lisp
<sarahM>
oh vscode let me try that
<jackdaniel>
grammarly*
<patrix>
don’t forget google flight search
<sarahM>
everyone at my school uses grammarlY!
<jackdaniel>
I've read about it but I don't know whether they still use it or not, either way they are not bragging about common lisp as they could ,)
<Demosthenex>
nice! a remote keylogger at every learning station. congrats!
<patrix>
as most do, it’s their secret weapon after alll haah
<rotateq>
I thought the "modern" IDEs just converge more and more to the idea and what Emacs offered from the start.
<patrix>
rotateq:this is acrtually what got me to check out emacs
<jackdaniel>
rotateq: do you mean: single threaded, confusing ui and windows that jump with every popping buffer?
<Sankalp>
emacs is kinda like vscode, but it's even programmable without using plugins
<rotateq>
patrix: nice
<patrix>
years ago after using Sublime Text a while, then tried out vscode ,and I saw a common theme and thought “they’re all trying to be like emacs, why not go to the source?
<rotateq>
jackdaniel: yes :D
<Demosthenex>
isn't that rather like the maxim that all languages are just poorly implemented CL?
<Demosthenex>
so now all IDEs are just poorly implemented emacs?
<patrix>
then I thought “while I’m at it, let’s give up on Haskell and check out Common Lisp"
<rotateq>
Demosthenex: yeah, Greenspun's 10th
<patrix>
Demosthenex: that checks out
<jackdaniel>
Demosthenex: "... including common lisp"
<Demosthenex>
haha
<jackdaniel>
n.b there is even LSP server for CL, but I don't know how well it works neither
<rotateq>
I looked recently what they write at Grammarly about their tech stack, but I bet the heavy core part is still CL.
<rotateq>
"Thougts all others say are impossible to do"
<sarahM>
thank you!
<sarahM>
I can use this for my assignment :D
<rotateq>
sarahM: You're welcome. We have lunch now, see you later.
<Demosthenex>
rotateq: what's for lunch?
<edgar-rft>
who's "we"? - your majesty is having lunch? :-)
<sarahM>
why is lisp good for artificial intelligence?
<edgar-rft>
because human intelligence sucks
<jackdaniel>
it isn't particularily good for ai (not any better than for web development or for writing other apps)
yauhsien has joined #commonlisp
<Sankalp>
It was created by the "father of AI" though
WBarends has joined #commonlisp
<jackdaniel>
there is somewhat misleading notion with historical roots that lisp is good for ai, but it is not in the forefront of the field anymore nor there ai devs are a big chunk of cl community
<jackdaniel>
some people use common lisp for that of course
<Demosthenex>
that was before the original ai winter...
<sarahM>
which language is good? Python?
<Sankalp>
For AI, python, R or Julia
morganw has joined #commonlisp
<sarahM>
thank you
<Demosthenex>
Sankalp: isn't that just ML though
<jackdaniel>
I believe that python is the most widely adopted language for machine learning currently
<Demosthenex>
ML != AI.
<jackdaniel>
mkay, go implement chess ai with alpha-beta algorithm
<jackdaniel>
or monte carlo, then let's focus on ml=ai
<Sankalp>
ML is a subset of AI
<Demosthenex>
Sankalp: ok, subset works
<jackdaniel>
either way, most learning material about contemporary ai is not examplified with common lisp (and libraries are scarce for that)
<jackdaniel>
that said, if you want to learn about the remaining subset of ai that is not ml, check out paip
<sarahM>
I have to go
<sarahM>
thank u
<jackdaniel>
minion: tell sarahM about paip
<minion>
sarahM: paip: Paradigms of Artificial Intelligence Programming. More about Common Lisp than Artificial Intelligence. Now freely available at https://github.com/norvig/paip-lisp
sarahM has quit [Quit: Client closed]
<jackdaniel>
see you (and good luck)
Oddity has quit [Ping timeout: 272 seconds]
yauhsien has quit [Ping timeout: 248 seconds]
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 276 seconds]
Lord_of_Life_ is now known as Lord_of_Life
varjag has joined #commonlisp
dlowe has quit [Ping timeout: 246 seconds]
<varjag>
is there any restrictions to invoking SIGNAL from HANDLER-CASE handlers?
<lieven>
there's one in 9.1.4.1.1 but in general you can be in an arbitrarily long stack of handlers
<varjag>
thanks
<varjag>
it appears that my use of :report in condition was botching the handling somehow
dlowe has joined #commonlisp
<pjb>
jackdaniel: python is not sued for AI or ML, it's used to script and drive GPUs or libraries of statistical AI or ML, which are written in C++ or C…
<rotateq>
right, and people tend to forget about this
<pjb>
jackdaniel: lisp is still the best for symbolic AI! Including it's meta-programming features, which allows your AI system to optimize itself by generating code and compiling it to native.
orestarod has joined #commonlisp
<pjb>
lieven: it seems to me that 9.1.4.1.1 is more a logical, semantic restriction than a technical one.
* beach
wonders why the fact that something is old, makes it a struggle to use.
<Demosthenex>
beach: because "modern" programs build on decades of hiding information from users, presenting them with pretty buttons, and more recently enforced domestication.
<Demosthenex>
i mean, "modern" apps don't even allow hotkey customization anymore
<beach>
I see. Thanks for the explanation.
<Demosthenex>
emacs and it's transparency is highly unusual
<beach>
That I kind of knew, but I couldn't infer the struggle part from that.
<Demosthenex>
old in this context merely means unfamiliar ;]
<Demosthenex>
or opaque
<beach>
I think I understand.
<Demosthenex>
"modern" software does this thing called "intuition". where you require no study, no manuals, no education. you click pretty buttons and experiment until it works. emacs has a manual, thus we're outdated.
tyson2 has joined #commonlisp
<beach>
That must be why I am not tempted by "modern" software.
<Demosthenex>
indeed.
<Demosthenex>
its like videeo games for me. if they don't need spreadsheets, what is the point?
random-nick has joined #commonlisp
<Duuqnd>
Modern software can get away with not having a manual by relying on the user's assumed prior experiences. If Emacs keybindings had become the standard people wouldn't need to bother with its manual. It's just historical happenstance. Big programs for doing complicated things still need manuals.
<Demosthenex>
Duuqnd: yes, but frankly, "modern" software escews manuals :P
<Demosthenex>
even the big stuff
<Demosthenex>
my attitude is it isn't finished until the docs are written. that's not trendy
notzmv has joined #commonlisp
<Duuqnd>
I suppose manuals are less common now, but you don't learn (for example) CAD software for architecture by poking around with it until things work.
<Duuqnd>
That said, one can make software that have large manuals and have that software still be intuitive. For example, Symbolics Genera has a very intuitive UI (for its time anyway) yet came with a gigantic amount of documentation.
Inline has joined #commonlisp
<Demosthenex>
i didn't say you can't. i said that fell out of fashion
<Duuqnd>
That's true, I can't say the last time I saw a good software manual for a popular program
<jackdaniel>
pjb: I'm not contesting what you say, but for all practical purposes a majority of people who work on /a subset of/ AI open a jupyter notebook and /express/ their ideas in terms of a python program
<jackdaniel>
so I think that it is justified to say that python is used for ai or ml
<jackdaniel>
unless we want to deliberate whether using a compiler (like sbcl) is in fact using CL to do something, or its all assembly
<jackdaniel>
I'm not sure what is wrong with writing intuitive interfaces, but if having an obscure interface is the edge for state of the art programming, then we are surely on the forefront ! ,-)
<patrix>
pfff modern programs are all about learning the magical swipe/gesture that will make it do what you want to do, or hoping that the default works for you, or hoping that typing a question in the search box (in-program or in-google) will get it to do what you want…
<patrix>
s/learning/accidentally triggering and not remembering/
<beach>
Perhaps this is old thinking, but I would like to think that it is about long-term productivity. So if "obscure" (i.e., not obvious to a "modern" person) requires reading a manual, but makes the user more productive in the long run, then that's the preferred alternative.
<patrix>
yup
z4kz has joined #commonlisp
<empwilli>
Demosthenex: emacs stems from an age where most UI concepts where not established and thus you not only have to learn how it works but in actuality _relearn_ concepts that you learned from other UI systems. Window? Nah, wie call it Frame. Split? Nah, that's a window actually
<empwilli>
IMHO its true that people are less akin to invest time for learning. But that's only part of the truth. The other part is that you can't adapt any prior knowledge
<empwilli>
(i.e. that common pattern in *nix software to have single dashes for abbreviated CLI parameters/flags and double dashes for others)
<jackdaniel>
I basically agree with Duuqnd. Also, intuitive does not exclude comprehensive learning material (may even support it), obscure does not imply comprehensive learning material (and often lacks it, that's why it is obscure)
<empwilli>
s/i.e./e.g./ :D
<jackdaniel>
I'm thrilled each time I need to remind myself how m4 works (and I'm reading the manual! each time:)
<jackdaniel>
needless to say I'm not feeling more productive with that long term
aartaka has quit [Ping timeout: 248 seconds]
xaotuk has joined #commonlisp
<jackdaniel>
(that said I'm highly sceptical about the claim that python stack for AI/ML is intuitive, afaik it is extremely obscure and kludgy)
<mfiano>
bollu: Pass a format control string to break with the condition object so it's at the top of the call stack.
<bollu>
mfiano can you give me an s-expr I can copy and paste instead of (break)? I'm unsure what you're suggesting!
<mfiano>
Oh wait, you're unwinding the stack.
<jackdaniel>
bollu: put (break "~a" e) there
<mfiano>
Oh no you're not. Ignore me
slowButPresent has joined #commonlisp
<jackdaniel>
re why you can't sly-eval-in-frame - I don't know what that is, probably the thing you have when you press "e" when hovering the frame in sldb - I'm ignorant of how it works
<mfiano>
Wow, that's an incredibly useful feature.
<jackdaniel>
I mean - I use it sometimes, but I'm not familiar with details so I can't help with "why it doesn't work"
<mfiano>
Oh, you must have mispoke when you said you didn't know what that is.
<mfiano>
Sorry
<jackdaniel>
in the first place I'm not using sly, I'm only guessing that it is an equivalent features as found in slime
<bollu>
jackdaniel yes, that's what I'm referring to. I think it's the same as in slime, yes
<mfiano>
Indeed.
<bollu>
jackdaniel would it work in slime?
<jackdaniel>
as I said, I'm too modern to know how it works :)
<jackdaniel>
(so I can't help you with that)
<mfiano>
Demosthenex: You but find sjl's recent blog post useful for writing CLI apps.
<mfiano>
I found it pretty nice.
<mfiano>
Well I guess it's over a year old now, but still the second most recent :)
varjagg has joined #commonlisp
<mfiano>
He doesn't post very often but when he does, the content is top-notch.
<Demosthenex>
mfiano: yeah, i found it there with a search.
<Demosthenex>
exactly. i read it and couldn't find it again
varjag has quit [Ping timeout: 276 seconds]
<mfiano>
I am failing to type coherent sentences today it seems, looking at my history in all the channels I've spoke in. Excuse me while I go back to a different language.
<jackdaniel>
(invoke-restart 'no-worries)
<jackdaniel>
s/*/call_handler(new NoWorries());/
perrierjouet has quit [Ping timeout: 276 seconds]
<bollu>
jackdaniel how would you figure out what the error object is without using "eval-in-frame"?
<bollu>
would you simply print? :)
Bike has joined #commonlisp
<jackdaniel>
usually printer says what's wrong; if I had needed to work with it then I'd call the inspector on the object directly in the handler
<bollu>
jackdaniel what's the `clouseau:inspect` bit?
<jackdaniel>
clouseau is the object inspector written in common lisp by scymtym, it is one of a few applications bundled with McCLIM
<bollu>
jackdaniel how do I install this? seems very powerful!
<jackdaniel>
try (ql:quickload 'clouseau)
<jackdaniel>
and then (clouseau:inspect *package*)
<jackdaniel>
or (clouseau:inspect (make-condition 'uiop:subprocess-error :code 42))
<bollu>
jackdaniel that's so cool!
<jackdaniel>
all praises are owed to scymtym, he put a lot of effort to make this application
<bollu>
:
<bollu>
:) so neat!
Inline has quit [Quit: Leaving]
aartaka has quit [Ping timeout: 256 seconds]
<pjb>
beach: the programs/systems I find difficult to use are those that don't have an introspection feature allowing me to see the changes made by the other operations. unix is simple: any command such as cp, mv, rm, can be checked with ls; any command such as running a program, kill, etc, can be checked with ps, etc. A lot of modern systems are very hard, in that respect.
<Demosthenex>
pjb: user interfaces serve to hide all of that
<z4kz>
bollu: what are you working on (if I may ask)?
<pjb>
they're not interfaces then; they're curtains or blackboxes.
epolanski has quit [Quit: Connection closed for inactivity]
yewscion has joined #commonlisp
<z4kz>
anyway, that looks pretty cool
<z4kz>
you have a cool blog too btw.
igemnace has joined #commonlisp
<bollu>
z4kz thanks :) I got tired of using "poor" languages like python for prototyping. I like Haskell/Agda/Lean, but I wanted something more flexible for rapidly developing things. common lisp promises to make this easy, so I'm giving it a whirl!
<z4kz>
like, is it macros that is the main feature you like for the above algorithm?
<z4kz>
that's cool
<rotateq>
It uses the macros for example DEFPARAMETER and DEFUN. :)
Inline has quit [Quit: Leaving]
OlCe has quit [Ping timeout: 248 seconds]
varjagg is now known as varjag
z4kz has quit [Quit: Client closed]
<Demosthenex>
https://dpaste.org/f6TZv hrm. any ideas? i'm using sbcl 2.2.3 which is pretty recent, i just compiled it a few weeks ago
thunderstruck has quit [Ping timeout: 240 seconds]
thunderstruck has joined #commonlisp
thunderstruck has left #commonlisp [Leaving]
waleee has joined #commonlisp
<beach>
It looks like the system you are trying to build is referring to a symbol that has been removed from SBCL more recently than the system was updated.
<Demosthenex>
just making sure i'm on the right path
<Bike>
this might be too new to be in quicklisp
OlCe` has joined #commonlisp
rotateq has quit [Remote host closed the connection]
aartaka has joined #commonlisp
Inline has joined #commonlisp
ttree has joined #commonlisp
<Demosthenex>
yeah, i fixed. ty!
<beach>
Demosthenex: yaw!
<Demosthenex>
so, i can't seem to convince log4cl to log to a file only, and not the terminal. i'm using the root logger, (log:config :info :daily "filename" :backup nil) but it still outputs to terminal
sander has quit [Remote host closed the connection]
<varjag>
is it using syslog backend?
<varjag>
not familiar with log4cl but it is often set up in syslog config that certain levels/channels mirror to terminal
sander has joined #commonlisp
<Demosthenex>
yeah, i'm thinking maybe i can just set *standard-output* to nil?
<Demosthenex>
i just want the program to have no input or output, as it's logging to a file anway
<varjag>
i mean if syslog is your backend you should look into /etc/syslog.conf
<varjag>
or wherever it is on your system
analogsalad has quit [Ping timeout: 248 seconds]
<Demosthenex>
no, i'm using log4cl with a filename specified, but when i run the program it still spams my terminal. and it overrides >/dev/null 2>&1 so i expect it's binding the tty directly
<Demosthenex>
it does write my logfile, but it also spams the console
ec has quit [Quit: ec]
Inline has quit [Quit: Leaving]
varjag has quit [Quit: ERC (IRC client for Emacs 26.3)]
Cymew has quit [Ping timeout: 248 seconds]
<Demosthenex>
wow. i set *standard-output* and *error-output* to empty (make-broadcast-stream) and it still spams console
Inline has joined #commonlisp
cosimone has joined #commonlisp
<Shinmera>
It probably saved them when it loads/starts.
<Shinmera>
Iirc it also has some weird slime integration stuff so it might do funky stuff with swank too, dunno.
<Shinmera>
I'd know the answer for Verbose at least :v
NotThatRPG has joined #commonlisp
<Demosthenex>
i'm saving to an image.
<Demosthenex>
this is only a problem because i can't even use shell redirects
<Demosthenex>
chatbot >/dev/null 2>&1 doesn't stop the noise
<Demosthenex>
looks like cl-xmpp is using a handler that send format output to *debug-output*, but i bound that to an empty stream
<NotThatRPG>
I'm trying to build SBCL from source on MacOS on an ARM64 and getting an error when it tries to build determine_endianness with /usr/local/opt/apr/lib . I don't actually have that directory, since I use homebrew, instead of MacPorts, and the corresponding directory for me would be /opt/homebrew/opt/apr/lib . Anyone know how to fix that?
analogsalad has joined #commonlisp
<NotThatRPG>
ummmmm.... may have forgotten ./clean.sh. So nevermind...
<NotThatRPG>
Nope. Redid after clean.sh, and still the build is trying to find apr in the wrong place.
<Shinmera>
Editing the build script that calls it would be the easiest, probably.
<NotThatRPG>
Shinmera: Aha. Some mystery script somewhere put the wrong directory on LDFLAGS. Not in my user config, so must be hiding somewhere in /etc or something. Ugh
<Demosthenex>
i'm just floored. i can't seem to stop this program from outputting to stdout. nohup, >/dev/null 2>&1 , repeated calls to make standard-output and others empty...
epolanski has joined #commonlisp
<tyson2>
Demosthenex: can it be debugged at a low level with something like strace?
Patternmaster has quit [Changing host]
Patternmaster has joined #commonlisp
<tyson2>
I once uncovered a bug with a version of Scheme with strace
nosolls has joined #commonlisp
<Demosthenex>
tyson2: i'm sure a library is writing to terminal, it's not my code. i just removed log4cl and all it's calls. it still spams. but normally i'd be able to redirect at the shell stdout to /dev/null, and stderr. that doesn't work.
<Demosthenex>
seems like the save-image is rebinding standard-output on invocation, but i added setfs in my own functions and it still writes.
<tyson2>
Demosthenex: I think that with strace you may be able to determine which library is responsible
<tyson2>
I have only used it once so not sure
<Demosthenex>
tyson2: yes, but why can't i reliably bind stdout to null somehow? jsut shut it all down
<tyson2>
not experienced enough with linux etc to guess at that
aartaka has quit [Ping timeout: 248 seconds]
<Demosthenex>
i'm just trrying to run this in the background, ie: $ ./myprog > /dev/null 2>&1 &
<tyson2>
probably someone on a relevant IRC channel could point you the right way
<Demosthenex>
that should mean zero output, run in the background
<Demosthenex>
nope. this is the right one. this is lisp specific
aartaka has joined #commonlisp
<Demosthenex>
i've never had this issue with any other language ;]
<Demosthenex>
at this point to make it silent, i'd have to launch it in a screen session or something
<tyson2>
I would try it in slightly different environments to see if it behaves the same way
<tyson2>
perhaps a different version of linux
<sm2n>
Demosthenex: where did you bind it? It may be thread-local
<Demosthenex>
sm2n: top of file, in my main func called by save-image, in my loop spawned by the thread
<sm2n>
hmm, that sounds like it should work
yauhsien has joined #commonlisp
rotateq has joined #commonlisp
ec has joined #commonlisp
<Demosthenex>
sm2n: it could be thread local. it could be overridden in the save-image when it loads.
thunderstruck has joined #commonlisp
<Demosthenex>
https://dpaste.org/Z3j5k i'm trying to use a let binding twice there, and yet i can't explain why it's still spamming my console.
Inline has quit [Remote host closed the connection]
<Demosthenex>
i tried setf, did nothing. i understand you're not supposed to do that to *standard-output* and friends though
aeth_ has joined #commonlisp
aeth has quit [Ping timeout: 256 seconds]
cosimone has quit [Remote host closed the connection]
<mfiano>
I see some other problems. But I don't know a whole lot of where the problem you are looking for lives.
<bollu>
Is the idea of "continuing from a restart" something that's baked into the languager?
<mfiano>
Yes
<Demosthenex>
mfiano: yeah, i'm sure. i wrote this ages ago when first learning. atm i just want it to stop spamming my console ;]
<bollu>
and, well, how do I actually continue after catching an error with `handler-case`? :)
<Demosthenex>
i'm amazed that at the unix level i can't stop it talking
<adeht>
you can try (sb-posix:close 1) (sb-posix:close 2) (sb-posix:open "/dev/null" sb-posix:o-rdwr) (sb-posix:open "/dev/null" sb-posix:o-rdwr)
<bollu>
do I just call (continue)?
<bollu>
I'm unsure about the semantics
<beach>
bollu: You don't. You use handler-bind for that.
<adeht>
but there's also *trace-output*, *query-io*, *terminal-io* that you don't bind
<beach>
bollu: HANDLER-CASE unwinds the stack, much like exceptions in most languages do. HANDLER-BIND does not unwind.
adeht is now known as _death
<mfiano>
Demosthenex: Why are you repeatedly calling #'OPEN with constant input every outer loop iteration, and it is wrong to use #'CLOSE without UNWIND-PROTECT, but it's arguably wrong to do that too, when WITH-OPEN-FILE exists.
<Demosthenex>
mfiano: great question, i hadn't looked at that in ages. it's crap! =]
<Demosthenex>
it's also a fifo. wonder if read can just read forever.
<Demosthenex>
but that's good criticism, clearly that's wrong, it works, and i'm just trying to make it stop sending to my screen
<Demosthenex>
could this all be from the save-lisp-and-die refreshing?
<mfiano>
I don't even see where it's printing, and it's too much effort to try to read this style.
<Demosthenex>
mfiano: its not my code printing. that's the problem.
<Demosthenex>
i'm trying to absolutely stop all printing on any output from the top level of my file
<Demosthenex>
its one of the cl-xmpp or xml libs underneath
<mfiano>
Then try what _death said.
<thunderstruck>
good day guys, I'm learning lisp. I have an array and would like to create some rationals from elements of this array to do something like this : (+ (aref myarray 0 7)/(aref myarray 1 3) 1/3) what can be the exact syntax ?
<mfiano>
Look at all the available IO streams CL has.
<beach>
thunderstruck: So you want to divide an element in the array with another element in it in order to get a rational?
<beach>
thunderstruck: Then just divide: (/ (aref myarray ..) (aref myarray ..))
<thunderstruck>
beach : yep, I need to use rationals
<mfiano>
thunderstruck: First you need to know the array element-type.
Inline has joined #commonlisp
<beach>
thunderstruck: ... assuming the array contains rationals or integers, of course.
<thunderstruck>
beach : yep, I need to use rationals (exact values)
<beach>
thunderstruck: Operations such as / preserve rationals, so just use it.
<mfiano>
Why make-broadcast-stream?
<bollu>
beach thank you, let me try that
<Demosthenex>
mfiano: one of the tutorials says that you shouldn't bind to nil (and it can throw errors), instead use make-broadcast-stream with no arguments for an empty target
<beach>
thunderstruck: You actually have to do some additional work to *avoid* getting rationals.
<thunderstruck>
but when I try to compile, I got the message The value NIL is not a NUMBER
<beach>
thunderstruck: Then your array does not contain numbers.
<thunderstruck>
(this is the "/" interpreted as null
<pjb>
thunderstruck: then initialize your array with (make-array length :initial-element 1)
<beach>
thunderstruck: Did you do (/ (aref...) (aref ...))?
<pjb>
thunderstruck: perhaps you forgot to call the function / using the parenthesis! In lisp, parentheses mean call the operator.
<beach>
thunderstruck: You can't use infix notation, so not (aref ...)/(aref...)
<rotateq>
thunderstruck: Yeah to get rationals you have to be sure all elements in both vectors are rationals themselves (so this includes integers of course too).
<mfiano>
/ must be in operator position or it will be read as the variable of the same name.
<pjb>
(+ (/ (aref a 1) (aref a 2)) 1/3)
<beach>
OK, too many helpers. I'm off.
<thunderstruck>
the elements are all numbers
<rotateq>
beach: Sorry.
<mfiano>
thunderstruck: Show the exact form that gives you the error
<bollu>
why does handler-bind use the argument order of (handler-bind <handler> <expr-to-run>) while handler-case uses (handler-case <expr-to-run> <handler-1> <handler-2> ...)
<mfiano>
thunderstruck: That is not how you divide. Lisp uses prefix notation, not infix. "/" outside of prefix operator position is a variable.
<thunderstruck>
mfiano : I don't want to devide but to use ratrionals
<mfiano>
That is not how you do it.
<mfiano>
You divide to get rationals.
<thunderstruck>
but (+ 1/3 3/4) gives a good result
<beach>
bollu: There is no point in asking such questions. Probably nobody here knows. Maybe compatibility with some pre-existing dialect. Maybe they were invented by different committee people.
<mfiano>
thunderstruck: With the above, you are trying to add 3 values, with the 2nd one being bound to the variable "/"
OlCe` has quit [Ping timeout: 256 seconds]
<mfiano>
s/3/4/
<beach>
thunderstruck: The way to get a rational from the quotient of two rationals or integers is to divide one by the other.
<beach>
thunderstruck: So use the notation you were shown by several people.
<beach>
thunderstruck: The x/y syntax works only when x and y are literal integers, and then the READ function creates a rational for you by dividing them.
<beach>
thunderstruck: If you have arbitrary expressions, you need to use the division operator.
<rotateq>
Ah now I know from where the thought came. :)
<thunderstruck>
ok I'll try thanks !
<_death>
bollu: it gives a visual indication to when (different) things happen.. handler-bind adds the handlers and then evaluates the body, while handler-case runs the body and evaluates the handler code on exit.. the fact that handler-case probably expands to handler-bind is less pertinent in the reader's mind
<beach>
thunderstruck: So (+ (/ (aref ...) (aref ...)) 1/3)
<mfiano>
thunderstruck: I would suggest checking out #clschool if you are a newcomer.
<mfiano>
Understanding how the reader functions is part of basic training :)
ebrasca has joined #commonlisp
<thunderstruck>
yes it is necessary :-)
<mfiano>
This channel assumes you are somewhat experienced, though we tolerate some basic questions. The channel for asking about the basics is #clschool
<thunderstruck>
ok thanks, I'll see #clschool
attila_lendvai has quit [Quit: Leaving]
attila_lendvai has joined #commonlisp
MajorBiscuit has quit [Quit: WeeChat 3.4]
<Demosthenex>
ok, i give up. i'll just run it in screen and let it spam that
<Demosthenex>
mfiano: thanks for pointing out the loop, it was because it hit eof in the fifo. now i just loop forever trying to read-line and ignore eof ;]
<mfiano>
Demosthenex: I can take a guess why it is spamming
OlCe`` has joined #commonlisp
<mfiano>
The stack of dynamic variable bindings in thread-local. As a quick naive test you can try to SETF them instead of using LET.
<mfiano>
s/in/is/
<mfiano>
Usually. Technically threads are specified, but any sane implementation will do this.
<mfiano>
are not
<mfiano>
Jeez, I give up at English today.
<rotateq>
mfiano: It took me some time that '/' for reading in rationals and '|' for escaped symbols are no readmacros, but of course part of the reader algorithm.
aartaka has quit [Ping timeout: 260 seconds]
<rotateq>
*to realize
<bollu>
_death thanks for the mnemonic!
<Demosthenex>
mfiano: heh, i tried setf earlier... but maybe i didn't get them all
rgherdt_ has joined #commonlisp
rgherdt has quit [Ping timeout: 240 seconds]
aartaka has joined #commonlisp
rgherdt_ has quit [Ping timeout: 276 seconds]
aartaka has quit [Ping timeout: 260 seconds]
aartaka has joined #commonlisp
tyson2 has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
Repsil has joined #commonlisp
x88x88x has quit [Remote host closed the connection]
tyson2 has quit [Remote host closed the connection]
hashfunc1ebd has joined #commonlisp
<hashfunc1ebd>
i'm getting the error: "The value 0 is not of type VECTOR" and i have no idea why. here's the code: https://pastebin.com/iqBQ0vx3
<Bike>
looks like it's going to depend on what sha256 is.
<hashfunc1ebd>
sha256 just returns a string, but i don't understand why there's an error?
<hashfunc1ebd>
if i write it without the loop it works fine
<hashfunc1ebd>
i mean, if i just use GENERATE-K by itself, it works perfectly fine
<Bike>
with (defvar *n* 2) (defun sha256 (m) m), i can get (generate-valid-k "256") => 1
<hashfunc1ebd>
but then that should still work then, right? because it's returning an integer
<Bike>
it does work. i ran it and it worked, or at least i didn't get any error.
<Bike>
i suspect that whatever sha256 is for you, it's signaling the error.
<Bike>
the other possibility would be sha256 returning 0, i guess.
<Bike>
because parse-integer is the only thing i see in that code that could care whether something is a vector.
<hashfunc1ebd>
i think parse-integer must be the culprit
<Bike>
parse-integer is only going to give you an error like that if you pass it 0. and actually (parse-integer 0) complains about a string instead. so it's probably coming out of sha256. do you have a backtrace?
<hashfunc1ebd>
i do have the backtrace, but all it gives me is: 0: (SHA256 "hi") 1: (GENERATE-K "hi") 2: (GENERATE-VALID-K "hi")
<Bike>
alright, so that means the error is being signaled from inside sha256, no?
<hashfunc1ebd>
indeed, yes. but i don't see how that is possible. unless there is some macro magic that LOOP is doing?
<Bike>
i don't know how it's possible either because i don't know what sha256's definition looks like. the problem is not your loop.
<Bike>
if you call (sha256 "hi") by itself, do you get a similar error?
<hashfunc1ebd>
calling (sha256 "hi") by itself gives me the correct result: "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4"
pjb has quit [Ping timeout: 240 seconds]
<Bike>
i may not have made this clear, so: what your backtrace is telling me is that i do not have enough information to meaningfully assist you without knowing what sha256 is.
<hashfunc1ebd>
calling (MOD (+ (PARSE-INTEGER (SHA256 "HI") :RADIX 16) (GET-INTERNAL-REAL-TIME)) *N*) also gives me the correct result: 64799580415538975799983076416639475941656422820260801829320304467620373315344
pjb has joined #commonlisp
<hashfunc1ebd>
then lastly calling: (LET ((K 0)) (LOOP :WHILE (ZEROP K) :DO (SETQ K (MOD (+ (PARSE-INTEGER (SHA256 "HI") :RADIX 16) (GET-INTERNAL-REAL-TIME)) *N*))) K) is throwing the error: The value 0 is not of type VECTOR
<hashfunc1ebd>
Bike: i can try to get more info in the backtrace. but my intuition tells me that the call to SHA256 is not the issue here, but lies somewhere else relating to the LET, LOOP, or SETF
<Bike>
the error is coming from inside sha256 though. it is what is signaling the error.
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<Bike>
there could be something funny happening like displaced arrays or what have you.
<Bike>
but without seeing sha256 i can't know.
<hashfunc1ebd>
but how can that happen if it's deteriministically certain that the only call to SHA256 is (SHA256 "HI") ? where i've proven that the call (SHA256 "HI") is correct?
<Bike>
"HI" could be a displaced string or something. i don't know.
<hashfunc1ebd>
i'll make another pastbin post so that it's clear what is going on thus far
<Bike>
i redefined sha256 to return that hash, and called this with a couple different values of *n*, and i'm still not seeing any error.
analogsalad has quit [Quit: bye]
djuber has joined #commonlisp
pjb has quit [Ping timeout: 248 seconds]
<Bike>
sha256 mutating its argument could also present a problem.
<_death>
Bike: you're very patient today ;)
<hashfunc1ebd>
hoepfully this clears everything up. the issue appears to be because of the LET form: https://pastebin.com/BZzgL6qL
<Bike>
that doesn't clear anything up.
<Bike>
is there a reason you can't share sha256? is it big? is it secret? it just computes a hash, right?
<hashfunc1ebd>
Bike: i can't share the implementation of it at this time. but that pastebin shows that it's working correctly, is it not? it when the LET is introduced is when things get screwy
<Bike>
it doesn't. introducing a let does not cause that error.
<Bike>
i mean, if it does, your implementation is totally broken. you'd have to be using something unmaintained like gcl, but that looks like sbcl.
<_death>
my guess is that K is a special variable.. but perhaps it's best to avoid wasting time on this case as long as a self-sufficient test case is not produced
yauhsien has quit [Remote host closed the connection]
<hashfunc1ebd>
yeah i'm using SBCL
pfd has quit [Quit: Client closed]
yauhsien has joined #commonlisp
pjb has joined #commonlisp
pjb is now known as Guest602
epolanski has quit [Quit: Connection closed for inactivity]
yauhsien has quit [Ping timeout: 260 seconds]
Guest602 has quit [Remote host closed the connection]
<Demosthenex>
Nilby: wow. cool
jmdaemon has joined #commonlisp
<Bike>
i wrote sha256 in terms of ironclad to actually produce a hash, and i'm still not seeing the error. the problem is something not apparent in your information, such as: sha256 being broken, k or some other variable being mysteriously special, evil gremlins putting a reader macro on (, etc
<hashfunc1ebd>
Bike: thanks for the help thus far. i redefined SHA256 to be just: (DEFUN SHA256 (M) (DECLARE (IGNORE M)) "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4") and that indeed does not throw the error.
<hashfunc1ebd>
Just now, though...
Dynom has quit [Quit: WeeChat 3.5]
<hashfunc1ebd>
in the LET form, i redefined the K variable to TESTER, and i did not get an error! i got the output: #(1116352408 1899447441 3049323471 3921009573 961987163 1508970993 2453635748 2870763221 3624381080 310598401 607225278 1426881987 1925078388 2162078206 2614888103 3248222580 3835390401 4022224774 264347078 604807628 770255983 1249150122 1555081692 1996064986 2554220882 2821834349 2952996808 3210313671 3336571891 3584528711 113
<hashfunc1ebd>
looking into it right now. since i'm expecting an integer and not this
<Bike>
you have overcome my "have you tried walking into the sea" threshold, so i can only wish you good luck
<hashfunc1ebd>
haha thanks Bike. i think i can take it from here. the K variable being special is the culprit
<hashfunc1ebd>
_death: thanks, i should've looked into that when you mentioned it. but it didn't click until just a few minutes ago
kpoeck has quit [Quit: Client closed]
kpoeck has joined #commonlisp
x88x88x has quit [Remote host closed the connection]
<hashfunc1ebd>
to summarize everything, the capitalized K symbol is the variable name used in the sha256 algorithm to represent an array of 64 32 bit integer constants. since my function was using (LET ((K 0)) ...) that screwed everything up
<random-nick>
well, you should probably make that a lexical variable in the sha256 function
kpoeck has quit [Quit: Client closed]
x88x88x has joined #commonlisp
<Nilby>
Demosthenex: there are even more severe incantation for things that may be forking or doing ffi
morganw has quit [Remote host closed the connection]
<Bike>
please don't post links without explanation or context.
<Bike>
okay, this is spam.
<_death>
it's a repeat offender
lucie22 has quit [Client Quit]
<Bike>
well, they're on the akick list now.
Repsil has quit [Remote host closed the connection]
Repsil has joined #commonlisp
aeth has quit [Ping timeout: 240 seconds]
Repsil has quit [Ping timeout: 260 seconds]
aeth has joined #commonlisp
abrantesasf has joined #commonlisp
knusbaum has joined #commonlisp
Repsil has joined #commonlisp
kevingal has joined #commonlisp
pve has quit [Quit: leaving]
knusbaum has quit [Ping timeout: 276 seconds]
shka has quit [Ping timeout: 248 seconds]
yewscion has quit [Ping timeout: 248 seconds]
attila_lendvai has quit [Ping timeout: 248 seconds]
aartaka has quit [Ping timeout: 276 seconds]
aartaka has joined #commonlisp
aartaka has quit [Ping timeout: 250 seconds]
pillton has joined #commonlisp
orestarod has quit [Ping timeout: 240 seconds]
perrierjouet has joined #commonlisp
jeosol has joined #commonlisp
kevingal has quit [Remote host closed the connection]
<jeosol>
hello guys
<jeosol>
what is the best way to return from with-open-file so the file is closed at least
<jeosol>
The use case is: I have a larger file, I am trying to split into smaller files. There is a string in the larger file that tells me it's time to stop writing to the old file and open a stream and start writing to a new file
<jeosol>
also there could be a better way to do this. What I have now is with-open-file for the larger file and using (open filename ...) for the local files and closing manual, which is messy
<jeosol>
I wrote the code many years ago but trying to refactor
<mfiano>
You can use catch/throw
<mfiano>
The unwind-protect of with-open-file will ensure it is closed for you
<mfiano>
Even by means of non-local transfer of control
<mfiano>
or tagbody/go, or with-simple-restart, or whatever looks/works best for your use-case
<jeosol>
mfiano: thanks, I am trying to make sure the file is close when I do some forced transfer of control
<mfiano>
If you don't need dynamic extent, which it sounds plausible, you can also use block/return-from
<jeosol>
will return-from work
<mfiano>
I guess showing the code would help more if you need additional help
<jeosol>
basically, I will have two with-open-file, outer for the larger file and inner for the temporary file that will be closed once I get info to write to new file
knusbaum has joined #commonlisp
<Alfr>
jeosol, and return-from we-are-done, when you don't need that large-file any more.
<jeosol>
Alfr: aah, I got it now, I was searching for the return in the initial snippet
<jeosol>
so the block wraps the wof of the smaller file?
<Alfr>
jeosol, you won't always need that block, I put it there as an obvious way to escape the loop over the inner wof.
<jeosol>
Alfr: thanks, basically, I want to return from the inner wof, but update a filename (to new filename) so that the next time the inner wof runs, it's being called with a new file
<jeosol>
I am modifying you template to get the right flow
abrantesasf has quit [Remote host closed the connection]
<char[m]>
What is the most #1 mind blowing (to a non-lisper) example of a common lisp domain specific language?
ec has quit [Quit: ec]
<jeosol>
mfiano: okay, I will paste a sample code, mind you it's not correct as I am trying to incorporate Alfr code snippet
aeth has quit [Ping timeout: 276 seconds]
aeth has joined #commonlisp
<jeosol>
Alfr, mfiano: here is what is what I was hacking, basically modifying the old code, so this one is not correct yet: here is the paste https://paste.debian.net/1239743/
<jeosol>
basically, I take the larger file, split into a number (? not known at time of running the code) of files, then return the list of files to another function for further processing. There is a sentinel string that is used to indicate when to write a new smaller file
<jeosol>
for background: the output is from a legacy fortran program
<jeosol>
mfiano: I should have pasted a working code, not the one I was modifying in case it's confusing
pfd has joined #commonlisp
<jeosol>
mfiano: here is a version that works but obviously buggy as I call (open file ...) via (make-output-file-stream ...) function and close it manually : https://paste.debian.net/1239747/
<jeosol>
The last paste is the one I am trying to streamline and make. While it works, one of the machines I use always restarts after a while and I am thinking there is some leakage and I am trying to replace the very old code I wrote back in noob days
psf has quit [Ping timeout: 256 seconds]
psf has joined #commonlisp
<Alfr>
jeosol, did I grok your code right, that your input looks essentially is: lines of data terminated by a line containing that magic string
<jeosol>
Alfr: yeah, basically the legacy program writes a set of tabulated data and then writes that termination string
<jeosol>
and then continues writing similar tabulated data
<Alfr>
jeosol, if I were you, I'd read from what you named stream inside a loop within the inner with-open-file, when encountering said line, I'd write that and then bail out of the inner w-o-f.
<jeosol>
yeah, that's essentially what I do, but I wanted to use w-o-f in the more streamlined code and ensure when I bail out the file is closed correctly, hence my initial question
<Alfr>
jeosol, right now your inner w-o-f will reopen and replace the output file though ever iteration of the outer loop, you don't want that, I think.
<jeosol>
not sure if you are looking at the last paste. The initial ones are not correct,
<Alfr>
jeosol, I very well may not be. :D
<jeosol>
see last paste for working code but using (open .file ..) which error prone