<gendl>
Hi, how do we feel about the :iterate system? (from Jonathan Amsterdam; available in Quicklisp from repository maintained by Attila Lendvai on gitlab.common-lisp.net)?
<gendl>
is this suitable for use in a mission critical industrial setting?
<Bike>
lots of people here use it, at least.
<gendl>
I am with a customer who is dealing with converting a bunch of old code using a proprietary ICAD iteration construct called `let-streams'
fikka has joined #lisp
pjb has joined #lisp
<gendl>
I have also been gifted a set of functions which purport to translate let-streams forms into iterate forms.
<LdBeth>
It’s not wise to do unnecessary modification on legacy programs.
<gendl>
well, ICAD does not exist anymore, so this code must be migrated off of let-streams somehow or other.
<gendl>
The customer has also embarked on a consulting project which converted the let-streams into LOOP constructs.
<gendl>
To me, these let-streams look much more similar to iterate forms than they do to LOOP.
<gendl>
the LOOP forms scare me, frankly.
<Bike>
the main selling point of iterate is that it can do what loop does, but with a more regular "lisp like" syntax
<Bike>
and you can also customize it and stuff
<gendl>
Yes. That's a selling point which speaks to me, for sure.
<gendl>
I'm leaning toward nudging the customer in the direction of iterate, if this is something I am going to sign up to support.
<gendl>
The customer is probably going to want to tend toward sticking with something which is in the standard, if possible, though.
<gendl>
But if I can make a case that iterate is stable, well-defined, not likely to disappear or experience chaotic changes...
fikka has quit [Ping timeout: 252 seconds]
<gendl>
.. and I'll be able to do a better job supporting it
<gendl>
then perhaps they can be persuaded.
<Bike>
well, as far as stability goes, the cl-net page says it predates the standard, so it's not like something someone came up with on a whim five minute sago
<Bike>
and the manual is an adaptation of an ai memo from 1990
<gendl>
right. I think both let-streams and iterate predate the standard.
<gendl>
they were something of competitors back in the day, though neither made it into the standard, in favor of LOOP.
<gendl>
pillton: well, I have to say LOOP is a bit weird too.
<Bike>
that is kind of weird, but you can get similar weirdness from typed value accumulation in lisp
<Bike>
loop
<Bike>
hm, i don't remember how though
<pillton>
That is true. My favourite is (loop for x in nil maximize x).
<aeth>
Where I've gotten weirdness in LOOP is an unreachable code deletion warning in SBCL for ":for foo := (bar ...)" where foo isn't used on the first iteration through the loop.
<aeth>
Since ":for foo := (bar ...)" presumably expands to ":for foo := (bar ...) :then (bar ...)" when there's no then
<aeth>
I see it as a leak of the internals, #sbcl sees it as a won't-fix
<aeth>
If you want no magic, use DO because that's usually pretty directly expanding into a LET over a TAGBODY with a GO when you macroexpand-1.
<aeth>
On the other hand, the magic is sometimes very useful, like collect/append (there are higher order function equivalents, but only when not collect/append is not conditional)
<aeth>
And while LOOP is normally equivalent to DO* for things like :for foo := (bar) :then (baz), there is no short :for foo := (bar) with DO*. Not having the increment step is like LOOP's :with. So it could potentially reduce a lot of duplication there
<aeth>
("vec" is shorthand for vec3 because it's the most common vec by far in my engine. Define function just is defun with declaims/declares built in.)
<aeth>
(The part that didn't compile was one of the specializations.)
<pillton>
I can't look in to it now. Send me an issue with something I can evaluate.
fikka has quit [Ping timeout: 240 seconds]
<aeth>
I suspect a simplified case would look something like (defun foo (u1 u2 u3) (declare (vec u1 u2 u3)) (let ((v1 (make-vec)) (v2 (make-vec))) (declare (vec v1 v2)) (vec--into! v1 u1 u2) (vec--into! v2 u1 u3)))
<pillton>
Hmmm.. something I can evaluate without having to load anything other than specialization-store.
pjb has quit [Ping timeout: 264 seconds]
rumbler31 has joined #lisp
<aeth>
Hmm... My simplification is too simplified. (compile 'foo) has no error.
fikka has joined #lisp
<aeth>
I'll have to look into it some more. (Making it standalone is much easier, I just need to macroexpand the macro that generates the defspecialization)
<aeth>
(and the type)
robotoad has quit [Max SendQ exceeded]
fikka has quit [Ping timeout: 264 seconds]
ryan_vw has quit [Ping timeout: 264 seconds]
Kundry_Wag has joined #lisp
robotoad has joined #lisp
Lycurgus has joined #lisp
fikka has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
aydio has quit [Quit: WeeChat 2.2]
fikka has quit [Ping timeout: 246 seconds]
mejja has quit [Quit: mejja]
dented42 has joined #lisp
fikka has joined #lisp
aindilis has quit [Ping timeout: 240 seconds]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fikka has quit [Ping timeout: 252 seconds]
robotoad has quit [Max SendQ exceeded]
dented42_ has joined #lisp
Kundry_Wag has joined #lisp
dented4__ has joined #lisp
dented42_ has quit [Ping timeout: 252 seconds]
Roy_Fokker has quit [Read error: Connection reset by peer]
Kundry_Wag has quit [Ping timeout: 252 seconds]
PuercoPop has left #lisp ["Killed buffer"]
robotoad has joined #lisp
lnostdal has joined #lisp
fikka has joined #lisp
ryan_vw has joined #lisp
fikka has quit [Ping timeout: 264 seconds]
_whitelogger has joined #lisp
robotoad has quit [Max SendQ exceeded]
Josh_2 has joined #lisp
fikka has joined #lisp
Kundry_Wag has joined #lisp
rtypo has quit [Ping timeout: 252 seconds]
fikka has quit [Ping timeout: 240 seconds]
Kundry_Wag has quit [Ping timeout: 246 seconds]
aindilis has joined #lisp
lksmk has joined #lisp
robotoad has joined #lisp
Kabriel has joined #lisp
wanz has joined #lisp
fikka has joined #lisp
travv0 has joined #lisp
anewuser has joined #lisp
Josh_2 has quit [Remote host closed the connection]
<gendl>
`(iter (for num = (in (list 1 2 3))) (finally (return 2)))`
<gendl>
what am I doing wrong?
<Bike>
from the manual it looks like it might be "for num in (list 1 2 3)"
earl-ducaine has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
<Bike>
`in` as a head does something else
<gendl>
Thanks. I should read more before I ask here. I'm just playing with this old code which supposedly converts to iterate code so I was believing what it was outputting.
robotoad has joined #lisp
<gendl>
I think i might not be using the converter right. I probably have to do some package-fu to get the old let-streams operators to be recognized by the converters.
<gendl>
converter*
wanz has quit [Quit: wanz]
pjb has quit [Ping timeout: 260 seconds]
stereosphere has joined #lisp
arescorpio has quit [Remote host closed the connection]
fikka has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
wanz has joined #lisp
igemnace has joined #lisp
fikka has joined #lisp
wanz has quit [Remote host closed the connection]
wintertot has quit [Quit: Tots out]
fikka has quit [Ping timeout: 246 seconds]
Bike has quit [Quit: Lost terminal]
tripty has joined #lisp
sauvin has joined #lisp
fikka has joined #lisp
fikka has quit [Ping timeout: 264 seconds]
ryan_vw has quit [Ping timeout: 268 seconds]
rumbler31 has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
robotoad has quit [Ping timeout: 246 seconds]
meepdeew has quit [Remote host closed the connection]
robotoad has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
rumbler31 has joined #lisp
astronavt_ has joined #lisp
fikka has joined #lisp
pjb has joined #lisp
Oladon has quit [Ping timeout: 246 seconds]
astronavt has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 252 seconds]
space_otter has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 240 seconds]
Inline has quit [Quit: Leaving]
fikka has joined #lisp
Kundry_Wag has joined #lisp
fikka has quit [Ping timeout: 272 seconds]
igemnace has quit [Read error: Connection reset by peer]
beizhia has joined #lisp
igemnace has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
vlatkoB has joined #lisp
fikka has joined #lisp
astronavt_ is now known as astronavt
Kundry_Wag has joined #lisp
dented4__ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pjb has quit [Ping timeout: 264 seconds]
fikka has quit [Ping timeout: 246 seconds]
<beizhia>
Here's a question I may as well ask here: I've finally figured out why developing with Slime and the REPL is so awesome (making a little website with hunchentoot). How do I bridge the gap between that and C/Java/Ruby, where I'm used to deploying a project as a whole?
<beach>
Good morning everyone!
Kundry_Wag has quit [Ping timeout: 252 seconds]
dented42 has joined #lisp
<fiddlerwoaroof>
morning beach
<fiddlerwoaroof>
beizhia: you write an asdf system definition and then start a fresh repl, load your system + all its dependencies and dump an image
<fiddlerwoaroof>
The function for dumping an image on SBCL is SB-EXT:SAVE-LISP-AND-DIE
<beizhia>
ah ok, interesting. I had been trying to use asdf:make to build an executable
<beizhia>
I'll look in to that though, thanks fiddlerwoaroof
<fiddlerwoaroof>
You can get pretty fancy with how you do it, but I often just write a little build script and run it with sbcl --load
<fiddlerwoaroof>
(the second one also builds in CCL
<beizhia>
aha nice. I'll give those a deeper dive in the morning. Thanks for the example code!
<beizhia>
I still cant figure out if I'm just having a tough time with this, or if it's really quite different from everything else out there
fikka has joined #lisp
rumbler31 has quit [Remote host closed the connection]
<fiddlerwoaroof>
It's quite different
Lord_of_Life has quit [Ping timeout: 240 seconds]
<fiddlerwoaroof>
The only similar systems still around, as far as I know, are smalltalk systems
<fiddlerwoaroof>
You "build" an application by dumping the current state of your lisp implementation and then loading that back into the lisp implementation next time you run your app.
<fiddlerwoaroof>
It's more like the way docker containers work than the way something like Makefiles, mvn, cargo, etc. work
<fiddlerwoaroof>
(Makefiles for C, that is)
<beizhia>
Hah smalltalk and docker are the other two things I'm kinda hung up with lately
<fiddlerwoaroof>
Well, for now, lisp still keeps its source code in files, unlike smalltalk.
fikka has quit [Ping timeout: 272 seconds]
Kundry_Wag has joined #lisp
pierpal has quit [Ping timeout: 252 seconds]
<beizhia>
I kinda prefer that. Feels a little more grounded in reality. I totally still feel more at home reading source files in a static typed compiled language.
<fiddlerwoaroof>
Yeah, if you really get into desigining stuff for exploration at the repl, you start missing the types less
<beizhia>
Just moved over to doing a lot of Javascript at work and honestly Lisp is helping me understand JS a lot.
<fiddlerwoaroof>
I've noticed that a lot of the practices $work promotes for designing testable code also lend themselves nicely to designing repl-friendly code
<beizhia>
I've been seeing that. Read a great article contrasting unit testing with REPL programming.
<fiddlerwoaroof>
i.e. writing small pure functions wherever possible so that you don't have to worry about io/etc.
robotoad has quit [Quit: robotoad]
<beizhia>
Basically, both are just the simplest way of calling a function, is what they mentioned.
<beizhia>
Ya, trying to emphasize that point with my team... We have a lot of several-hundred-liners in our code.....
<fiddlerwoaroof>
Also, don't be afraid of CLOS, I found it entirely changed my perception of what OOP means
Kundry_Wag has quit [Ping timeout: 252 seconds]
<fiddlerwoaroof>
And then look into how CL does error handling with restarts
<beizhia>
Heh, that's what this little tutorial is walking me though actually. I'm getting it. CLOS is rad.
frodef has joined #lisp
<fiddlerwoaroof>
beizhia: if this were #js, I'd strongly recommend using ramda as the standard library of JS
<fiddlerwoaroof>
but this isn't #js, so that's off-topic ;)
<beizhia>
fair enough :P
<fiddlerwoaroof>
Which tutorial are you going through?
<beizhia>
so its not really "taking me through CLOS", but it's given me a good starting point
<beizhia>
I was a bit afraid of it before, but I've been going at it since.
<fiddlerwoaroof>
If you want something a bit more in-depth, I'd skim PCL
<fiddlerwoaroof>
minion tell beizhia about pcl
<fiddlerwoaroof>
minion: tell beizhia about pcl
<minion>
beizhia: direct your attention towards pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
<beizhia>
I have before, a couple times. I should probably hit it again though, now that I know more.
<beizhia>
Been thinking about grabbing SICP too.
<beizhia>
This is maybe my 3rd earnest go at getting into LISP, and I think it's starting to stick.
<fiddlerwoaroof>
That's a good book, but it's not CL
<beizhia>
Oh really? I thought it was, at least somewhat.
<fiddlerwoaroof>
It uses scheme throughout
<beizhia>
Oh heh, whoops.
<beizhia>
I suppose I sorta conflate all the lisp-like languages in my mind.
Kundry_Wag has joined #lisp
fikka has joined #lisp
<fiddlerwoaroof>
There are similarities, but the different communities are pretty different
<beizhia>
That's what I'd heard. I'm a neophyte though :D
<leo_song>
you can do SICP in CL
fikka has quit [Ping timeout: 252 seconds]
lnostdal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
pierpal has quit [Read error: Connection reset by peer]
pierpal has joined #lisp
fikka has joined #lisp
<aeth>
In general the differences are: Scheme is (1) minimalist (and breaks compatibility so the names are often cleaner), (2) has hygienic macros, (3) has call/cc, (4) guarantees tail call optimization so tail recursion is idiomatic
<aeth>
Scheme implementations are incompatible with each other in key areas (although portable Scheme is possible to write).
<beizhia>
call/cc is another thing that breaks my brain every time I try to figure it out
<aeth>
Common Lisp culturally values portability, is more of a practical language instead of an academic one (at least traditionally), and has a huge immutable standard.
<beizhia>
or rather, I probably just try to use it in incorrect ways
<aeth>
But I think a good distinction that hints at the early 1990s era cultural divide (practical vs. academic) is that if you're working with arrays of numbers, CL is imo much nicer than Scheme.
<aeth>
2D arrays of (complex single-float) and (complex double-float)? Sure, go ahead.
<aeth>
(But I'm sure jcowan has something planned here for a future Scheme standard.)
ryan_vw has joined #lisp
Kundry_Wag has quit [Ping timeout: 246 seconds]
<aeth>
(And I wouldn't be entirely surprised if some Scheme implementation eventually extended the numeric tower to include all division algebras, not just real and complex)
mildtaste has joined #lisp
mildtaste has left #lisp [#lisp]
<beizhia>
I can see why a scheme-type language would be nice for something like Guile, where you only want to embed as little as possible. For something on its own though, common lisp just feels much more usable.
<beizhia>
especially in a world where python, ruby, lua, and JS exist
fikka has joined #lisp
* fiddlerwoaroof
likes how CL feels like it could be an OS if people were willing to give it a chance
<fiddlerwoaroof>
It works in Lispworks and ECL, but sbcl and ccl seem to have a bug in their implementations of define-method-combination's long form that prevents it from working there.
* jackdaniel
opens a shampaign
fikka has quit [Ping timeout: 252 seconds]
<beizhia>
That's kinda frustrating, that there's implementation compatibility problems
<fiddlerwoaroof>
This is a really weird, dark corner of the spec
<fiddlerwoaroof>
So it's not too surprising
<fiddlerwoaroof>
And, there's also a question of whether or not my method-combination is conforming
stereosphere has quit [Read error: Connection reset by peer]
stereosphere has joined #lisp
Cymew has joined #lisp
<beizhia>
Its that dark corners of specs that get you, regardless of language or framework.
<beizhia>
Time for me to call it a night, see yall later
beizhia has quit [Quit: ERC (IRC client for Emacs 26.1)]
Kundry_Wag has joined #lisp
jcowan has quit [Quit: Connection closed for inactivity]
Kundry_Wag has quit [Ping timeout: 240 seconds]
xkapastel has quit [Quit: Connection closed for inactivity]
<aeth>
fiddlerwoaroof: I would ask beach
<fiddlerwoaroof>
We talked about this last night
fikka has joined #lisp
<beach>
Speaking of which, how does SBCL optimize make-instance?
<fiddlerwoaroof>
That's beyond me :)
<beach>
OK.
<beach>
I just thought of a way, and it is so obvious that I am convinced that SBCL already does it in a similar way.
<beach>
I'll ask scymtym later.
<fiddlerwoaroof>
I have a hazy recollection of reading a comment about this last night, but I was focusing on other things
<fiddlerwoaroof>
I also have a hard time keeping the context of the things I read right
angavrilov has joined #lisp
<beach>
Yes, I see.
<beach>
Anyway, I am not in a rush.
<aeth>
fiddlerwoaroof: If beach doesn't know something about the implementation of CLOS, there's a good chance no one knows.
frgo has quit [Remote host closed the connection]
<aeth>
(well, no one active in the CL community in the past 20 years)
<jackdaniel>
I believe you don't give enough credit some prominent figures in the community (which I won't call by name to not embarass them with such praise :)
<jackdaniel>
s/which/whom/
<aeth>
jackdaniel: Is there another new implementation of CLOS?
<jackdaniel>
that's not the point. there are many people who worked on existing implementations or compared them. for instance at last ELS the very topic of method combinations has popped up
<fiddlerwoaroof>
And, this isn't a question of implementation but of the interpretation of the standard
<jackdaniel>
(and why the spec is insufficient with their regard)
sjl_ has quit [Ping timeout: 268 seconds]
<fiddlerwoaroof>
The standard is vague about what happens when all the specifiers match but the qualifiers differ
<fiddlerwoaroof>
(except in the cases necessary for the built-in method combinations)
Kundry_Wag has joined #lisp
sjl_ has joined #lisp
shka_ has joined #lisp
solyd has joined #lisp
varjag has joined #lisp
earl-ducaine has quit [Remote host closed the connection]
earl-ducaine has joined #lisp
ryan_vw has quit [Ping timeout: 252 seconds]
<beach>
Hmm, my idea is not as obvious as I first thought. Needs more thinking...
fsmunoz has quit [Ping timeout: 276 seconds]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
solyd has quit [Quit: solyd]
rumbler31 has joined #lisp
anewuser has joined #lisp
angavrilov has quit [Remote host closed the connection]
angavrilov has joined #lisp
asymptotically has joined #lisp
rumbler31 has quit [Ping timeout: 240 seconds]
scymtym has joined #lisp
Lycurgus has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
mrblack has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 252 seconds]
fikka has joined #lisp
lnostdal has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
solyd has joined #lisp
fikka has joined #lisp
jochens has joined #lisp
jochens_ has joined #lisp
jochens has quit [Ping timeout: 264 seconds]
asymptotically has quit [Remote host closed the connection]
asymptotically has joined #lisp
heisig has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 246 seconds]
heisig has quit [Remote host closed the connection]
martylake has quit [Ping timeout: 240 seconds]
space_otter has quit [Remote host closed the connection]
<mrblack>
is "otherwise" a command in Common Lisp?
<jackdaniel>
it is a symbol in CL package
<jackdaniel>
used for instance in typecase
<jackdaniel>
to denote clause which is executed if none of specified types matches the object
<heisig>
mrblack: But it is not a function, it is just a symbol that is treated specially in certain macros.
<mrblack>
jackdaniel, heisig: cool, thanks... it was used in Land of Lisp but I don't think the author explains it, couldn't find. It's hard to find info about it because that's a common word. Do you have any links for it?
<jackdaniel>
use l1sp.org (the second character is "one", not small "L"), very handy for such lookups
<mrblack>
thank you, jackdaniel. this seems like a good site to bookmark. Google wasn't of much help ;)
<jackdaniel>
thank Xach who created this search engine
<jackdaniel>
also I believe that duckduckgo redirects to this site when used with a special bang
<mrblack>
oh, xah... I use a lot of things he/she made. Great dev.
<aeth>
on DuckDuckGo it's !l1sp
<jackdaniel>
mrblack: not the same person
<aeth>
If you make DuckDuckGo your default search engine you can just !l1sp in the URL bar in e.g. Firefox
<aeth>
e.g. "!l1sp otherwise"
<mrblack>
jackdaniel, aeth, great. I used Vimium, though, it lets me create commands for any search I want.
mathrick_ has quit [Ping timeout: 264 seconds]
mathrick_ has joined #lisp
Lycurgus has quit [Quit: Exeunt]
<mrblack>
is it possible to access this documentation offline like man pages, from Emacs or the command line?
<mrblack>
I see that "slime-documentation-lookup" will open the term under cursor on the web browser... it's good enough, I guess. But offline would be better
<jackdaniel>
hyperspec may be integrated with Emacs, but I don't know how (never did that)
<jackdaniel>
(as an offline thing)
<shka_>
zeal is one of possible options
<shka_>
it workes for me
<mrblack>
jackdaniel, so otherwise is a kind of "else"?
Guest75806 has quit [Remote host closed the connection]
Guest75806 has joined #lisp
<LdBeth>
since t is a type
<mrblack>
LdBeth, what does this mean?
rozenglass has quit [Remote host closed the connection]
<Xof>
fiddlerwoaroof: I think you've found the two relevant paragraphs about method combinations and matching specializers / differing qualifiers
<Xof>
one implies that what you want to do is allowed; the other implies that it isn't
fikka has quit [Ping timeout: 252 seconds]
<Xof>
sbcl generally (at least historically) tends to go for outward portability -- if it uses only standard functionality and runs on sbcl, it runs on other CLs
nirved has joined #lisp
<Xof>
so it chooses to obey the paragraph that says that what you're trying to do isn't allowed
<Xof>
however: there is an escape hole -- sbcl doesn't enforce that restriction if there is a single, wild-card method group
<Xof>
i.e. *, rather than your :route *
Kundry_Wag has joined #lisp
lumm has joined #lisp
<Xof>
beach: sbcl optimizes make-instance in a bundle of different ways. the main way is when the initarg symbols are constant, we construct a CTOR (see src/pcl/ctor.lisp) which maps the initargs to slot locations (per-class if the class-name argument to make-instance is variable, otherwise just once), receives values for all the initarg forms that weren't compile-time constants, and allocates and initializes the instanc
<Xof>
e
<Xof>
actually I'm less sure about the "bundle of different ways"; I think I've managed to get them all into one sentence :-)
<beach>
Xof: Thanks. What if there are :AROUND methods on INITIALIZE-INSTANCE and/or on SHARED-INITIALIZE?
Kundry_Wag has quit [Ping timeout: 245 seconds]
Kundry_Wag has joined #lisp
<Xof>
we refuse to optimize if there's a non-standard allocate-instance method, or an :around method on shared-initialize. we can cope with :around methods on initialize-instance if it calls (call-next-method) appropriately
fikka has joined #lisp
<beach>
Got it. Thanks!
<beach>
So you must detect when such a method is added and remove the CTOR, I suppose?
<Xof>
the ctor maintains state, and invalidates itself on changes of applicable methods
<Xof>
it recomputes an optimizing constructor function the next time it's called
<beach>
Nice. Thanks for the information.
<Xof>
(if it is allowed to)
<Xof>
welcome. This was largely Gerd Moellmann's work, when he was (I presume) bored between jobs around *gulp* 2002
<Xof>
ctor optimizers are old enough to get married (with parental permission)
ggole has joined #lisp
<flip214_>
Can I get the current input position (in bytes) from CXML? I'd really like to create an index (tag => position, length) into a large XML file, and then do "random" IO on it.
Kundry_Wag has quit [Ping timeout: 252 seconds]
pierpal has quit [Ping timeout: 240 seconds]
vutral has quit [Ping timeout: 245 seconds]
igemnace has quit [Quit: WeeChat 2.3]
nirved has quit [Killed (kornbluth.freenode.net (Nickname regained by services))]
nirved has joined #lisp
vutral has joined #lisp
nly has joined #lisp
<beach>
flip214_: Do you have time for a question related to your remarks on CLOSOS?
frgo has joined #lisp
jcowan has joined #lisp
eagleflo_ is now known as eagleflo
<flip214_>
beach: yes! here, by mail, private message, phone, ...?
<beach>
Here
<beach>
You say that ASLR is irrelevant to my address-space argument. I don't understand why.
<flip214_>
one sec... page or section?
<flip214_>
ah sorry, CLOSOS. I took the SICL pages out of the closet.
frgo has quit [Remote host closed the connection]
<flip214_>
ah, yeah.
<flip214_>
beach: ASLR is irrelevant for the "historical reasons", and also " does not take great care to prevent a temporary buer from overowing,
<flip214_>
sorry, the "ff" ligatures don't come across...
<beach>
Hold on. Your remark covers my text...
<flip214_>
using okular you can move the comment around ... or look at the text sources?
<beach>
I got it.
<flip214_>
so yeah, ASLR helps _a_small_bit_ re security -- but as soon as you can overwrite a buffer or cause other misbehaviour, you more or less have lost. even if the program "only" crashes, it's a very easy DOS.
<beach>
But that's not my point
<beach>
I still think it is relevant. ASLR attempts to prevent some code from sticking a different return address on the stack by making that return address randomly different.
<beach>
And putting a different return address on the stack is possible because the process has full access to its address space, including the stack.
<beach>
So if the process did not have access to its stack, this kind of attack would not be possible and ASLR would not be necessary.
<flip214_>
beach: I thought that your main point in 1.2.4 is that full-address-space access is because of historical reasons, and has quite some security implications - some of which might get better with ASLR.
<beach>
Sure.
<flip214_>
but then you propose an architecture where _all_ things run in the same address space, and could potentially read each others secrets.
<beach>
No they can't
<flip214_>
so ASLR is not an argument for your architecture, because it's irrelevant.
<flip214_>
beach: in your architecture, they won't, but that's not a feat of ASLR. _that's_ why I think ASLR is irrelevant for CLOSOS.
<beach>
It was not meant to be an argument for my architecture. It was meant to be a description of a kludge that was invented to improve security in a system where the process has full access to its address space.
<beach>
Maybe I just need to make it clearer that that's what I meant.
orivej has joined #lisp
<beach>
flip214_: OK, thanks. I'll re-read what I wrote and see if I can fix it.
<beach>
I'll have more questions later.
<beach>
Thanks again.
<flip214_>
beach: I suggested to shorten the ASLR paragraph (and not remove it), so that it's not forgotten.
<flip214_>
beach: you're welcome, of course.
<beach>
Yes, I saw your suggestion. I'll work on it.
<pillton>
mrblack: In can set where emacs looks up pages by changing common-lisp-hyperspec-root i.e. (setq common-lisp-hyperspec-root "file:///my-fancy-nick/contrib/hyper-spec-7.0/HyperSpec/")
<pillton>
You can .... (it is late)
<flip214_>
when using FORMAT iteration ~:{ ~a ~a ~}, can I make the second element optional, eg. for an input '((1 2) (2 3) (4)) ?
<flip214_>
SBCL says "FORMAT: no more arguments"
<jackdaniel>
flip214_: maybe ~:{ ~{ ~a~^ ~} ~} ;?
<jackdaniel>
not exactly what you've asked, but maybe what you want
<mrblack>
thank you MetaYan, pillton
foom has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Remote host closed the connection]
mrblack has left #lisp ["Leaving"]
foom2 has quit [Ping timeout: 276 seconds]
mrblack has joined #lisp
ACE_Recliner_ has quit [Remote host closed the connection]
scymtym has quit [Ping timeout: 260 seconds]
<mrblack>
Does anyone know why I'm getting an error here? "(equal '(1 2 3) (cons 1 (cons 2 (cons 3))))". I'm using sbcl, and this is a direct copy from the book Land of Lisp (I usually type, but I copy pasted just to check after getting the error). Here are the environment and errors: https://hastebin.com/yimevowome.php
<pillton>
(cons 3 nil)
<pillton>
The function cons requires two arguments.
Kundry_Wag has joined #lisp
shrdlu68 has joined #lisp
<jackdaniel>
mrblack: fyi there is also #clschool channel
<mrblack>
pillton, so "1" is one argument and "(cons 2 (cons 3))" is another, is that it?
<mrblack>
pillton, ah got it. of course.
<mrblack>
pillton, so the "nil" here is just filling space to avoid an error?
<flip214_>
jackdaniel: ~:{ ~a ~^ ~a ~} works too
<pillton>
mrblack: No nil is the empty list.
<mrblack>
jackdaniel, thank you, joined. But there's only 40 people there :/
<jackdaniel>
mrblack: I'm certain that 40 people there will be more interested in basics than 316 people here
<mrblack>
jackdaniel, maybe so
<jackdaniel>
as of cons, it is a two-argument function. lists defined recursively as NIL or cons
<jackdaniel>
lists are defined*
<flip214_>
hmmm no, it doesn't: (format t "~:{~a:~^ ~a~%~}" '((1 2) (2 3) (4) (5 5)))
<flip214_>
no newline after 4:
<jackdaniel>
cons of element and the rest of the list*
Guest75806 has joined #lisp
<mrblack>
jackdaniel, I understand that "nil" is the empty list, but what I really wanted to know is why it's necessary in the example...
<mrblack>
other than syntax
<pillton>
You have (cons 3).
<jackdaniel>
you call cons, cons is a two-argument function
moei has joined #lisp
Lycurgus has joined #lisp
m00natic has quit [Read error: Connection reset by peer]
shifty has quit [Ping timeout: 245 seconds]
esrse has quit [Ping timeout: 245 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
Kundry_Wag has quit [Ping timeout: 245 seconds]
rixard has joined #lisp
kajo has quit [Ping timeout: 252 seconds]
Lycurgus has quit [Ping timeout: 264 seconds]
Selwyn has joined #lisp
pierpal has joined #lisp
Lycurgus has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
Guest75806 has quit [Ping timeout: 252 seconds]
zxcvz has joined #lisp
Bike has joined #lisp
Selwyn has quit [Remote host closed the connection]
Guest75806 has joined #lisp
Kundry_Wag has joined #lisp
rumbler31 has joined #lisp
xkapastel has joined #lisp
Kundry_Wag has quit [Ping timeout: 252 seconds]
nowhere_man has joined #lisp
Guest75806 has quit [Ping timeout: 246 seconds]
solyd has quit [Quit: solyd]
rumbler31 has quit [Remote host closed the connection]
warweasle has joined #lisp
solyd has joined #lisp
moei has quit [Ping timeout: 245 seconds]
solyd has quit [Quit: solyd]
solyd has joined #lisp
<edgar-rft>
mrblack: (list 3) == (cons 3 nil) if that's what you want to know
<fiddlerwoaroof>
Xof: I guess that means the patch I submitted is unlikely to be accepted :)
Inline has joined #lisp
nowhere_man has quit [Ping timeout: 276 seconds]
cage_ has joined #lisp
nowhere_man has joined #lisp
Josh_2 has joined #lisp
Bike has joined #lisp
wanz has joined #lisp
atgreen has joined #lisp
himmallright has joined #lisp
<Xof>
fiddlerwoaroof: well, I'm less certain than I used to be about the outwardly-portable conservative interpretation of the spec (and other developers are more radical in various directions than I am)
<Xof>
fiddlerwoaroof: but you can make progress by making your own method combinations with the * method-group
<Xof>
or by keeping your patch around
solyd has quit [Quit: solyd]
dale has joined #lisp
fikka has quit [Ping timeout: 245 seconds]
libre-man has quit [Ping timeout: 268 seconds]
<mrblack>
edgar-rft, I don't think I got to the "list" function with that syntax, but I get your point
fikka has joined #lisp
solyd has joined #lisp
solyd has quit [Client Quit]
wheelsucker has joined #lisp
solyd has joined #lisp
angavrilov has quit [Remote host closed the connection]
angavrilov has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
solyd has quit [Client Quit]
Inline has quit [Remote host closed the connection]
relaxed has quit [Ping timeout: 268 seconds]
heisig has quit [Quit: Leaving]
libre-man has joined #lisp
Inline has joined #lisp
m00natic has joined #lisp
wanz has quit [Remote host closed the connection]
Lord_of_Life has joined #lisp
pierpal has joined #lisp
solyd has joined #lisp
atgreen has quit [Ping timeout: 264 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
solyd has quit [Quit: solyd]
Cymew has quit [Remote host closed the connection]
rumbler31 has joined #lisp
<makomo>
'ello
kdas_ has joined #lisp
<beach>
Hello makomo.
fikka has joined #lisp
kushal has quit [Ping timeout: 256 seconds]
<makomo>
hi :-)
rumbler31 has quit [Ping timeout: 244 seconds]
frgo has quit [Ping timeout: 264 seconds]
shrdlu68 has quit [Ping timeout: 246 seconds]
cage_ has quit [Remote host closed the connection]
aydio has joined #lisp
sunset_NOVA has quit [Quit: leaving]
pillton has quit [Read error: Connection reset by peer]
aydio has quit [Quit: WeeChat 2.2]
fikka has quit [Ping timeout: 244 seconds]
johnjay has joined #lisp
eddof13 has joined #lisp
cage_ has joined #lisp
johnjay has quit [Client Quit]
aydio has joined #lisp
rippa has joined #lisp
LiamH has joined #lisp
fikka has joined #lisp
steiner has left #lisp ["ERC (IRC client for Emacs 26.1)"]
kdas_ is now known as kushal
frodef has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 252 seconds]
fikka has joined #lisp
<fiddlerwoaroof>
Xof: yeah, although I'd think that the same reasoning that allows * to "ignore the rules" should apply when * is part of a qualifier pattern
nowhere_man has quit [Ping timeout: 252 seconds]
jochens_ has quit [Remote host closed the connection]
jochens has joined #lisp
aydio has quit [Quit: WeeChat 2.2]
DataLinkDroid has quit [Ping timeout: 256 seconds]
pierpal has quit [Ping timeout: 240 seconds]
DataLinkDroid has joined #lisp
jochens has quit [Ping timeout: 250 seconds]
Lycurgus has quit [Quit: Exeunt]
pierpal has joined #lisp
aydio has joined #lisp
meepdeew has joined #lisp
jmercouris has joined #lisp
anewuser has quit [Quit: anewuser]
frodef has joined #lisp
<mrblack>
I'm trying to understand this function: https://hastebin.com/onugivohev.pl . What is does: tells me if there's and object on a given location. I understand what "assoc" and "cadr" are doint. What I don't understand is where the value for the parameter (obj) comes from, what is its value?
<jackdaniel>
this is a good question for clschool (again ,p). remove-if-not takes two arguments: a predicate and a sequence
<jackdaniel>
then it applies each element in the sequence to the predicate (your obj), and if predicate returns T, element is kept, otherwise it is removed from said sequence
<mrblack>
I made this questions there, but the one person who was helping me had to leave
<jackdaniel>
so remove-if-not returns a sequence with all elements in it which met the predicate
<jackdaniel>
as of asking questions, sometimes it is worth waiting a little more or try things by yourself.
<mrblack>
jackdaniel, I have read this resource before. I did my due diligence. But thanks.
<pfdietz>
remove-if-not is like the function filter in scheme
<mrblack>
I'm fine with this part, the trouble I'm having is with "at-loc-p (obj)"
<pfdietz>
One thing to be clear about: remove-if-not is nondestructive. It does not modify its argument (although the return value may share structure with that argument).
<jackdaniel>
mrblack: remove-if-not applies function at-loc-p to elements which are in the second argument
<jackdaniel>
so obj represent element from that sequence
<pfdietz>
All lisp variables can be thought of as pointers (although for numbers or characters, the things being pointed to can be copied at any time, at least conceptually).
<mrblack>
I'm honestly considering if I'm smart enough for this
<pfdietz>
That wasn't what you were asking though. nvm
<jackdaniel>
minion: tell mrblack about gentle
<minion>
mrblack: please see gentle: "Common Lisp: A Gentle Introduction to Symbolic Computation" is a smoother introduction to lisp programming. http://www.cs.cmu.edu/~dst/LispBook/
<pfdietz>
What that code is doing is removing every object from the sequence objs for which the loc of that object (as defined by the association list obj-locs) is eq to loc.
<mrblack>
minion, more gentle than Land of Lisp? It has cartoons!
<pfdietz>
Could also write (remove loc objs :key (lambda (obj) (cadr (assoc obj obj-locs))) :test 'eq)
<mrblack>
anyway, what I'm not understanding is here does the "obj" the appears in the the definition of at-loc-p(obj) comes from... because it is not entered by the main function, which have these arguments: "(loc objs obj-locs)"
<Bike>
remove-if-not calls at-loc-p.
<Bike>
sort of like mapcar, if you've used mapcar.
<pfdietz>
mrblack: that "obj" is a formal parameter of the internal function defined by the labels form.
<mrblack>
pfdietz, but what is it's value gives its value in (cadr (assoc obj obj-locs))? what does it do????
<Bike>
have you used mapcar? that might be an easier introduction to higher level functions.
<pfdietz>
remove-if-not calls at-loc-p on each element of the sequence. For each call, obj is bound to that element.
<mrblack>
I have used mapcar
<pfdietz>
So, if objs was the list (a b c) then at-loc-p would be called on a, then on b, then on c.
<mrblack>
I did not write this function, it's in a book
<Bike>
Okay, so say you have (labels ((oneplus (x) (1+ x))) (mapcar #'oneplus '(1 2 3))), do you know what that would return?
<mrblack>
I have no idea
<Bike>
Do you know what (mapcar #'1+ '(1 2 3)) would return?
<Bike>
1+ itself adds one to a number. so (1+ 347) => 348, and so on
<mrblack>
it would add to each of those?
<mrblack>
like 1+1, 1+2, 1+3?
<Bike>
can you write out the list it would return?
<mrblack>
no
<Bike>
okay, well, you have the right idea. it would return (2 3 4)
<Bike>
(mapcar #'1+ '(1 2 3)) is kind of like (list (1+ 1) (1+ 2) (1+ 3)); mapcar calls the 1+ function on each element of the list.
<mrblack>
okay
<pfdietz>
The key there is 1+ is getting called more than once.
<Bike>
Okay, so with the labels form, we're introducing our own function, oneplus.
<mrblack>
okay
<Bike>
oneplus has one parameter, x, and just does (1+ x), so it's basically just an alias.
nicksmaddog has joined #lisp
<Bike>
mapcar calls oneplus on each argument the same way (mapcar #'1+ ...) would call 1+, and puts the results in a list.
<Bike>
so (labels ((oneplus (x) (1+ x))) (mapcar #'oneplus '(1 2 3))) would also return (2 3 4).
<Bike>
the "X" gets its value when mapcar calls the oneplus function.
<pfdietz>
oneplus is called more than once, and on each call 'x' is bound to a different value (1, then 2, then 3).
<mrblack>
okay, I can understand that
<Bike>
remove-if-not calls its function argument on each element of the list it's given in the same way. so that's where the obj argument comes from.
angavrilov has quit [Read error: Connection reset by peer]
jmercouris has quit [Ping timeout: 240 seconds]
jmercouris has joined #lisp
<mrblack>
what is the remove-if-not function argument?
nicksmaddog has quit [Ping timeout: 244 seconds]
<Bike>
#'at-loc-p
<mrblack>
so remove-if-not gets its argument from the very function it is calling?
<Bike>
No. Listen. (remove-if-not #'at-loc-p objs) is a function call. the REMOVE-IF-NOT function receives two arguments, #'at-loc-p and objs. #'at-loc-p is a function and an argument. that's the "function argument" i meant.
fikka has quit [Ping timeout: 264 seconds]
<mrblack>
okay
<mrblack>
I'm stupid
<Bike>
So with (remove-if-not #'at-loc-p objs), remove-if-not will call the at-loc-p function on each element of the objs.
<Bike>
In the same way (mapcar #'1+ list) calls 1+ on each element of the list.
<mrblack>
I'm starting to feel embarassed
<pfdietz>
In C, you can pass function pointers to other functions. This is something like that.
<pfdietz>
(not exactly, but close)
<pfdietz>
#'at-loc-p is a value that can be computed before calling at-loc-p. It doesn't come from a call to that function, but rather is something like a pointer to that function.
nowhere_man has joined #lisp
<Bike>
you're new. it's natural to ask questions.
<Bike>
gentle introduction covers this stuff. i don't know about land of lisp.
<pfdietz>
It might be helpful to consider a case where the function being passed is defined by defun, rather than inside another function using labels.
<mrblack>
I don't know, man, this book feels a little unfair. He/She trows a of of things at me... I don't know it it's all like that. But this "recursion hell" (don't even know if that is recursion) should be better explained.
<Bike>
it's not recursion.
<pfdietz>
No function calls itself (directly or indirectly) here.
johnjay has joined #lisp
emaczen has joined #lisp
jfb4 has quit [Ping timeout: 252 seconds]
pierpal has quit [Read error: Connection reset by peer]
anamorphic has joined #lisp
<mrblack>
so the execution isn't linear?
<mrblack>
I mean
<mrblack>
remove-if-not is excecute first because it's function making the call?
<pfdietz>
Right.
<mrblack>
okay. That makes sense.
Lord_of_Life_ has joined #lisp
<mrblack>
Why didn't the book say that! I'm getting angry here
<pfdietz>
The labels form has the definition of at-loc-p, but that definition isn't invoked up there. It's just defined there.
<mrblack>
okay
sauvin has quit [Read error: Connection reset by peer]
<pfdietz>
Execution falls down into the body of the labels form, which is the call to remove-if-not. THAT function then calls at-loc-p on each element of the sequence objs.
Lord_of_Life has quit [Ping timeout: 240 seconds]
<pfdietz>
And the value returned by the call to remove-if-not is the value returned by the labels form, and then from the call to objects-at.
myrkraverk has joined #lisp
<pfdietz>
A function definition, like that in labels, doesn't start executing the function, it just wraps it up in a nice package that other things can call.
fikka has joined #lisp
<mrblack>
pfdietz, you should write books, my friend
<pfdietz>
ty (also Bike)
<mrblack>
yep
<mrblack>
also Bike ;)
<pfdietz>
One tricky thing there you should understand: where do loc and obj-locs come from inside the definition of at-loc-p?
<mrblack>
pfdietz, I think those are parameters supplied from outside the function... either user input or from another function
<pfdietz>
Those are the reasons that code is using labels, rather than defining at-loc-p outside in a defun.
<mrblack>
what? what I said?
<pfdietz>
Yes
<mrblack>
That means I got one right? Yay!
<mrblack>
I was almost giving up
<pfdietz>
So each call to at-loc-p is seeing those same two variables. Unlike the parameter obj, which is new on each call to at-loc-p.
<mrblack>
pfdietz, yeah, they are the same variables, but the values will change, right?
<mrblack>
is that what functional programming means?
<pfdietz>
In this case, their values are not changing.
<mrblack>
I see
<mrblack>
They'll be always created by (eq (cadr (assoc obj obj-locs)) loc)?
<mrblack>
is that what you mean?
<pfdietz>
Functional programming basically means (1) no assignment statements or other operations with side effects, and (2) using functions as values. This example is functional programming, yes.
<pfdietz>
That (eq ...) form doesn't create anything.
<pfdietz>
assoc looks up an element of an association list; cadr pulls out a value from that element, and eq compares. No objects are being modified, no variables are being assigned to.
<mrblack>
great
<mrblack>
awesome
anamorphic has quit [Quit: anamorphic]
<pfdietz>
Lisp *does* support imperative (the opposite of functional) programming. It has destructive operations and assignments. But this example does not use any of that.
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
<mrblack>
cool
<mrblack>
thanks a lot... I was getting desperate here...
<pfdietz>
Glad to help.
<mrblack>
lisp is so different it is like learning Japanese sometimes :P Only dabbled with C and Pascal before
<pfdietz>
Pascal has something like labels!
<pfdietz>
Functions defined inside other functions.
<mrblack>
hahaha
<mrblack>
I like Pascal, but it doesn't have much use. My professor used to teach algorithms for a while (it was actually a Portuguese "translation" people here use to teach newcomers)
<pfdietz>
Lisp lets you do something new, though: you can define a function inside another function, then return it. This is illegal in Pascal; there functions can only be passed "downward" as arguments to other functions, not stored or returned. There's an implementation reason for this (not important now).
Kaisyu has quit [Quit: Connection closed for inactivity]
jmercouris has quit [Ping timeout: 272 seconds]
<mrblack>
yeah... lisp is cool :)
<mrblack>
I was going to do that Build your Own Lisp thing
<mrblack>
pfdietz, You may not be writing books, but you're already being quoted :)
<pfdietz>
Ok :)
<makomo>
mrblack: org mode, nice! :-)
<makomo>
pfdietz: the funarg problem?
<makomo>
using emacs + org-mode + git to maintain notes for various stuff is awesome
<pfdietz>
makomo: yes
m00natic has quit [Remote host closed the connection]
<mrblack>
Org + babel are awesome to study programming.
jmercouris has joined #lisp
solyd has joined #lisp
Lycurgus has joined #lisp
anamorphic has joined #lisp
lumm has quit [Read error: Connection reset by peer]
lumm has joined #lisp
meepdeew has quit [Remote host closed the connection]
epr0xe has joined #lisp
ggole has quit [Quit: ggole]
terpri has joined #lisp
pierpal has joined #lisp
terpri_ has quit [Ping timeout: 252 seconds]
jmercouris has quit [Remote host closed the connection]
anamorphic has quit [Quit: anamorphic]
rozenglass has joined #lisp
vlatkoB has quit [Remote host closed the connection]
solyd has quit [Quit: solyd]
nly is now known as nly_
nly_ is now known as nly
francogrex has joined #lisp
fikka has quit [Ping timeout: 276 seconds]
<emaczen>
How does a lisp programmer typically use gdb after an executable is built?
<johnjay>
makomo: how do you use emacs + org-mode + git to maintain notes for various stuff?
<emaczen>
I don't have experience with gdb when writing a C program either... but thats what you usually see
<makomo>
johnjay: use emacs along with org-mode to write your notes and git to version control them, that's about it :D
<makomo>
then if you want your notes somewhere else, just clone the repository and voila
<emaczen>
johnjay: ask in #emacs but look at magit mode for convenient key bindings for common git commands
<makomo>
oh yeah, + magit as well :_)
<makomo>
:-)*
eddof13 has quit [Quit: eddof13]
<johnjay>
makomo: i thought you had a system for annotation source code which i've been thinking about lately
<johnjay>
i hate the bs inline stuff of javadoc and oxygen where you put @doc_string_with_long_name lots_of_text every other line
<johnjay>
*doxygen
<makomo>
johnjay: ah, nope. another benefit of having your notes in plain text is that they're easily searchable using tools like grep, etc.
<makomo>
but usually you'll do most of the editing from within emacs
<johnjay>
makomo: i did come up with one idea though. You've heard of literate programming right?
<makomo>
johnjay: yup
<johnjay>
well my idea was to modify it to where you don't make it say the full source
<johnjay>
instead you make a literate prog file which has notes, and mentions only a subset of lines of the source
<Inline>
welp, texmacs was once ok
<johnjay>
then when you process it you just match it line-by-line to the source file to check it
<johnjay>
so for example if you have lines A,B,C,D in your file then your literate notes produce only A and C
<makomo>
johnjay: what does "check" here mean? if i'm understanding correctly, wouldn't you have to maintain the alignment of the positions of text within both of the files?
<johnjay>
no that's the idea
<johnjay>
you would just check that line A precedes line C
<johnjay>
the idea is not to be perfect but just to have some kind of notes that can match the source
<makomo>
hm, so what does "mentions only a subset of lines of the source" mean?
<johnjay>
well just what it sounds like
<makomo>
like literally have parts of the source in those "note files", just for the purposes of matching?
anamorphic has joined #lisp
<johnjay>
if your file is #include int main() { printf("hello"); printf("world"); return 0; }
<jcowan>
pfdietz: Technically a program can change state and still be functional if the state is not visible to the program
<johnjay>
then your literate notes might say "this is a file that prints hello with the lines printf(hello); printf("world");" then it matches those two
<jcowan>
a program that does a debug-print operation on the console is functional if (as usual) there is no way to read back console output
<johnjay>
the only edges case i thought of is what if you repeat a line which changes something
asymptotically has quit [Remote host closed the connection]
<johnjay>
makomo: right because you can add or delete lines in a source file, that's relatively common with source control
<johnjay>
so i was thinking this method might work as long as those changes aren't too bad
<makomo>
johnjay: right, but you still have to keep them in sync, although not fully, just in parts
asymptotically has joined #lisp
<johnjay>
that's the idea
<johnjay>
if you just have the lines hello and world from my example you can still keep it in sync
<johnjay>
even if more lines were inserted
<johnjay>
the problems only come about when those extra lines change things...
<jcowan>
another case is a program that has been instrumented to update a profile counter when some function is called; since the profile counters are invisible to the code, the functions are still functional
<makomo>
johnjay: i guess the details would then depend on the matching algorithm or whatever
<johnjay>
makomo: well the algorithm is just checking the lines exist in order
<johnjay>
i'm not sure if there's a better way though
<johnjay>
maybe if too many lines get inserted it flags it as a "change"?
<makomo>
hmm, idk
<johnjay>
e.g. between printf('hello') and printf('world') 10 lines of Qt code were added or something
nly is now known as pig
<johnjay>
this is just an idea i thought of, i don't know if it's that viable.
<johnjay>
but i like the idea of maintaining notes on source code
pig is now known as nly
fikka has joined #lisp
<makomo>
same, but i always wonder whether literate programming is feasible. it seems like a good idea to me, but i've never actually tried it on a bigger project
anamorphic has quit [Quit: anamorphic]
<johnjay>
yeah that was why i thought this might work, because with literate programming any change necessitates updating the literate source
void_pointer has joined #lisp
<johnjay>
but maybe if you ask for less you can use it this way, to just kind of maintain some basic notes on something
<johnjay>
thus the main file would change less
rozenglass has quit [Read error: Connection reset by peer]
<makomo>
did you watch the literate programming talk by tim daly?
<johnjay>
i guess the essence of my idea was that the more fixed the code the more literate you can make it
nly is now known as y
fikka has quit [Ping timeout: 246 seconds]
pierpal has quit [Ping timeout: 240 seconds]
y is now known as nly
<johnjay>
so maybe you could have 3 levels: full lp for old unchanging code, my hybrid version for code that's mostly done , and then like notes matching to specific line numbers for WIP
<makomo>
the hybrid version that uses matching could somehow work, i guess. but the last approach would be too burdensome i think
<johnjay>
that's why it's for WIP
<makomo>
well, unless you use a tool to help you edit the line numbers or something
<johnjay>
as in code that you're actively changing anyway
<makomo>
right, but that's even worse, because then you have to keep changing those line numbers
<makomo>
it would surely get annoying real quick
<johnjay>
well the tool would track the line number
<makomo>
right, so the tool is the important part :-)
<makomo>
we need more tools for literate programming
<makomo>
more standardized ones, really
<johnjay>
no the important part is choosing the *right* tool
<johnjay>
as in, the more likely the code is to change the less lp you apply to it
<johnjay>
so maybe i had it wrong, maybe you wouldn't even document WIP at all
<johnjay>
yeah i tried compiling noweb on msys and it completely barfed
<francogrex>
hi can I make a region executable by using mprotect? for example if i use cffi foreign-alloc or make pointer, can I make it protected and executable?
<johnjay>
there's a game programming project i'm familiar with and i despair of any kind of documentation for it
<johnjay>
basically you have constant churn as bugs are discovered and fixed so nothing is really "safe" from modification
fikka has joined #lisp
pjb has joined #lisp
<makomo>
johnjay: yeah, it gets hard to keep up the "book" up to date with so many modifications
cage_ has quit [Quit: Leaving]
anamorphic has joined #lisp
<makomo>
that's why i feel like literate programming is great for stuff that has been "solved", i.e. the idea was thought through, a good design was developed and it won't be changing much
<makomo>
there are a few literate books: knuth's tex, elliptic curve crypto, understanding mp3 and physically-based rendering
<makomo>
(...) books that i know of*
eddof13 has joined #lisp
<makomo>
all of them talk about something "solved", i.e. something that has been analyzed, discussed, specified, etc.
<makomo>
not about something that's constantly changing
francogrex has quit [Remote host closed the connection]
<myrkraverk>
Yeah, LP doesn't suit well with stuff that's constantly changing.
anamorphic has quit [Client Quit]
<jcowan>
Sure it does. You just have to accept down in your bones that changing the prose is just as important as changing the code.
<myrkraverk>
johnjay: I've compiled noweb on arcane systems before, and I don't remember if I had any problems.
<makomo>
that's what makes me wonder whether LP will ever work
epr0xe has quit [Quit: epr0xe]
fikka has quit [Ping timeout: 268 seconds]
<makomo>
jcowan: hm i guess, yeah. a mindset/"lifestyle" change is needed as well
<myrkraverk>
It works when the person writing it can write prose as well as code.
<myrkraverk>
It doesn't work well if the person can only write code, or only write prose.
<jcowan>
Prose is easier than code, really, because computers are still dumber than humans.
<makomo>
also, that, yes. the demands for LP are a bit higher than usual. you have to be a good writer
<myrkraverk>
jcowan: it's a different skillset. Many programmers can't write comprehensibel english.
<myrkraverk>
And the people who write comprehensible English aren't necessarily coders.
<jcowan>
I grant the latter, but not the former (modulo the language in use)
<jcowan>
I couldn't write an LP in Russian, obvs
<myrkraverk>
(I have a feeling my English skills are deteriorating)
stereosphere has joined #lisp
Lord_of_Life_ is now known as Lord_of_Life
Lord_of_Life has quit [Changing host]
Lord_of_Life has joined #lisp
<johnjay>
makomo: that's what my idea fixes though
<johnjay>
it specifically is only using lp in small pieces for code you know fairly well won't change
vibs29 has quit [Ping timeout: 250 seconds]
<johnjay>
anyway i haven't tested it so
<johnjay>
these are just ideas
<myrkraverk>
I recently tried LP for a hello world project.
<myrkraverk>
To get a feel for cweb
vibs29 has joined #lisp
atgreen has joined #lisp
nixfreak has joined #lisp
rozenglass has joined #lisp
<nixfreak>
is it possible to reverse the REPL using slime to got back to previous code ?
<pjb>
nixfreak: also, with normal REPL you can use (DRIBBLE "file") but it doesn't work with slime since it uses custom threads to implement the REPL itself. One could patch swank to log the expressions (and results) like with DRIBBLE.
<nixfreak>
I like using slime , unless there is something for neo vim thats better ?
fikka has joined #lisp
orivej has quit [Ping timeout: 240 seconds]
zxcvz has quit [Quit: Leaving]
fikka has quit [Ping timeout: 246 seconds]
Kabriel has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
<pjb>
nixfreak: with slime, you have the whole slime buffer keeping the history. You can also just save it with C-x C-s
<pjb>
it's emacs!
<nixfreak>
yep
fsmunoz has joined #lisp
fikka has joined #lisp
anamorphic has joined #lisp
<void_pointer>
Only thing to be aware of is that when you use a previous code at the REPL, you can't add newlines to it
<void_pointer>
Or at least, if you can, I haven't figured out how yet
anamorphic has quit [Client Quit]
fikka has quit [Ping timeout: 252 seconds]
anamorphic has joined #lisp
fikka has joined #lisp
<fiddlerwoaroof>
emaczen: typically one doesn't use gdb on a common lisp program, unless you're doing ffi stuff
<fiddlerwoaroof>
The implementation's debugger covers most of the necessary functionality
<flip214_>
Can I get the current input position (in bytes) from CXML? I'd really like to create an index (tag => position, length) into a large XML file, and then do "random" IO on it.
<emaczen>
fiddlerwoaroof: I am using ffi
<fiddlerwoaroof>
Well, you can try starting gdb and then using attach <PID> to attach to an existing process
orivej has joined #lisp
<fiddlerwoaroof>
Then do something like `break interesting_function` and then `continue`
fikka has quit [Ping timeout: 240 seconds]
<fiddlerwoaroof>
However, I've found that various things about sbcl and ccl can make this really painful
<fiddlerwoaroof>
You can also do `gdb my_program` and then `run may arguments ...` inside gdb
<fiddlerwoaroof>
This lets you set the breakpoints before starting the program
<fiddlerwoaroof>
Finally, there's `ulimit -c unlimited; my_program; gdb my_program core_file` which lets you inspect the state of a process at the time that it crashed
<fiddlerwoaroof>
The most useful gdb command is `bt` that shows a backtrace of the program being debugged.
<fiddlerwoaroof>
Anyway, I hope this is slightly helpful :)
Lycurgus has quit [Ping timeout: 264 seconds]
<fiddlerwoaroof>
Googling for <implementation> gdb might turn up some useful tips too
<emaczen>
fiddlerwoaroof: Thanks, I have no idea how to debug my C sockets....
<flip214_>
nixfreak: for vim8 and neovim there's slimv and/or vlime.
<jasom>
I personally find that slime+evil-mode is better than slimv or vlime, but ymmv.
<nixfreak>
ok cool thanks
<nixfreak>
I'm just going through the practical common lisp book i was just curious
<flip214_>
jasom: I tried to use evil mode a few times in the past... but there's too much that doesn't work to make me comfortable.
earl-ducaine has quit [Read error: Connection reset by peer]
<mrblack>
flip214_, did you also used the Evil Collection?
<flip214_>
eg. "Ctrl-C" should clear the cmdline, but it doesn't.
<flip214_>
mrblack: I just tried to follow the evil mode installation instructions
flip214_ is now known as flip214
<emaczen>
Does mallocing a pointer inside a lisp function and freeing it from the calling function cause a memory leak?
<Bike>
a memory leak is when you fail to free memory. so if there's some way for things to go so that the freeing never occurs that's a leak
<void_pointer>
As long as it is freed somewhere, it shouldn't cause a memory leak. That all said, in that case (as well as pretty much any case), you do need to make sure you have things setup such that it will for sure be freed once but no more than once because double free doesn't go well
fikka has joined #lisp
<Bike>
for instance, if the mallocing function signals an error, which goes to the debugger, and then you quit the debugger back to the repl
<void_pointer>
unwind-protect can help avoid that sort of problem
scymtym has quit [Ping timeout: 260 seconds]
<void_pointer>
or if you have the pointer in some containing object and put a finalizer on the containing object that has a copy of the pointer it will run free with (one does then need to be careful to not free it manually without removing the finalizer or otherwise disabling it in order to avoid double-free)
<emaczen>
Bike: I'm not getting any frequent errors to eat up MBs
<Bike>
there are tons of ways to get a memory leak, i just invented a common one
<flip214>
well, freeing in the outer function has the problem that the pointer to the memory-to-be-freed has to be communicated somehow... and if the inner function crashes before that, the outer won't know what to free
<void_pointer>
another issue is if the pointer points to a structure that itself has malloc'ed pointers. Freeing the first pointer doesnt reclaim the memory of those it was pointing to
<emaczen>
Well my this function returns a pointer, and then at the end of the calling function it frees the pointer -- I don't see how I can leak that much...
fikka has quit [Ping timeout: 246 seconds]
Josh_2 has quit [Ping timeout: 246 seconds]
<void_pointer>
The one exception here is if you are using something like bdwgc and you use its malloc in which case you would be OK. If your implementation uses bdwgc or something similar and you are using the malloc the implementation provides, then there is a good chance you are using its malloc instead of libc malloc.
<flip214>
void_pointer: another exception is using hierarchical memory pools, like subversion does.
<void_pointer>
ECL uses bdwgc last I checked. SBCL, CCL, and CMUCL don't. Don't know about Clisp or Clasp
<emaczen>
void_pointer: the pointer I am freeing is really just an array of bytes
<emaczen>
void_pointer: I'm using whatever malloc defcfun gives me?
<nirved>
void_pointer: in slime repl - delete the last closing paren, and then can edit the rest with adding newlines
<Bike>
emaczen: if this is leaking, there is a path from the malloc that does not lead to the free, which you will have to find and excise.
<void_pointer>
emaczen: then unless you are one one implementation only, you can't assume much. Also, that is good you don't have to worry about pointer nesting.
<Bike>
that's about the shape of it.
<void_pointer>
nirved: that is good to know. Thank you
<void_pointer>
flip214: didn't know about those
<emaczen>
Bike: Yeah, I am trying to reorder some function calls now...
fikka has joined #lisp
<fiddlerwoaroof>
I think there's a way to transparently replace malloc with one that warns you about unfreed memory
anamorphic has quit [Quit: anamorphic]
fikka has quit [Ping timeout: 264 seconds]
<jasom>
fiddlerwoaroof: such tools often don't play nicely with managed runtimes.
meepdeew has joined #lisp
anamorphic has joined #lisp
himmallright has quit [Ping timeout: 240 seconds]
PuercoPop has joined #lisp
scymtym has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Remote host closed the connection]
wheelsucker has quit [Remote host closed the connection]
no-defun-allowed is now known as theemacsshibe[m]
fikka has quit [Ping timeout: 268 seconds]
makomo has quit [Ping timeout: 244 seconds]
fikka has joined #lisp
atgreen_ has joined #lisp
ryan_vw has joined #lisp
atgreen has quit [Ping timeout: 252 seconds]
Lycurgus has quit [Quit: Exeunt]
Bike has quit [Quit: Page closed]
nirved has quit [Quit: Leaving]
anamorphic has quit [Quit: anamorphic]
eddof13 has quit [Quit: eddof13]
anamorphic has joined #lisp
pjb has quit [Ping timeout: 250 seconds]
asymptotically has quit [Quit: Leaving]
eddof13 has joined #lisp
varjag has quit [Ping timeout: 252 seconds]
pillton has joined #lisp
shifty has joined #lisp
aydio has quit [Quit: WeeChat 2.2]
frgo has joined #lisp
nckx- is now known as nckx
frgo has quit [Ping timeout: 264 seconds]
rumbler31 has joined #lisp
anamorphic has quit [Quit: anamorphic]
sjl has quit [Quit: WeeChat 2.2-dev]
<phoe>
fiddlerwoaroof: it's nontrivial to detect "unfreed" memory
<oni-on-ion>
the 'random bits' of memory, is this like that from the computer just powering up the chips? i mean, they dont start at 0 right, they've got to be 'set' in software?
aydio has joined #lisp
<phoe>
in general, memory can be allocated and freed in arbitrary parts of the program; it's hard to tell malloc "warn me if I don't call free on this piece of memory by the time I leave this lexical/dynamic/??? scope" unless you employ other tactics, such as unwind-protect
<oni-on-ion>
=)
Essadon has quit [Quit: Qutting]
LiamH has quit [Quit: Leaving.]
acolarh has quit [Ping timeout: 268 seconds]
Lord_of_Life has quit [Ping timeout: 246 seconds]
theemacsshibe[m] is now known as no-defun-allowed
sjotten has quit [Ping timeout: 272 seconds]
Bike has joined #lisp
acolarh has joined #lisp
pierpa has joined #lisp
eddof13 has quit [Quit: eddof13]
pjb has joined #lisp
lumm has quit [Quit: lumm]
lumm has joined #lisp
<no-defun-allowed>
i made #netfarm (which is bridged to the matrix #netfarm:matrix.org) cause most of the talk around it isn't useful to the average lisper imo
frodef has quit [Ping timeout: 252 seconds]
rozenglass has quit [Ping timeout: 240 seconds]
kajo has quit [Quit: From my rotting body, flowers shall grow and I am in them and that is eternity. -- E. M.]
lumm has quit [Ping timeout: 252 seconds]
aydio has quit [Ping timeout: 264 seconds]
warweasle has joined #lisp
rumbler31 has quit [Remote host closed the connection]
mange has joined #lisp
lnostdal has quit [Read error: Connection reset by peer]