phoe changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.16, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
themsay has quit [Remote host closed the connection]
__jrjsmrtn__ has quit [Quit: ZZZzzz…]
tharugrim has quit [Quit: WeeChat 2.4]
lucasb has quit [Quit: Connection closed for inactivity]
Lord_of_Life has quit [Ping timeout: 250 seconds]
selwyn has quit [Remote host closed the connection]
Lord_of_Life has joined #lisp
asarch has joined #lisp
<asarch> One stupid question: I've write a paint program (cl-paint) and I would like to check at its startup if there is already a running process of itself in order to prevent another "instance" of the application. How would I do that?
<asarch> BTW, there is no cl-paint program, it is just an imaginary example :-P
<White_Flame> in the lisp world, there is only the image, not other OS processes :-P
<White_Flame> but, what many programs do in that situation is write a file somewhere containing the OS process id of the running program
<White_Flame> at startup, it checks if that file is there, and i fthat pid is still running
<verisimilitude> You can't portably do that, asarch.
<verisimilitude> The example of the process ID, as with most things in UNIX, is fragile and held together by convention rather than technical measures.
<White_Flame> agreed
<asarch> :'-(
<asarch> Ok
<White_Flame> you could also hold a socket open or something, but afaik there isn't a standard mechanism
<White_Flame> generally, it's realy annoying if you don't let a user do somethign they want to do
<White_Flame> like open up multiple instances
<asarch> I think I could do: touch .cl-paint-pid at statup
<asarch> And then rm .cl-paint-pid at exit
<Bike> what if the process is killed
<asarch> Just like vim
<asarch> Touché!
ym555 has joined #lisp
<asarch> I guess I could warn to the user with a "It seems that there is an already running process of the paint program. If not, delete manually the .cl-paint-pid and then retry"
<asarch> However, the stupid user also could delete it manually and start another process, right?
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 250 seconds]
<verisimilitude> Why do you want to restrict this, anyway?
<verisimilitude> Firefox does this and, for that reason and many others, it's one of the worst programs I regularly use.
<pjb> You have two cases: either your program needs exclusive access to a specific resource, or it does not.
<pjb> In the later case, you should not forbid multiple instances.
<pjb> In the former case, you should just test for the exclusive access to the resource, but you should not forbid multiple instances.
<pjb> Just tell the user another program uses the resources you want exclusive access.
<verisimilitude> If it really needs exclusive access, it should use a foolproof mechanism, but that unfortunately depends on the nature of the resource, since the OS isn't going to help at all.
<pjb> For some resources it helps, like listening addresses:ports.
esrse has joined #lisp
asarch has quit [Quit: Leaving]
<White_Flame> with firefox, it uses a bunch of profile information on the local disk, so it needs to serialize on that
<pjb> there's a cache indeed. Perhaps they didn't make it usable by multiple processes.
gilberth has quit [Ping timeout: 264 seconds]
Aruseus has quit [Remote host closed the connection]
jack_rabbit_ has joined #lisp
jack_rabbit has quit [Ping timeout: 250 seconds]
kajo has quit [Ping timeout: 250 seconds]
elderK has joined #lisp
kajo has joined #lisp
wigust has joined #lisp
wigust- has quit [Ping timeout: 246 seconds]
libertyprime has quit [Quit: leaving]
libertyprime has joined #lisp
mindthelion has joined #lisp
space_otter has joined #lisp
caltelt_ has joined #lisp
impulse has joined #lisp
space_otter has quit [Remote host closed the connection]
_whitelogger has joined #lisp
nanoz has joined #lisp
rozenglass has quit [Ping timeout: 250 seconds]
Bike has quit [Quit: Lost terminal]
caltelt_ has quit [Ping timeout: 250 seconds]
dddddd has quit [Remote host closed the connection]
PuercoPope has quit [Remote host closed the connection]
cryptopsy has joined #lisp
<cryptopsy> can i have a case (key1) or (key2) (action ...) ?
igemnace has quit [Quit: WeeChat 2.4]
<pjb> (case voo ((key1 key2) 2)) ?
<cryptopsy> sure that works, i'm new to lisp
<pjb> (loop for voo in '(k1 k2 k3) collect (case voo ((k1 k2) '12) (k3 '3))) #| --> (12 12 3) |#
<pjb> cryptopsy: actually I would advise to always wrap the keys in the case clauses in parentheses, even when there is a single one (case voo ((k1 k2) '12) ((k3) '3) ((nil) '0)) for the case where you want to test for nil. Because (case nil (nil 'nope) ((nil) 'yep)) #| --> yep |#
<pjb> nil = () = no key.
<cryptopsy> can i do 'else' in a case? like, if none of the cases matched, then do that thing keyn
<pjb> yes, either using t or otherwise.
<pjb> (case 3 (2 'nope) (otherwise 'yep)) #| --> yep |# (case 3 (2 'nope) (t 'yep)) #| --> yep |#
<cryptopsy> is t always equivalent to otherwise ?
<pjb> only in case, since otherwise is only used in case (and ccase and ecase).
<cryptopsy> how do you pronounce that, is it just 'tee' ?
<pjb> Yes, or "true"
<cryptopsy> i thought it might be true, what is the logic behind that choice of word?
<pjb> it's used usually in cond or the otherwise case: (let ((foo 3)) (cond ((eql foo 2) 'nope) (t 'default))) #| --> default |#
<pjb> cryptopsy: history.
<cryptopsy> otherwise starts with an 'o' so i would have chosen o instead of t
<pjb> on the paper, 0 and 1 were used in 1959, but in the first implementation they already switched to symbols, NIL and T.
<cryptopsy> i understand that its a binary logic, just not why it would be true rather than nil
<pjb> That was long before otherwise was considered as a keyword. otherwise would have taken two word to store the characters, and two words to store the pointers of the list, so it would have be a little costly as a keyword…
<cryptopsy> 'otherwise' more like it would be a false, as in it is false that there was a match
<cryptopsy> seesm more like*
<pjb> yes, for case, but not for cond.
<cryptopsy> what machine did the first lisp interpreter run on?
<pjb> antecedent1 -> consequent1 , antecedent2 -> consequent2 , … , true -> default-consequent
torbo has quit [Remote host closed the connection]
<pjb> 709 and 7090.
<cryptopsy> wow it took 100-250kw to run those
torbo has joined #lisp
<cryptopsy> double that for cooling
<pjb> Yep, and only 32 kw of 36-bit. (you could pack six 6-bit characters in a word).
<pjb> the programmer's manual of the 7090 is available and an interesting read.
<cryptopsy> that is a lot of energy, a 10kw motor could shred that computer
<pjb> that's where the CAR and CDR came from, and this processor also had a XEC instruction similat to eval, to execute an instruction stored at the given address.
<pjb> cryptopsy: you understand now why the cost of the computer was nothing: it was the cost of the electric and air conditioner installation, and electricity bill.
<pjb> Users had to pay on the order of $100/h to use it. That was serious money in 1960.
<pjb> The first 7090 installation was in November 1959. In 1960, a typical system sold for $2.9 million (equivalent to $18 million in 2018) or could be rented for $63,500 a month (equivalent to $405,000 in 2016).
<cryptopsy> there are surface grinders with 100kw motors, when the factor runs those the power bill goes up by millions of dollars for the month
<pjb> (/ 63500.0 30 24) #| --> 88.19445 |#
<cryptopsy> factory*
<pjb> so in today towel paper (/ 405000.0 30 24) #| --> 562.5 |# a hour!
seok has joined #lisp
<pjb> At only 100 Kflop/s!
<pjb> The basic memory cycle was 2.18 μs, so basically (/ 2.18e-6) #| --> 458715.62 |# less than half a mega instructions per second at most.
<cryptopsy> i made this program to try to count whitespace at the beginning of each line, but it doesnt give any output when running in sbcl (stuck?) https://pastebin.com/TLvrS9NH
<cryptopsy> it can (print line) if the defvar and loop is removed, so the input is valid
<cryptopsy> i think i may be missing a )
<pjb> If you let emacs indent it, https://pastebin.com/n1sTpQG9
<pjb> you can see that it's not a valid program.
<pjb> defvar (and all other forms with operator having a name prefixed with "DEF") should only be used as a toplevel form.
<pjb> It is basically meaningless when you use it inside an expression.
<pjb> The reason is because its effects cannot be known before the expression is compiled. So the indent variable in your expression cannot be the indent variable defined by defvar.
<pjb> Also, defvar and defparameter define special variables. Since they're special you should name them with stars *indent* to show that they're special and so you're careful in their use.
<pjb> The specialness of those variable is that all their bindings are dynamic bindings, not lexical binding.
<cryptopsy> should (defvar) and (loop) have been warpped in () ?
<pjb> You can use (count-if (lambda (ch) (find ch #(#\space #\tab))) line) to count the spaces in a line.
<pjb> No.
<pjb> defvar should be a toplevel form.
<pjb> It should be wrapped in nothing.
<pjb> (well, technically there are a few operators that preserve the toplevelness: progn and eval-when amongst others).
<cryptopsy> should i use let instead?
<cryptopsy> i had put the definition there so that it gets reinitialized to 0 for each line read
<pjb> cryptopsy: also, defvar and defparameter define global variables. You should avoid global variables.
<pjb> So see my solution ^
<cryptopsy> i am counting leading whitespace not total per line
<pjb> cryptopsy: that's not what's in your code.
<cryptopsy> working my way up to a repl thats why its structured this way
<cryptopsy> i will then tokenize then build an ast
ltriant has quit [Quit: Reconnecting]
ltriant has joined #lisp
<pjb> To count prefix spaces, you need one more test: https://pastebin.com/DL3rwi24
impulse has quit [Ping timeout: 272 seconds]
<cryptopsy> dont understand : before the words like :collect and :while
<pjb> LOOP accepts symbols from any package for its keywords.
<pjb> You can use some-random-package:for, :for, #:for, or for.
<cryptopsy> i am doing this as an exercise ..
<pjb> The advantage of using :for, is that it doesn't intern the symbolin the current package, so if you later use-package a package that exports a symbol with the same name as one loop keyword, you won't get a collision.
<pjb> Also, the advantage is to use := instead of = := means assignment, while = means equality…
<pjb> and emacs fontifies keywords such as :for differently so they stand out.
<cryptopsy> not familiar with any of this stuff
<pjb> Did you expect to be familiar with new material you're learning?
<cryptopsy> i am not learning it to be honest
<cryptopsy> learning must be structured
<beach> Good morning everyone!
<pjb> So, an exercise in not learning…
<pjb> I wonder how one can do something without learning something.
<cryptopsy> the exercise is there for learning something other than the syntax
<pjb> Do you have a frozen brain?
<cryptopsy> i'm doing alright my profession is to be a learning robot basically
<pjb> Perhaps you're an AI with a hardwired neural network?
<cryptopsy> is (let var1 val1) valid or does it have to be (let (var1 var1)) ?
paul0 has quit [Read error: Connection reset by peer]
<beach> clhs let
<pjb> cryptopsy: https://pastebin.com/NBn740xp you can use position-if-not to find the first non-space character.
sauvin has joined #lisp
<pjb> However, it the line is empty, it returns NIL, so you may want to wrap (or (position-if-not …) 0) to fallback to 0 on those lines.
nanoz has quit [Read error: Connection reset by peer]
vlatkoB has joined #lisp
impulse has joined #lisp
<beach> cryptopsy: Please don't put closing parentheses by themselves on a line.
<cryptopsy> why not?
<beach> A closing parenthesis should never be preceded by whitespace.
<beach> cryptopsy: Because that's the convention.
<cryptopsy> i am just trying to get it to run for starters
<beach> And please indent your code correctly.
<beach> cryptopsy: No you are not. You are also showing it to other people.
<beach> And when you do that, you should follow the conventions.
<beach> Otherwise, you force people to count parentheses, which Common Lisp programmers never do.
<beach> They count on the code having correct indentation and spacing.
<cryptopsy> that's why i put them on their own lines, so i can fold blocks and copy and paste them around
asarch has joined #lisp
<beach> cryptopsy: INDENT is not defined.
<beach> There should be a LOOP keyword following `for c in line'
<cryptopsy> for c in line do
<beach> cryptopsy: For example, the line that starts with (read-line...
<beach> I see that as part of the DO body because that's the way it is indented.
<beach> But it is not, because you did not indent it correctly.
<beach> So you force the people reading your code to count parentheses.
<beach> That is not polite at all.
<beach> So start by using an editor that understands Common Lisp syntax to indent your code, and remove all the whitespace before closing parentheses.
<beach> Then resubmit your code.
<cryptopsy> ok ~
<cryptopsy> bye for now
cryptopsy has left #lisp [#lisp]
<pjb> :-)
Arcaelyx has quit [Ping timeout: 250 seconds]
space_otter has joined #lisp
Inline has quit [Quit: Leaving]
torbo has quit [Remote host closed the connection]
ltriant has quit [Quit: leaving]
jack_rabbit_ is now known as jack_rabbit
<asarch> Thank you guys
<asarch> Thank you very much for your advice about the single instance :-)
<asarch> (Sorry, I had to leave before)
<seok> At which occasions should arrays and vectors should be used over lists?
Ukari has quit [Remote host closed the connection]
<akater> seok: when it makes sense to process elements of a sequence in parallel, for example. E.g. if you integrate over the elements. But it's not a hard rule. Lists are often convenient.
<beach> seok: When you want O(1) access to the elements and you don't need to change the number of elements very often
<seok> Oh. does CL process arrays in parallel?
<beach> seok: I think you can safely ignore what akater said.
<beach> seok: Use an array (of which a vector is a special case) when you want O(1) access to the elements and you don't need to change the number of elements very often.
Ukari has joined #lisp
<verisimilitude> In general, use lists unless you have a good reason to use arrays, seok.
<verisimilitude> In any case, it can usually be rather easy to switch them around, without changing the code.
<seok> Right o Thank you
<verisimilitude> VECTORs and LISTs are both considered SEQUENCEs and many functions simply work on those.
<seok> But arrays arent right?
<seok> Searched some matrix operations example on google, and people were using lists
<seok> Id imagine ndarrays would be more performant on large matrices
akater has quit [Quit: WeeChat 2.3]
<beach> seok: Is there any particular reason why you are not listening to me?
<seok> I've been listening to you, your answer have been very informative :)
<seok> That thank you was for all of you
<jackdaniel> seok: do not use lists to represent arrays, they are literally given as an example what one shouldn't do in one of Norvig's essays
<seok> Ya, I was very sceptical of the answer on stackoverflow
<jackdaniel> common lisp has an excellent suport of arrays
<jackdaniel> s/of/for/
<jackdaniel> so there is no reason one would use inefficient lists as replacement
<jackdaniel> (lists are very versatile and are useful for many things, representing arrays is *not* one of them)
dale has quit [Quit: dale]
andrei-n has joined #lisp
<verisimilitude> VECTORs are SEQUENCEs and ARRAYs, but other ARRAYs aren't SEQUENCEs, yes, seok.
<verisimilitude> Is that the essay about the FORTRAN programmer complaining about how slow Lisp was at the time?
<verisimilitude> Yet, this programmer also didn't understand how to use Lisp was part of the issue?
Oladon has quit [Quit: Leaving.]
jprajzne has joined #lisp
<jackdaniel> http://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf here, it is one of examples of "bad code"
<jackdaniel> it is an advice from the profficient Common Lisp programmer and teacher
<verisimilitude> I know who he is.
<verisimilitude> Reading his chapter of ``Coders at Work'' gave me a low opinion of him.
<jackdaniel> you clearly do not know who he is
<jackdaniel> Peter Seibel != Peter Norvig
<verisimilitude> There was a chapter that interviewed him, jackdaniel.
<verisimilitude> He also thinks Python is a Lisp, so I'm inclined to be skeptical of his opinions instead of blindly following them.
<jackdaniel> uhm, then sorry, I've hopped to conclusions.
<jackdaniel> either way, I've said what I've wanted to say - advising to represent arrays as lists is harmful
<verisimilitude> I can't download this PDF; I'm inclined to believe this server is ignoring Tor connections without rejecting them; I believe I may have had this issue with this server before.
<jackdaniel> check out query
<verisimilitude> Oh, I believe I've already been recommended this document and read it before, actually.
libertyprime has quit [Ping timeout: 255 seconds]
asarch has quit [Quit: Leaving]
_whitelogger has joined #lisp
froggey has quit [Ping timeout: 246 seconds]
froggey has joined #lisp
gilberth has joined #lisp
Ukari has quit [Remote host closed the connection]
Ukari has joined #lisp
orivej has quit [Ping timeout: 250 seconds]
<aeth> jackdaniel: not just in norvig's essays... it's also in the Worse is Better essay, except with matrices as the example
<aeth> As for lists being "convenient"... This is Common Lisp. 90% of what you would want to do with vector-like lists you can also just do with vectors without modifying your code because they're generic for sequences.
<aeth> (that's not addressed at jackdaniel in particular but akater and asarch both left)
<jackdaniel> aeth: you are right, thanks for a remainder (I think I would quote it if I had remembered)
<jackdaniel> s/quote/link/ *instead of Norvig's guidelines
space_otter has quit [Remote host closed the connection]
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
orivej has joined #lisp
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
<splittist> morning
scymtym has quit [Remote host closed the connection]
pjb has quit [Remote host closed the connection]
angavrilov has joined #lisp
<beach> Hello splittist.
pjb has joined #lisp
nowhere_man has quit [Ping timeout: 258 seconds]
orivej has quit [Ping timeout: 250 seconds]
<pjb> seok: accessing the nth element of a list is an operation that takes O(n) memory accesses (and increment and tests). Accessing the nth element of a vector is an operation that takes O(1) memory accesses (and one addition, and one test).
<pjb> seok: but notice that accessing the 1st element takes about the same time; when n=1, O(n) = O(1) !
<ecraven> hm.. O(1000) = O(1) too, afair
<ecraven> isn't that a constant factor that is usually ignored? O(2n) ~= O(n) or so?
<pjb> seok: on the other hand, extending the size of a vector is an operation that takes O(n) (with n=(length vector)), since we have to copy all the old elements of the vector to the new bigger vector. while extending the size of a list if done at the head, is an operation that takes O(1), since we only need to add a single cons cell.
<pjb> ecraven: indeed. O(n) is meaningful only when you consider big and bigger data structures.
<pjb> seok: so if you only have a handful of elements, it doesn't matter whether you use a vector or a list.
<pjb> seok: this is why there's the elt accessor, so you can use both list or vector.
<pjb> seok: now, adding elements in vectors can be done in O(1), using vectors with fill-pointers, at the cost of pre-allocating the maximum number of elements you may have to store.
<seok> Thank you for your thoughtful explanation
<seok> I am specifically looking to store game object data like coordinates, velocity and such
<seok> It seems like a no brainer to opt for arrays of vectors then
<pjb> seok: there's also the case where you need to insert new elements in the middle of the sequence. Here, list can be O(1) if you already have a reference to the cell in the middle of the list, while with a vector you will have to displace the remaining elements, so it'll be O(n).
<seok> Probably would reserve empty indices to add or remove object to avoid changing vector length
<seok> What about sorting?
<seok> Is vector better in sorting?
<pjb> Well, there are sorting algorithm that work on list directly, but AFAIK, for big sequences, if will always be faster to convert to vector, soft the vector, and store back the sorted elements in the list. So I would guess that all sane implementation do that. (but I suspect one or two use a list sorting algorithm).
<pjb> For small sequence, it doesn't matter. (again).
<pjb> So yes, vectors should be sorted slightly faster than lists, I'd expect.
pierpal has quit [Ping timeout: 268 seconds]
<pjb> As for objects in games, do they need to be sorted?
<pjb> Also, I would expect to have to access objects geographically. There are more sophisticated data structures that would help there. For example quad-trees. (or octo-trees in the case of 3D).
<pjb> Of course, you can implement quad-trees using vectors (I did that once for a big tree, that was mmap'ed from disk).
<pjb> (in C++, not in CL).
<shka__> r-trees are also any option
<pjb> Yes, a little more complex, but it may be better adapted.
<shka__> having said all that, it is usually good idea to start with vectors is you simply need a sequence of elements with random access
<shka__> *if you simply
__jrjsmrtn__ has joined #lisp
scymtym has joined #lisp
<pjb> seok: that said, if you multiply the size of the vector by a constant > 1 (preferably closer to or bigger than 2) when you need more space, then inserting elements remain O(n) instead of O(n²). http://www.cs.cornell.edu/courses/cs3110/2011fa/supplemental/lec20-amortized/amortized.htm
<aeth> If it's for a game, though, it's perfectly fine to have some fixed upper limit in size. Most do somewhere.
<aeth> And once you have a limit might as well allocate it all because RAM's cheap and it's probably tiny compared to the textures.
schweers has joined #lisp
<pjb> Definitely. For games other considerations enter the scene. For example, pre-allocating arrays lighten the load for the garbage collector, which may be a good thing for real-time games.
varjag has joined #lisp
makomo has joined #lisp
<shka__> also, huge lists are in fact just huge number of cons cells
<shka__> and huge number of small, long living objects is just the worst for the GC
<pjb> And then, the cdr start to take a lot of space…
<shka__> that as well
<pjb> But we're talking into the million elements. A vector of 1 million fixnum takes 8 MB (64-bit); a list of 1 million fixnum takes 16 MB.
<phoe> Could I get a review on https://github.com/marijnh/Postmodern/pull/193 ?
<shka__> pjb: yeah, but the list will be slower to scan for GC
<shka__> phoe: i will review this in depth once i get back home
<phoe> shka__: thanks
<phoe> it's a copypaste from pgloader - my biggest question is if I got licensing right on that one
<shka__> for now, i just wanted to point out that alexandria already has some of the functions you implemented
<phoe> shka__: I didn't implement anything, I copypasted from pgloader into postmodern
<shka__> and i think it is wise to use alexandria tools whenever possible instead of defining your own
<shka__> well, in that case, you didn't need to copy paste those ;-)
<phoe> shka__: file a pgloader issue then, https://github.com/dimitri/pgloader/blob/master/pgloader.asd#L19
<phoe> it already depends on alexandria so it can as well use its code
hhdave has joined #lisp
<shka__> soooo you don't need a code review?
<shka__> not sure how to read this
<phoe> < phoe> (...) my biggest question is if I got licensing right on that one
libertyprime has joined #lisp
pankajgodbole has joined #lisp
igemnace has joined #lisp
tharugrim has joined #lisp
<shka__> riiiiiight, ok so i am not qualified to help, sorry
<aeth> pjb: Two additional issues other than just the memory size. (1) the list might not be together in memory and (2) if the large vector has an element-type that's not T it afaik greatly simplifies the GC process
<aeth> shka__: the list won't just be slower... I think (hope? I don't see why not) that the GC scanning the vector would be O(1) if the vector can only hold something like single-float or (unsigned-byte 8)
heisig has joined #lisp
<aeth> Use a 2D array instead of a vector-of-vectors and you could see some major GC improvements if that's the case, assuming there's an element-type that works.
<pjb> aeth: well, the GC problem is solved in generational GCs.
pierpal has joined #lisp
esrse has quit [Ping timeout: 246 seconds]
<shka__> does not solve the issue completly
<shka__> to a considarable extent, yes
<phoe> as in (let ((solution (make-generational-gc))) (declare (considerable-extent solution)) ...)?
<shka__> no
<shka__> but a good pun
tharugrim has quit [Quit: WeeChat 2.4]
dimpase_ has joined #lisp
<dimpase_> it seems that the only way to use ASDF if the compiler cache and the package you build is by doing (asdf:disable-output-translations)
<dimpase_> without it, one gets "Invalid cross-device link" from asdf:make-build
<dimpase_> is this an ASDF bug?
<XachX> The premise is confusing. If the package you build what?
<XachX> And i don’t think asdf itself makes symlinks - what does the backtrace show?
<XachX> Sorry, hard links.
<jackdaniel> dimpase_: you use probably :move-here option
<jackdaniel> and you move across different logical devices
<jackdaniel> i.e :move-here "/opt/foo/" where /opt/foo is on /dev/sda1 and /home/dimpase/.cache/ is on /dev/sda2
<jackdaniel> that is a copy operation, so it is not very suprising you can't "move" there (however inconvenient)
<XachX> I must have missed some context, sorry.
orivej has joined #lisp
igemnace has quit [Read error: Connection reset by peer]
igemnace has joined #lisp
<dimpase_> so I do (require :asdf)
<dimpase_> (push #P"./" asdf:*central-registry*)
<dimpase_> (require :kenzo)
<dimpase_> (asdf:make-build :kenzo :type :fasl :monolithic t :move-here #P".")
<dimpase_> and it ends with "Condition of type: SIMPLE-FILE-ERROR"
<dimpase_> Unable to rename file #P"/home/dima/.cache/common-lisp/ecl-16.1.2-unknown-linux-x64/mnt/opt/Sage/sage-dev/local/var/tmp/sage/build/kenzo-1.1.7-r1/src/kenzo--all-systems.fasb" to #P"/mnt/opt/Sage/sage-dev/local/var/tmp/sage/build/kenzo-1.1.7-r1/src/kenzo--all-systems.fasb".
<dimpase_> shouldn't a build system try a bit harder to install things, than just "rename"?
<dimpase_> I might be spoiled by GNU install(1), but still...
<p_l> Rename=move in this case
<p_l> Trying to move the file from cache to target
jprajzne has quit [Ping timeout: 245 seconds]
jprajzne has joined #lisp
<jackdaniel> all I can do is to congratulate myself that the guess was correct :)
jprajzne has quit [Client Quit]
jprajzne has joined #lisp
<dimpase_> I can move files (using shell's mv) across these devices just fine...
pierpal has quit [Ping timeout: 246 seconds]
<dimpase_> yes, Daniel, you guessed totally correctly. Probably got bitten by this before?
<jackdaniel> well, not really. I'm ECL maintainer so I just happen to know these parts of asdf and ecl.
pillton has quit [Remote host closed the connection]
drewc has quit [Ping timeout: 268 seconds]
<p_l> dimpase_: `mv` knows to fall back to copying
__jrjsmrtn__ has quit [Quit: __jrjsmrtn__]
m00natic has joined #lisp
jprajzne has quit [Quit: jprajzne]
<dimpase_> OK, so perhaps there should be a ":copy-here" option?
libertyprime has quit [Ping timeout: 272 seconds]
Zaab1t has joined #lisp
jprajzne has joined #lisp
selwyn has joined #lisp
Zaab1t has quit [Ping timeout: 250 seconds]
Zaab1t has joined #lisp
lavaflow has quit [Ping timeout: 246 seconds]
<Posterdati> jackdaniel: prof. Attardi is talking on italian news channel now!
Xach has quit [Ping timeout: 250 seconds]
Xach has joined #lisp
<jackdaniel> wow! that's a shame I don't know italian
<jackdaniel> what is he talking about?
<p_l> prof. Attardi?
<jackdaniel> (contextual note: prof. Attardi is a person behind EcoLisp fork from KCL)
<p_l> ahh
dddddd has joined #lisp
ym555 has quit [Ping timeout: 250 seconds]
Zaab1t has quit [Ping timeout: 272 seconds]
<dimpase_> jackdaniel: what's the recommended way to replace asdf:make-build for ECL?
vlatkoB_ has joined #lisp
vlatkoB has quit [Ping timeout: 250 seconds]
Zaab1t has joined #lisp
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #lisp
Zaab1t has quit [Ping timeout: 250 seconds]
Zaab1t has joined #lisp
catalinbostan has joined #lisp
Lord_of_Life_ has joined #lisp
akssri has joined #lisp
Lord_of_Life has quit [Ping timeout: 255 seconds]
Lord_of_Life_ is now known as Lord_of_Life
akssri has quit [Read error: Connection reset by peer]
amerlyq has joined #lisp
emar has joined #lisp
skelic2 has joined #lisp
Bike has joined #lisp
skelic2 is now known as momozor
cryptopsy has joined #lisp
<cryptopsy> how to make a function that takes a line and returns a local variable which is a number of the occurance a character occurs in that line?
<cryptopsy> seems wasteful for it to run recursive, so i opted to use a (let ((indent 0)) ...
<cryptopsy> i dent (infc indent) inside a (loop for c across line do ...
<cryptopsy> i then*
pierpal has joined #lisp
<cryptopsy> how about just a function that takes a line and returns aline
makomo has quit [Quit: WeeChat 2.2]
<Bike> i would just do (count character string)
<Bike> (count #a "bbbaaabbbaa") => 5
<Bike> #\a, rather
<cryptopsy> cant even return the line itself .......
<Bike> (defun foo (x) x) (foo "hello") => "hello"
<cryptopsy> how can i get tab autocompletion for user defined functions in sbcl?
<phoe> cryptopsy: use slime with slime-company
<cryptopsy> do i need emacs for that or does it run on its own?
<phoe> emacs, yep
<phoe> you can download Portacle for a prebuilt emacs distribution
<phoe> it has sbcl, quicklisp, git, magit, slime preinstalled.
<grewal> cryptopsy: If you're a vim user, slimv or vlime are good alternatives
<cryptopsy> i am trying to call the function that returns the line in while line do but i am not sucessfull
<cryptopsy> grewal: indeed i am
<cryptopsy> is one of those deprecated?
<cryptopsy> slimv is asking for py 2_7 or 3_6 single target on vim
<grewal> Yes, slimv requires python support in vim
<cryptopsy> i will have to sort that out later
<cryptopsy> grewal: i was more specific than that
<cryptopsy> while line do (write(petindent line)) didn't work for me
<Bike> In what way did it not work?
<cryptopsy> i think i might be in the wrong dir and the file it is supposed to open is not there
<cryptopsy> oh god i am going blind the font is so small
gxt has quit [Ping timeout: 250 seconds]
<cryptopsy> but it has to be small so i can do 50 things at once
<cryptopsy> for this is the nature of asking questions on irc
<cryptopsy> i used to have a zone of dead pixels where i am keeping the sbcl window, but even after changing the screen my mind is still recognizing that zone as dead pixels and doesn't immediatly focus on the text in that corner
<cryptopsy> i am a gentoo user, i have to set app-editors/vim python_single_target_python2_7 , this seems weird to me because it is set in make.conf
pjb has quit [Remote host closed the connection]
<cryptopsy> i will look at it later
<grewal> slimv has always just worked for me, so I won't be of much help.
<grewal> From the turorial, "You will also need a Python enabled Vim, and the same Python version installed that is Vim compiled against."
pjb has joined #lisp
<cryptopsy> my vim is python enabled
<cryptopsy> perhaps because it is built with PYTHON_SINGLE_TARGETS python3_6 but slimv wants python2_7 on itself
catalinbostan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cryptopsy> vim has PYTHON_TARGETS for 27 and 36 tho
<grewal> vlime doesn't require python. But if you want paredit, you'll have to install that separately.
<cryptopsy> app-vim/slimv Available versions: 0.9.13_p20170910 {PYTHON_TARGETS="python2_7"}
<cryptopsy> anyways, while line do is now return lines properly
<cryptopsy> today we are getting drunk all day and writing a lexer
<cryptopsy> it has been my dream this last decade to do that and i only have 3 days it until i start a career that won't permit me to have this hobby anymore
<cryptopsy> to do it*
<cryptopsy> can i paste 3-4 line blocks of code here since they are rather small?
<cryptopsy> or should we go through the trouble of using pastebin
Zaab1t has quit [Ping timeout: 255 seconds]
<gilberth> Well, this question already consumed 3 of your 4 lines. So go ahead, I'd say.
<cryptopsy> what is the data-type of lines from (loop for line= (read-line stream nil) , i think it is a string?
<gilberth> Could also be NIL.
<cryptopsy> wonder if this works https://i.imgur.com/JCxFlzL.png
<cryptopsy> yep it works, i have uploaded a screenshot
<cryptopsy> the night is young, if blocks get bigger i will rig up a pastebin script
<gilberth> I can see only half of the function.
<Bike> read-line returns a string or nil, yes.
<gilberth> cryptopsy: What should the function do anyway? Counting the leading #\Space characters?
<flip214> Bike: a string or whatever the 3rd parameter (on EOF)
pjb has quit [Remote host closed the connection]
<flip214> might not be NIL but (GENSYM "EOF") etc. ;)
xkapastel has joined #lisp
notzmv has joined #lisp
<Bike> ok but the eof value is nil
notzmv is now known as Guest51019
pjb has joined #lisp
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
pierpal has quit [Remote host closed the connection]
<cryptopsy> gilberth: yes
neirac has joined #lisp
pjb has quit [Remote host closed the connection]
<gilberth> cryptopsy: You could use POSITION for that.
<gilberth> cryptopsy: When a line contains only spaces, what should its indent be?
pjb has joined #lisp
<cryptopsy> gilberth: invalid
<cryptopsy> i am aware there are many ways to do it, i am doing this as a learning exercise with primitives i understand
<gilberth> I see.
sjl_ has joined #lisp
Guest51019 has quit [Remote host closed the connection]
sjl_ has quit [Client Quit]
notzmv- has joined #lisp
sjl_ has joined #lisp
notzmv- is now known as zmv
Arcaelyx has joined #lisp
<cryptopsy> those are the first loops i ever wrote in lisp
Aruseus has joined #lisp
<cryptopsy> count could probably replace it but defeats the learning in this exercise
karlosz has quit [Remote host closed the connection]
<gilberth> COUNT would count all spaces, not only the leading ones.
<cryptopsy> it has a start and end
neirac has left #lisp ["Leaving"]
<gilberth> LOOP really is like another language.
<cryptopsy> why is it returning NIL?
<gilberth> What is returning NIL?
okeg has joined #lisp
<cryptopsy> the function in my screenshot
lucasb has joined #lisp
<gilberth> I could only guess as I have only half the function.
<cryptopsy> the rest is the trailing )'s
<cryptopsy> the definition is (defun get-indent (line)
vaporatorius has joined #lisp
vaporatorius has quit [Read error: Connection reset by peer]
<cryptopsy> perhaps indent is not available outside of the scope of let ?
<cryptopsy> i am attempting to write this function that takes a string but returns the value of a local variable
<gilberth> Make 'indent' the last form of the LET. Then it'll be the return value.
<cryptopsy> i don't understand this
<gilberth> Like (let ((indent 0)) (loop ...) indent)
<cryptopsy> oo
<nirved> or (loop :with indent = 0 ... :finally (return indent))
<cryptopsy> would this be better to have beeen written as a recursive function considering the indents are almost always less than 20 ?
<beach> No.
<cryptopsy> i didn't know there was a return in lisp, i had not seen it in examples
<gilberth> nirved: cryptopsy already has his 'indent' variable and this is fine IMHO.
pjb has quit [Remote host closed the connection]
<cryptopsy> this is really fun i wish i had like a month to play with it full time
dieggsy has quit [Quit: ZNC 1.7.1 - https://znc.in]
<cryptopsy> i liked how concise femtolisp was written
pjb has joined #lisp
<cryptopsy> can i peak ahead or behind 1 line in a read-line loop?
<Bike> Not really.
<Bike> What do you mean "peek behind"? just save the strings.
<cryptopsy> then i should store those lines in variables for comparing them?
<cryptopsy> alright
<cryptopsy> i thought the philosophy here was stateless functions
<Bike> well, sure
<Bike> keeping state while you're in the middle of a function is fine though
<Bike> i mean you're already doing a loop
<Bike> there is a state of how far along in the file you are
<Bike> no problem
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
<jurov> Can anyone please enlighten me why in my recursive function these two forms behave differently: (concatenate 'list '( [ ) (recurse x) '( ] ) ) and `( [ ,@(recurse x) ] )
<jurov> namely, the ` form seems to reuse some parts of the structure
<Bike> yes it does
<Bike> values from ` are constant - you can't modify them
<Bike> so the thing will try to reuse structure to save space
<Bike> whereas a concatenate call will make a fresh new list
<jurov> o.O they are constant?
<Bike> sorry i mean they're literals.
<Bike> you're not allowed to modify them.
<jurov> and is there non-constant version of ` ?
<cryptopsy> will the local vars be garbage collected once the function ends?
<Bike> jurov: you can (copy-list `whatever) to get a fresh list.
<jurov> okay, thanks
<Bike> cryptopsy: they may be garbage collected at any point at which they are no longer reachable.
<Bike> of course variables aren't really objects to be collected
<Bike> the values in them are
<cryptopsy> does the little lisper differ significantly from the little schemer?
<cryptopsy> or are all the exercises virtually the same but in the lisp lang instead of scheme
<beach> The two languages are very different.
<cryptopsy> Bike: if the function ends, and is never used again, does it still have allocated that local var somewhere
<Bike> Maybe, maybe not.
<cryptopsy> depending on what
<cryptopsy> will it in my example screenshot?
<Bike> The implementation, the status of the computer, the whim of unloving gods.
<Bike> There's no way you could possibly get at it, so does it matter?
<cryptopsy> i imagine it would get unallocated once the instance of the function ends
<cryptopsy> is this the case?
<Bike> How can I say "that's not defined" more clearly?
<Bike> That's not defined.
<sjl_> probably by saying "that's not defined"
<sjl_> there you go
<cryptopsy> why's it not defined?
<cryptopsy> other langs do this
<Bike> Because in Lisp we don't worry so much about memory allocation.
<Bike> Garbage collection means not having to sweat it so much.
<cryptopsy> hi think clasp does this kind of garbage collection actually
<cryptopsy> i think *
<Bike> I am a clasp developer.
<cryptopsy> so if i compiled with clasp it would do it?
<Bike> Let me be as explicit as I can here.
<cryptopsy> >>
<cryptopsy> Posted byu/conseptizer
<cryptopsy> 2 years ago
<cryptopsy> Bone 0.1: Lisp without Garbage Collection
<cryptopsy> whoooops
<sjl_> I think it's pretty uncommon for a garbage collected language to define when garbage collection of local variables occurs.
<Bike> First off, "local variables" are not values, so they cannot be collected per se.
<cryptopsy> so i am reading here: """ While Garbage Collection (GC) was one of the major innovations of Lisp, there have been many attempts to get rid of it in one way or another. """
<Bike> But maybe you mean the VALUES in the variables.
<cryptopsy> i thought local variables are just instantiated within functions, is this wrong?
<sjl_> e.g. https://golang.org/ref/spec mentions the word "garbage" only in the introduction
<Bike> Why do you care?
<Bike> Help me out here. Why are you asking this?
<cryptopsy> why wouldn't you care
<_death> cryptopsy: you can use ffi to allocate and deallocate memory manually, if you wish
<Bike> Because dealing with memory allocation is a pain?
<cryptopsy> it is an interesting question and can be useful in big programs
<sjl_> Tell Bike you have a local variable pointing at a 10gb array and you want to know when it's safe to open Slack again without the OOM killer killing your program or something, if you want to get an answer.
<cryptopsy> couldn't i just manually unallocate a this local var?
<Bike> No.
<beach> cryptopsy: No, it is not interesting. You really don't want to know. The system will run the garbage collector when it sees fit.
<sjl_> Not with vanilla common lisp, no.
<Bike> Sometimes, for optimization reasons, it is important to care about what the garbage collector is doing.
<Bike> You however are concerned with, like, an iteration variable or something.
<cryptopsy> what are some reasons the garbage collector will run?
<beach> cryptopsy: Manual memory management is one of the main sources of bugs. We are lucky not to have to do that.
<beach> cryptopsy: When more memory is needed than what is available in the current heap.
<cryptopsy> is this a slow process?
<_death> define "slow"
<beach> cryptopsy: Automatic garbage collection is less costly than malloc/free.
<cryptopsy> costly in terms of time of processing power?
<cryptopsy> or *
<beach> Yes.
<beach> Both.
pjb has quit [Remote host closed the connection]
<cryptopsy> that is satisfactory
Bike has left #lisp [#lisp]
<sjl_> Out of curiosity: does the spec even require garbage collection? Could a CL implementation just allocate until OOM and still satisfy the spec?
<sjl_> grepping clhs for "garbage" doesn't turn up very much
<_death> sjl: no and yes
<cryptopsy> does clasp compile to llvm ir directly or does it produce intermediate C or C++ ?
<beach> cryptopsy: No intermediate C or C++.
pjb has joined #lisp
<edgar-rft> sjl_: the clhs isn't full of garbage
aindilis has quit [Ping timeout: 250 seconds]
<sjl_> ...
<phoe> sjl_: yes, it could allocate and crash
<phoe> I think bocl is a project with such a principle
<phoe> GC isn't mentioned as a hard predicate anywhere
<sjl_> yeah, that's what I thought.
<edgar-rft> just compute until RAM is full, then buy the next computer
<cryptopsy> which implementation of lisp is clasp using?
<phoe> clasp *is* a Lisp implementation
<cryptopsy> ooo
<sjl_> "Stop the world" garbage collection? Why not "end the world" garbage collection?
<phoe> sjl_: end the world is a variant of stop the world
<phoe> you just never restart it afterwards
<sjl_> I suppose.
<beach> cryptopsy: What makes you particularly interested in Clasp?
<beach> cryptopsy: As opposed to Common Lisp in general, I mean.
<grewal> cryptopsy: Some lisp implementations expose parts of the garbage collector. See, e.g. http://www.sbcl.org/manual/#Garbage-Collection
catalinbostan has joined #lisp
selwyn has quit [Remote host closed the connection]
cryptopsy has quit [Ping timeout: 250 seconds]
cryptopsy has joined #lisp
Zaab1t has joined #lisp
jack_rabbit has quit [Ping timeout: 250 seconds]
rippa has joined #lisp
<cryptopsy> beach: i saw a presentation a chemist made where he implemented his own lisp to solve molecular problems
m00natic has quit [Ping timeout: 272 seconds]
<cryptopsy> ot take advantage of the llvmIR
<beach> cryptopsy: And you are interested in molecular problems?
jprajzne has quit [Quit: Leaving.]
<verisimilitude> An implementation is supposed to signal STORAGE-CONDITION in cases such as memory exhuastion, sjl.
<verisimilitude> This doesn't stop SBCL from pathetically giving up and dying, though.
LiamH has joined #lisp
qwante has quit [Remote host closed the connection]
catalinbostan has quit [Quit: Textual IRC Client: www.textualapp.com]
<phoe> "In general, the entire question of how storage allocation is done is implementation-dependent, and so any operation might signal storage-condition at any time."
<phoe> lovely stuff
heisig has quit [Quit: Leaving]
Inline has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
<pjb> cryptopsy: Movitz https://common-lisp.net/project/movitz/movitz.html is a CL implementation that runs currently on Muerte, a x86 run-time environment that does not provide a garbage collector. (Movitz is designed to implement operating systems).
momozor has quit [Quit: Leaving]
ym555 has joined #lisp
cage_ has joined #lisp
dimpase_ has quit [Ping timeout: 246 seconds]
asarch has joined #lisp
trafaret1 has joined #lisp
zmv has quit [Ping timeout: 246 seconds]
schweers has quit [Ping timeout: 268 seconds]
CrazyEddy has quit [Remote host closed the connection]
<cryptopsy> beach: yes
<cryptopsy> i am interested i exploratory programming with lisp
<cryptopsy> that page is from 2004
<housel> Yes, Movitz hasn't been developed much since around then
<beach> housel: There are rumors that he wants to create a new version. And now there is also Mezzano.
<housel> Mezzano *does* have a gargbage collector
<dlowe> I should try modifying a CL implementation to have manual freeing.
<dlowe> I'm interested how it would change things.
ckonstanski has joined #lisp
libertyprime has joined #lisp
Ukari has quit [Ping timeout: 255 seconds]
trafaret1 has left #lisp ["ERC (IRC client for Emacs 25.2.2)"]
<cryptopsy> why tokenize before producing an ast?
<beach> cryptopsy: Context, please?
<cryptopsy> a lisp interpreter
hiroaki has joined #lisp
<beach> cryptopsy: Common Lisp is defined so that the READ function takes a sequence of characters and produces a Common Lisp data structure, which is then further processed by a compiler or an interpreter.
<beach> cryptopsy: I assume that by "tokenize", you mean what READ does.
<cryptopsy> is that data structure the ast?
<cryptopsy> why not just produce the AST directly and skip tokenization
<beach> Some people call it that. I don't. It's a Common Lisp data structure made up of lists and atoms.
<cryptopsy> linked lists
<beach> cryptopsy: Because, as I said, the language is defined to have a standard READ function.
<beach> cryptopsy: That function is programmable, which is a great tool in some situations.
<cryptopsy> well it can read the terms and create the linked structure without translating to tokens and then build an AST from a tokenized string
Ukari has joined #lisp
<_death> there is no AST
<housel> There can be one, but that's a compiler implementation detail
<beach> cryptopsy: I am not sure whether you are asking "Why does this particular implementation work like that?", or "Why was the language defined that way?".
<_death> cryptopsy: start here http://clhs.lisp.se/Body/02_a.htm
dieggsy has joined #lisp
shka_ has joined #lisp
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
angavrilov is now known as angavrilov_
<cryptopsy> i suppose it doesnt matter
pankajgodbole has quit [Ping timeout: 272 seconds]
<cryptopsy> be it a list or a tree
<verisimilitude> By having READ available by itself, you can easily, say, read in data that has previously been written, cryptopsy. With Common Lisp, you can delay defining a format for serialized data beyond READ and WRITE indefinitely.
<phoe> in Lisp, both trees and lists are made of conses
<_death> it can also be a (non-tree) graph, like the example in the topic
<cryptopsy> are there pointers?
<phoe> not in standard Lisp
<phoe> they're only useful for interfacing with foreign libraries
<dlowe> cryptopsy: are you planning to learn lisp or just about lisp?
<cryptopsy> define learn lisp
<cryptopsy> i am working on a program if that's what you mean
<phoe> as in learn how the language works
<cryptopsy> the learning never stops in that case
<phoe> sure, but there is a level when you are somewhat competent with its concepts and workings
<cryptopsy> it is a side effect of using the language
<phoe> not in the most beginning stages
<dlowe> cryptopsy: okay. We have many, many people who pop in and want to know, abstractly, all about lisp without ever wanting to write a line of code
<dlowe> cryptopsy: many of them are convinced it will bring them enlightenment
<cryptopsy> that's not the case i've seen 100's of presentations over the years
<cryptopsy> i enjoyed wbyrd's minikaren series
pjb has quit [Remote host closed the connection]
pjb has joined #lisp
<cryptopsy> anyone have app-vim/slimv working in gentoo?
hhdave has quit [Ping timeout: 246 seconds]
<cryptopsy> can i turn off backtrace when using --disable-debugger ?
<cryptopsy> in sbcl
elderK has quit [Quit: Connection closed for inactivity]
francogrex has joined #lisp
scymtym has quit [Ping timeout: 268 seconds]
<francogrex> how is it possible that a function returns NOTHING! not nil, but nada:
<francogrex> (r% "glm" :formula "outcome ~ predictor" :family "poisson" :offset (r% "as.matrix" (r% "log" (r% "subset" sub :select "doses"))) :data sub)
<francogrex> * ;R! Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, :
<francogrex> ;R! NA/NaN/Inf in 'y'
<francogrex> ;R! Calls: <Anonymous> -> eval -> eval -> glm.fit
<francogrex> *
orivej has quit [Ping timeout: 246 seconds]
pjb has quit [Remote host closed the connection]
<dlowe> (values) returns nothing
CrazyEddy has joined #lisp
<dlowe> You know how you can return 1, 2, 3, n values? You can also return 0 values.
pjb has joined #lisp
<francogrex> dlowe, ok then how do you condition to that... (if (values) ... won't work then
<cryptopsy> how do i disable the header when sbcl runs " This is SBCL 1.5.0, an implementation of ANSI Common Lisp. ...."
<francogrex> and it's not really correct what you say dlowe because: (defparameter x (values))
<francogrex> x -> NIL
<francogrex> while (defparameter xx (r% "glm" :formula "outcome ~ predictor" :family "poisson" :offset (r% "as.matrix" (r% "log" (r% "subset" sub :select "doses"))) :data sub))
<francogrex> xx -> The variable XX is unbound.
Arcaelyx has quit [Ping timeout: 250 seconds]
<dlowe> francogrex: when you use the value, evaluation rules are defined to use NIL
<cryptopsy> how do i print lines with write when doing (loop for line = (read-line stream nil) while line do ( ...
<francogrex> yes that's why my issue here is not that
<dlowe> francogrex: ok, that's pretty weird. What kind of thing is r%?
razzy has joined #lisp
<dlowe> cryptopsy: write-line?
<francogrex> it is supposed to return a pointer
<francogrex> makes some sort of ffi call to a program and returns a pointer
<dlowe> cryptopsy: sbcl --help may help you
<sjl_> dlowe: it's some R interface https://common-lisp.net/project/rcl/examples.html
<cryptopsy> dlowe:err, with write
<buffergn0me> cryptopsy: sbcl --noinform
<cryptopsy> ah yea
<buffergn0me> cryptopsy: The options are described in the man page
<dlowe> sbcl --help doesn't have noinform D:
Jesin has quit [Quit: Leaving]
<dlowe> francogrex: the only thing I can think of is that r% is generating a condition that's being silently swallowed by the repl
<dlowe> even (defparameter xx (signal "foo")) will set xx to NIL, though
<sjl_> 2019-01-11 12:44:23 <scymtym> if the implementation's REPL establishes an ABORT restart, the behavior could be caused by code like (multiple-value-list (handler-bind ((error #'abort)) (/ 2 0)))
<sjl_> from the last time they were in here asking about this
<dlowe> francogrex: idea - (trace r%)
<sjl_> well, last that I saw at least
FreeBirdLjj has joined #lisp
libertyprime has quit [Ping timeout: 255 seconds]
<cryptopsy> is there a variable for stdin like $! in bash, or $@
<cryptopsy> i am running it as follows sbcl --noinform --disable-debugger --load test.lisp
<sjl_> clhs *standard-input*
<francogrex> sjl_ yes that reproduces the behavior. what is the solution?
<francogrex> like the easy one that does not require changing the code? I guess it would be to
<sjl_> Depends on what you're actually trying to do. Are you trying to detect when this happens?
<francogrex> is it define the xx value to nil already
<francogrex> i am trying a continuity, (if xx .... )
<francogrex> ok need to go now. I will look at logs later. bye
FreeBirdLjj has quit [Ping timeout: 250 seconds]
francogrex has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
<cryptopsy> how do i disable output like this? https://i.imgur.com/tdIEYJ4.png
<cryptopsy> these look like warnings
<cryptopsy> i have tried --noinform --disable-debugger
<dlowe> add (declare (ignore node)) for unused variables
<cryptopsy> at the top?
dale_ has joined #lisp
<dlowe> you can also (declaim (sb-ext:muffle-conditions style-warning)) at the top of the file
<sjl_> Ideally you'd fix the code to not emit warnings. To hide the warnings, use the solution found in the first google result for "sbcl disable warnings"
dale_ is now known as dale
<dlowe> declarations about variables occur at the beginning of the body of the variable's scope
zigpaw has joined #lisp
Arcaelyx has joined #lisp
<grewal> cryptopsy: If you don't also don't want a REPL, you can use --script.
<cryptopsy> interesting
Jesin has joined #lisp
<grewal> `man sbcl`. --script implies many other options
lumm has joined #lisp
<cryptopsy> should i use *standard-input* or *terminal-io* nil EOF for runnning my lisp program with a parameter which is the filename it is supposed to read
selwyn has joined #lisp
<pjb> *standard-input* is for batch input. *query-io* is for interactive I/O. *terminal-io* is to communicate with the operator (and it cannot be rebound).
<pjb> If you open a file you can rebind *standard-input*: (with-open-file (*standard-input* pathname) (read))
<cryptopsy> i can't get *standard-input* to work ,, this was my usage #sbcl --noinform --disable-debugger --load test.lisp tests/alphabet.x
<cryptopsy> and (with-open-file (stream *standard-input*) was my attempt
<pjb> *standard-input* comes from stdin.
<pjb> sbcl --noinform --disable-debugger --load test.lisp < tests/alphabet.x
<grewal> command line arguments are implementation-dependent.
<cryptopsy> is there a way to pass files without < ?
<grewal> sbcl has sb-ext:*posix-argv*
<pjb> with: sbcl --noinform --disable-debugger --load test.lisp -- tests/alphabet.x
<cryptopsy> strange
<pjb> sbcl --noinform --no-userinit --disable-debugger --eval '(progn (print sb-ext:*posix-argv*) (terpri) (finish-output) (sb-ext:quit))' -- tests/alphabet.x
<cryptopsy> so i will always have to remember to use > or --
<pjb> well -- is optional.
<pjb> sbcl --noinform --no-userinit --disable-debugger --eval '(progn (print sb-ext:*posix-argv*) (finish-output) (sb-ext:quit))' tests/alphabet.x
<cryptopsy> i found 
<cryptopsy> I'm assuming that you are scripting with CLisp. You can create a file containing
<cryptopsy> #! /usr/local/bin/clisp
<cryptopsy> (format t "~&~S~&" *args*)
<cryptopsy> err
<cryptopsy> the line above those two shorter lines should not be there ..
<dtw> #!/usr/bin/sbcl --script
<dtw> (format t "~S~%" (sb-ext:*posix-argv*))
<grewal> In sbcl, once you include the shebang line, it errors if you load it
<dtw> Plus *'s
sauvin has quit [Remote host closed the connection]
<cryptopsy> i am totally confused
<pjb> Yes, you're not making much sense indeed.
<cryptopsy> i dont want to include the shebang but i also dont want to use > or -- either
<grewal> You don't need --
<pjb> cryptopsy: this is why I've shown you how to do it without --.
<pjb> cryptopsy: you since you are not learning, it doesn't print.
<cryptopsy> dont understand that --eval line
<grewal> It's just good practice, in case you have a file that begins with -
<pjb> cryptopsy: lisp is easy to understand: you look at the first word in the parentheses, and look it up.
<pjb> clhs progn
<cryptopsy> information overload
<pjb> and then you repeat with the sub expressions that are evaluated, according to what you read in the specification.
<grewal> sbcl also gives you the option to use --end-runtime-options --end-toplevel-options
<pjb> cryptopsy: you can copy and paste the irc buffer, and take your time to read and study it. Somebody will still be there when you come back, in 1 hour, 1 day, 1 month or 1 year.
<cryptopsy> dont know which combination of thigns
<dlowe> that's just being a beginner. Feel free to ask stuff in #clschool too
<cryptopsy> sbcl --noinform --disable-debugger --script test.lisp tests/alphabet.x
terpri has quit [Remote host closed the connection]
<cryptopsy> (with-open-file (stream *standard-input*)
<pjb> cryptopsy: did you read
<pjb> clhs with-open-file
<pjb> ?
<cryptopsy> the practice is, when you have 50 tabs open, u read the first few lines, and if it doesnt answer, you go to the next
<pjb> cryptopsy: again, I've shown you how to do it. Why you keep writing wrong forms? If you don't want to learn, don't come here.
<cryptopsy> 20:24:54 cryptopsy | information overload
<pjb> take your time. Go read the stuff and learn!
<pjb> come back tomorrow, when you've learned something.
<dlowe> there are less dry resources then the spec
<dlowe> have you tried checking out practical common lisp?
<cryptopsy> this is fucked
<cryptopsy> i'll just deal with it later
<dlowe> pjb: also, have you tried not telling people to go away
<pjb> dlowe: when people say they don't want to learn, and show that they don't learn anything, nope.
<dlowe> pjb: it's just rude. This isn't your personal channel.
<cryptopsy> 50 tabs 10 pages each
<pjb> dlowe: it's rude to come asking for help and saying you don't want to learn.
<pjb> I give my time for free, if it's to throw it to the trash, it's VERY RUDE. So fuck off!
<cryptopsy> ""The only required argument to OPEN is the name of the file to read."" interesting, just like all the other 1000 lines irrelevant to what i have in my program
<grewal> cryptopsy: It sounds like you need a small break to process everything. Learning a language takes time. Copy-and-pasting and brute-forcing can only get you so far
<grewal> The solution to imformation overload isn't more information
<cryptopsy> so i'm looking at this huge ammount of data (pictured her https://i.imgur.com/VCJsrVN.png) , and then i'm looking at my line, pictured here https://i.imgur.com/VCJsrVN.png
<cryptopsy> deciding if i should abandon with-open-file
<dlowe> pjb: if you're really giving it away, then you shouldn't expect anything in return
<dlowe> cryptopsy: those are the same images
<pjb> cryptopsy: this is why you should read a tutorial from start to end. Tutorials are short and pedagogical. You can read and LEARN 50 pages in a week.
<buffergn0me> cryptopsy: It looks like you might be confusing streams/file descriptors with file names
<pjb> Then you can come back for more details.
<cryptopsy> (now im looking at my imgur script which i replaced earlier, wondering why it didnt produce a link ..)
<dlowe> CL is a fairly hard language to just dive into without going step-by-step through a learning book
<dlowe> My learning book was Common Lisp: the Language, which I don't recommend but it was there at the time.
<cryptopsy> *standard-input* isnt even on http://www.gigamonkeys.com/book/files-and-file-io.html
<buffergn0me> cryptopsy: Well, are you trying to read from stdin or open a file? Totally different things
<cryptopsy> (with-open-file (stream *standard-input*)
<dtw> cryptopsy: You seem to think that you need *standard-input* stream. Do you know what it is?
<cryptopsy> i know less than 30 minutes ago
nowhere_man has joined #lisp
<dtw> Good. Now tell us what you want.
skelic2 has joined #lisp
<cryptopsy> dunnow
lavaflow has joined #lisp
<aeth> dlowe: Manual freeing gets you a lot of unwind-protect... you can already see this in CFFI code where you control the allocations
<buffergn0me> cryptopsy: I think it would help if you read a Unix introductory programming tutorial that covers file and IO system calls. The CL tutorials cover CL specific stuff and assume you know about file descriptors and the filesystem
xkapastel has joined #lisp
<dlowe> aeth: Yeah, seems like you could make dynamic-extant declarations useful there
<buffergn0me> cryptopsy: Something like Stones and Matthew's Beginning Linux Programming explains files, file descriptors, pipes, and IO redirection, and you can use it as a reference
<cryptopsy> i used (nth 1 sb-ext:*posix-argv*) to get the first param
nanoz has joined #lisp
<pjb> What if the user doesn't provide a parameter?
<cryptopsy> who cares?
<phoe> e.g. the user
<pjb> the potential employer?
<cryptopsy> myself?
<cryptopsy> this is a hobby
<cryptopsy> when i decide how to handle command line parameters in a case i will deal with that case
<cryptopsy> i was hoping to have solved this in 30 seconds while taking my mind off a recursive function
<cryptopsy> now back to that
<cryptopsy> 40 lines my program, a milestone representing 2 days of effort
polezaivsani has joined #lisp
<phoe> cryptopsy: that's a normal pace when you're learning Lisp
<phoe> Lisp code is pretty dense compared to some other popular languages
<pjb> Well, only once you realize those 40 lines can be written in 10 if you use CL instead of re-implemeting functions like count or find…
asarch has quit [Quit: Leaving]
kajo has quit [Ping timeout: 240 seconds]
ym555 has quit [Ping timeout: 245 seconds]
kajo has joined #lisp
<polezaivsani> for asdf's defsystem, the manual states that :depends-on can have a list of component names. does it mean a system can depend not just on other systems, but also file components?
selwyn has quit [Remote host closed the connection]
<dlowe> polezaivsani: yes, it's how you can define inter-file dependencies
<polezaivsani> dlowe: how does it help defining inter file deps when it's being set within a system definition? n.b. i'm totally new around here
pierpal has joined #lisp
nanoz has quit [Quit: Leaving]
<polezaivsani> just to be clear, i'm talking about :depends-on for a system itself
traplol has joined #lisp
<pjb> (defsystem :foo :depends-on ("other-system-1" "other-system-2") :component ((:file "foo1") (:file "foo2" :depends-on ("foo1")))
<pjb> )
<polezaivsani> that's clear for system's components, but can e.g. "other-system-1" or "other-system-2" be infact a non system component?
<pjb> I'd be surprised.
<polezaivsani> the hole reason, i'm asking it is i stumbled upon a system definition like (defsystem foo :depends-on ("split-sequence")), and as far i could figure, split-sequence isn't a system anylonger. Could it be that it's just an old definition from time where split-sequence was a system by itself?
<phoe> it is
<phoe> (asdf:find-system "split-sequence") ;=> #<ASDF/SYSTEM:SYSTEM "split-sequence">
<polezaivsani> oh, so it's not being part of cl-utilities, it's just being rexported from it, right?!
<phoe> no
<phoe> it's a system unto itself
<phoe> split-sequence branched itself off cl-utilities some time ago
<phoe> (and got a decent overhaul in the process, https://github.com/sharplispers/split-sequence/pull/13)
<aeth> Tangentially related, but splitting sequences is probably the wrong way to deal with most things in CL. For arrays you can just work with indices, for lists you should think about if you e.g. really want to turn '(a b c d) into '(a b) and '(c d) or if you just want '(c d) which is far more efficient (or similar list tricks).
<phoe> aeth: strings though
<polezaivsani> oh, i see. i happen to get the wrong idea from glossing over a quick cliki search
<phoe> polezaivsani: also, from what I see, most of cl-utilities made its way into alexandria
<_death> though it was explicitly ruled out at the time, I think it'd be nice by now to put split-sequence into alexandria ;)
<phoe> _death: it'll get rejected
<_death> but no big deal
<phoe> it will automatically break all packages that (:use :alexandria :split-sequence)
<dlowe> for strings, use cl-ppcre:split
<aeth> phoe: You can often/usually just subseq as the final (in the program) step and save a bunch of intermediate splits
<_death> phoe: the idea was explicitly rejected when alexandria was created.. I know it will be rejection still
<phoe> _death: yes, but for somewhat different reasons now
<_death> phoe: such packages deserve to break
<_death> ;)
<phoe> _death: :(
<polezaivsani> nice, from a couple hour long acquaintance with cl-utilities i didn't manage to like the name :) thanks for the tips!
<phoe> polezaivsani: no problem
orivej has joined #lisp
<_death> personally I use split-sequence a lot, and have great distaste for ppcre or other regex packages (unless they're part of the UI.. then they're ok)
Aruseus has quit [Remote host closed the connection]
<aeth> _death: what do you use it for?
<_death> aeth: string processing, mostly
<dlowe> if you're doing string processing, you have already lost the clean data model. Might as well regex it up
<pjb> aeth: this is why there's com.informatimago.common-lisp.cesarum.array:positions-of-subsequence
<_death> dlowe: not my experience.. I have used regexps for some quick hacks, but usually there's no need
cage_ has quit [Remote host closed the connection]
<aeth> pjb: Right (at least about the principle, never used the library), you work with position indices until the final step and then you only do the final subseq(s). This saves a lot of intermediate subseqs since you only need to subseq the strings
<aeth> If you're parsing some data format it'll probably be like 95% read-integer or direct string matches (like "true" to t) and 5% actually saving some of the string data
<pjb> Compar: (values (split-sequence #\SPACE "Hello World, How do you do?") (positions-of-subsequence " " "Hello World, How do you do?")) #| --> ("Hello" "World," "How" "do" "you" "do?") ; ((5 . 6) (12 . 13) (16 . 17) (19 . 20) (23 . 24)) |#
<_death> runtime efficiency is not always a concern
<pjb> aeth: however, creating short substring is usually very efficient, even compared to consing and working on subseqs.
<_death> usually such string processing happens at the edge of the system, you receive some input, parse it into an internal representation, and then the real processing happens
<aeth> _death: Well, it's more about how CL was designed to handle vectors (including strings)... which is with all relevant built-in functions (and all well-written third-party) functions including start/end indices
<cryptopsy> does read-line return a string?
<pjb> cryptopsy: not necessarily.
<pjb> cryptopsy: upon eof, it can return any object.
<aeth> _death: of course you can use a surpirsingly heavy library to use your own model.... turing complete and all
<cryptopsy> i am trying to understand why write or print wont write the line:
<cryptopsy> ;(write line)
<cryptopsy> write(get-indent line)
<pjb> (with-input-from-string (stream "") (read-line stream nil 42)) #| --> 42 ; t |#
<pjb> cryptopsy: I fail to see any lisp there.
<cryptopsy> less interested in print becaues i have read it is outdated but it was a desperate attempt
<cryptopsy> the second line i pasted works but the first doesnt
<pjb> cryptopsy: don't believe anything about outdated.
<pjb> write is a low level function that use a bunch of global variable parameters as defaults. princ, prin1 and print just call write, with specific values for some of those parameters.
<cryptopsy> my get-indent function works fine (defun get-indent (line)
<pjb> cryptopsy: write is not a variable.
<cryptopsy> i also tried write-line
<pjb> so: write(get-indent line) is an error.
hyero has joined #lisp
<cryptopsy> is (write(get-indent line)) the correct syntax?
<phoe> if you want to invoke the function WRITE, yes
<aeth> cryptopsy: The Lisp syntax is represending f(a, b, c, d) as (f a b c d)
<_death> aeth: I use start/end as well.. but I wouldn't normally store indices to strings without evidence that it matters
<pjb> Yes, this is the first thing all lisp tutorial would have taught you, if you wanted to learn anything.
<cryptopsy> must have gotten confused about the syntax from some shitty stackoverflow posts along the way
<phoe> basic Lisp syntax is the most straightforward thing ever
<phoe> if it's wrapped in parens, it's likely a function call
<phoe> if it's quoted, it's likely data
<_death> aeth: I do think it's a good idea to provide start/end functionality when writing string/sequence utilities
<pjb> cryptopsy: this is why I gave you this link http://cliki.net/Online+Tutorial and not a shitty stackoverflow link!
<cryptopsy> this is why i gravitated to lisp, i liked the regular syntax
<phoe> only then some special operators come in and bring some irregularity
<cryptopsy> but i have a line like while line do (
<cryptopsy> which doesnt follow this synta
<_death> aeth: in fact I remember an old presentation by tcr when he proposed some nice operators to help do just that
<phoe> cryptopsy: is that LOOP?
<dlowe> cryptopsy: you have a (loop ... ) around it, though
<cryptopsy> isn't while a function?
<pjb> cryptopsy: there are no line in lisp!
<phoe> LOOP has a pretty non-lispy syntax. It is a sub-language designed for iteration.
<cryptopsy> i thought everything was a function even operators
<phoe> Nope
<phoe> Lisp has macros that can do magic with syntax.
<pjb> cryptopsy: the source of lisp code is a lisp object, a symbolic expression (s-expr), which is an atom or a list of s-exprs.
<cryptopsy> so loop is a macro?
<pjb> again you'd know that if you learned anything from a tutorial!
<phoe> That's why (loop for x in '(1 2 3 4 5) when (evenp x) do (print x)) can work.
<phoe> yes, it's a macro.
<cryptopsy> i vaguely remember some drama about loop
<pjb> You should have better learned something useful about it.
<phoe> cryptopsy: yep, some people don't like it, since it isn't very "lispy". As in, it lacks parens.
<pjb> drama is not useful.
Zaabtop has joined #lisp
Zaab1t has quit [Ping timeout: 245 seconds]
Zaabtop is now known as Zaab1t
<cryptopsy> can i use type to prove if something is an object, macro or func ?
<cryptopsy> typeof*
<_death> cryptopsy: maybe try to avoid the long form of loop for now.. instead you can use DO.. I think newbies should go through no-loop phase at some point
<pjb> cryptopsy: not enough.
<phoe> cryptopsy: (almost) everything in Lisp is an object
<phoe> you can check if there is a macro or a special operator bound to a symbol.
<pjb> (mapcar 'type-of '(sin if loop)) #| --> (symbol symbol symbol) |#
<cryptopsy> what should i use to inspect my terms for debugging? i think that would be useful
<dlowe> (inspect terms)
<phoe> #'MACRO-FUNCTION and #'SPECIAL-OPERATOR-P will return NIL if passed a symbol that isn't bound to a macro or a special operator.
<cryptopsy> (inspect loop)
<aeth> _death: The only time I wouldn't use start/end on strings, personally, is if something was mutating them somewhere along the line. Even there, it'd probably try to find some way to make it work. Of course, this is assuming elaborate processing. At the end, SUBSEQ makes sense if it is supposed to be stored as a string, of course.
<cryptopsy> (SB-INT:SIMPLE-EVAL-IN-LEXENV LOOP #<NULL-LEXENV>)
<phoe> cryptopsy: (inspect 'loop)
<phoe> you want to inspect the symbol LOOP, so you need to quote it.
<cryptopsy> what does ' do again?
<pjb> cryptopsy: (describe 'loop)
<phoe> cryptopsy: you really need to do some basic reading on Lisp. It's hard to help you if you don't know basic concepts such as quoting.
<pjb> cryptopsy: go read a tutorial.
<aeth> _death: If it's just a CSV into an object holding strings or something similarly simple, sure, splitting makes sense
<cryptopsy> it was a last minute decision to use lisp, i came here from watching a scheme presentation
<phoe> cryptopsy: well, you don't walk into a new language and start using it straight away without learning it first.
<_death> aeth: yep.. as always, it depends
<phoe> or else you end up not knowing how it works in the slightest.
<cryptopsy> why is loop a macro and not a function?
<phoe> because it can't be a function
<phoe> because functions evaluate all their arguments before they are called.
<cryptopsy> arent macros functions themselves?
<aeth> cryptopsy: Usually people use IDEs, which expose the API of the function/macro. e.g. in a properly configured Emacs+SLIME, it will show up in the mini-buffer at the bottom. It's usually extremely obvious by the API if it's going to be a macro because it will have stuff like (foobar (x y) (&rest foo) &body body) that are impossible in function APIs
<phoe> they are a very special kind of functions
<phoe> they transform Lisp code into other Lisp code
<pjb> cryptopsy: Yes, but called by the compiler, not at run-time.
<phoe> and they are usually called by the compiler and not by the user.
<aeth> cryptopsy: of course, relying on the API isn't perfect because people could be e.g. using macros instead of inline functions (justifiably or not)
<cryptopsy> so (write line) should work?/
<phoe> as long as LINE is a bound variable, yes, it should work
<pjb> write can write any object.
<cryptopsy> ah ok
<cryptopsy> is there a key to quit sbcl?
<pjb> (as long as *print-readably* is false).
<phoe> (sb-ext:quit)
<phoe> or CTRL+D
<cryptopsy> so i dont have to type (quit) everytime i want to leave the debugger ?
<phoe> (if you're in Linux)
<cryptopsy> C-d is acceptable
<pjb> cryptopsy: you don't quit a lisp to leave the debugger!
<phoe> if you use Linux, ctrl+d to drop from one debugger level or to quit if you're at the toplevel
<pjb> cryptopsy: you just invoke a restart to go back to the toplevel.
<phoe> but also what pjb said
<phoe> there's a thing called restarts.
<cryptopsy> can i overwrite functions, say defininig it twice to update its definition?
scymtym has joined #lisp
<aeth> cryptopsy: macros are functions but they run before runtime. They take in source and output source. e.g. foobar 42 43) => (let ((x 42) (y 43)) (+ x y) (values x y (+ x y)) ; of course all trivial macros are probably better done as functions so this example is bad
<phoe> and you need to invest in learning them if you want to develop in Lisp effectively.
<phoe> cryptopsy: you can.
<pjb> cryptopsy: yes, not not the functions in CL.
<dtw> It is SB-EXT:EXIT nowadays. SB-EXT:QUIT is deprecated.
<aeth> s/ foobar 42 43)/(foobar 42 43)/
<cryptopsy> i thought macros were used by the user too, not just the copiler
<pjb> s/not not/but not/
<cryptopsy> i am just working on my crapper lexer while trying to stimulate interesting discussion
<cryptopsy> (simultaneously)
<aeth> cryptopsy: yes, users use macros, but they run before runtime
<_death> cryptopsy: macros are _used_ by a user.. this is tautology
<phoe> cryptopsy: you're not going to write good code if you don't know how to use your language. I suggest you read Practical Common Lisp first.
<cryptopsy> its an exercise
varjag has joined #lisp
<_death> (define-symbol-macro farewell-my-friend (sb-ext:quit)) in your ~/.sbclrc
<pjb> /ignore cryptopsy
<cryptopsy> i start neurosurgery residency in like 3 days, this is just for fun
<cryptopsy> was thinking of reading the little lisper actually
<aeth> The Little Schemer (current edition) actually covers one of the few parts of Scheme where it doesn't have much in common with Common Lisp.
<aeth> Mostly tail recursion
<aeth> If that's what you want #scheme can help
<_death> dangling parenthesis.. tsk tsk
<phoe> (
<cryptopsy> the troll who uploaded this pdf wasnt kidding, fully zoomed in mupdf it is that size
<cryptopsy> the actual height is like ~10 lines ... hence the "little" lisper
<cryptopsy> the size of a thumbnail
<cryptopsy> this clisp pracice will come in handy for migrating to stumpwm from ratpoison (abandonware)
<cryptopsy> stump is written in clisp
<phoe> clisp isn't common lisp
<phoe> clisp is an implementation, common lisp is a language
<_death> running as root.. for the power trip I hope
<cryptopsy> oh yea
<sjl_> yeah, stumpwm is sbcl-only since a while ago
<cryptopsy> 20 years strong
<cryptopsy> only a handful of accidental rm's
<cryptopsy> whats sbcl if clisp is an implementation
<phoe> another implementation
<dlowe> Like clang and gcc.
<cryptopsy> is clang implementation abandoned?
<cryptopsy> i thought it was at some point, and then sbcl came along
<dlowe> sbcl predates the llvm common lisp implementation by a couple of decades
<dlowe> clasp, that's its name
<dlowe> My point was that clang and gcc both implement C.
<cryptopsy> clasp isnt in the gentoo main tree yet
<cryptopsy> do these implementations differ wildly ?
vlatkoB_ has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<dlowe> They agree on the spec.
<jasom> cryptopsy: yes and no. They are similar in that they both implement a rather large specification. They are typically very different in underlying nuts and bolts
<White_Flame> Clasp is intended for strong C++ integration, ECL is based on strong C integration, SBCL's compiler usually generates the fastest code, CCL had the broadest platform support for a natively compiled version, CLISP was interpreted and thus highly compatible, etc
<jasom> clisp has a bytecode interpreter written in C that is targeted by the lisp compiler. sbcl compiles directly to machine code. ecl generates C that is compiled via a C compiler.
libertyprime has joined #lisp
<White_Flame> does CLISP do native compilation now, or is it compilation to bytecode?
<cryptopsy> how good is llvmir for common lisp?
<White_Flame> clasp uses it
<cryptopsy> is it just hype?
<cryptopsy> what are they trying to solve?
<White_Flame> of course, llvm is kind of based around simpler language models, so there's still a lot of work to build a language on top of it that has higher level native language abstractions
<dlowe> the creator wanted to interface with molecular modeling software written in C++
<cryptopsy> it seems like reinventing the wheel
<dlowe> C++ is a notoriously hard thing to interface with
<cryptopsy> at least llvm supports LTO
<White_Flame> well, LTO doesn't matter all that much, because Lisp does runtime linking
<White_Flame> (and runtime compilation)
<jasom> llvm is reinventing the wheel in the sense that most compilers already had an internal IR; its not reinventing the wheel in that there wasn't a well maintained portable IR.
<cryptopsy> true but LTO is still poorly addopted
<jasom> gcc kind of intentionally made its IR a moving target to prevent proprietery software from using it.
<cryptopsy> bash for example behaves strange if you compile it with LTO
Zaab1t has quit [Quit: bye bye friends]
terpri has joined #lisp
<cryptopsy> how did they make it a moving target?
<dlowe> anyway, I'd use clozure common lisp or sbcl.
<jasom> though be aware that gentoo's sbcl ebuild is annoying
<White_Flame> yeah, I have not had good luck with package manager provided SBCL
<cryptopsy> what other syntax irregularitys deviating from (function ...) notation should i watch ot for besides loop ?
<jasom> it relies on SBCL_HOME being set properly, so you need to source /etc/profile after installing it, and if you run it with an empty environment it won't work
<White_Flame> cryptopsy: FORMAT
<White_Flame> LOOP and FORMAT basically have sublanguages
<jasom> TAGBODY
<dlowe> format's sublanguage is in a string, though
<White_Flame> jasom: beyond that, it usually isn't pointing to its own source code properly, and had been quite far behind in versions
<grewal> dlowe: Doesn't make it any less of a sublanguage
longshi has joined #lisp
<dlowe> grewal: no, but it does make it less confusing to a beginner.
<jasom> White_Flame: the lisp overlay at least fixes the "quite far behind" part
<jasom> If I still used gentoo I'd fix the SBCL_HOME part at least; it's trivial to do so.
<dlowe> grewal: the prefix operator regularity is not violated
<grewal> dlowe: I don't know, when I first learned regex, I thought it was pretty confusing
<grewal> I see what you mean
* jasom wonders how many standard macros/operators have implicit tagbodies; prog and friends, do and friends, probably more...
<_death> backquote could also be confusing to a newbie.. when it's no longer confusing, congratulate yourself and try nesting them
<phoe> nesting newbies might be implementation-dependent though
p9fn has joined #lisp
tharugrim has joined #lisp
Josh_2 has joined #lisp
<grewal> jasom: if format is implemented in lisp, it'd probably use implicit tagbodies
orivej has quit [Ping timeout: 245 seconds]
<Josh_2> There is an implementation in SICL :O
longshi has quit [Ping timeout: 240 seconds]
<jasom> grewal: I mean the body of the macro creates an implicit tagbody like PROG or any macro starting with "DO"
<_death> always fun to poke at C's printf, that (in practice) has to keep interpreting the control string over and over, while Lisp has FORMATTER
terpri has quit [Remote host closed the connection]
<White_Flame> C compilers don't break down literal format strings at compile-time? that would surprise me
<_death> White_Flame: it's been a while since I reverse engineered stuff, but in my experience, no they didn't
<p_l> White_Flame: they don't, at least not unless they have some guarantee that the call to formatting function is to known-to-them implementation of format
<White_Flame> true, I guess it's a link-time decision
<p_l> in standard C it's not possible to optimize out runtime format string parsing
<White_Flame> right, nor in Lisp
<polezaivsani> _death: what do you mean - over and over?
<_death> p_l: when the control string is a literal, why not?
<White_Flame> (meaning when it's not literal but passed in)
<_death> polezaivsani: every time printf gets called, the control string is interpreted anew
<jasom> White_Flame: almost all C compilers will break down simple ones like "%s" or "%s\n"
<polezaivsani> oh, yeah, i was frightened by an idea of interpreting it more than once in a single call )
<jasom> in fact it's a classic bait-and-switch to do something like printf("Look: %s",NULL); printf("%s\n")
<White_Flame> this is why C is only useful for microbenchmarks and hand-optimization
<jasom> in fact it's a classic bait-and-switch to do something like printf("Look: %s\n",NULL); printf("%s\n",NULL) and see the first print (null) and the second segfault
<White_Flame> anything with any level of abstrction will end up running an interpreter instead of being resolved at compile time
<White_Flame> even runtime JIT languages should outpace C if there's such forms of abstraction involved
<jasom> meh, many performance-sensitive applications are a microbenchmark dressed up as a complicated program (i.e. 90% of the time is spent in a single loop) so C does well on those as well.
<p_l> _death: because at compile time they don't know what printf is other than a vararg function
<grewal> And even for some of those, inline assembly is used
<jasom> p_l: not at all true; C compilers very often will optimize standard library functions
<_death> p_l: but nothing in the C standard prevents them from attaining that knowledge
<jasom> e.g. memcpy(dst,src,4) will get turned into a single instruction typically
__jrjsmrtn__ has joined #lisp
<p_l> jasom: That's non-standard extension and often involves weird pragmas and hairy code
<p_l> it's just hidden
<White_Flame> jasom: if 90% of the time is spent in dispatch & decisions, then there's not much you can easily do in C
<p_l> essentially, for C, it requires magic
<p_l> in CL, you're the wizard
<jasom> p_l: It's not a non-standard extension as long as the program behaves externally like the abstract machine...
<grewal> gcc sometimes scares me with some of the optimaztions it's able to do
<jasom> just like clisp and sbcl will behave very differently with regards to performance while both of them being standard.
<p_l> jasom: except the abstract machine specifies that memcpy() is a function call, and in fact you can get tripped by it
<_death> p_l: the "as if" rule
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<jasom> p_l: only thing a function call does is insert a sequence point. There is no other externally observable behavior for a function call.
<_death> if in C the compiler writer is the wizard, so does in Lisp, but in Lisp you get to be the compiler writer up to a certain point ;)
<jasom> If I work on a C compiler *and* I program in lisp, does that make me a wizard squared?
<_death> jasom: depends on your work environment.. is it a.. cubicle?
<jasom> private office
<jasom> small, but it has a door!
<_death> fancy nowadays.. I've worked from home this last year (with occasional trips to fields.. actual fields.. for experiments)
<jasom> It turns out drywall isn't that much more expensive than cubicles; once the CEO discovered that all the cubes disappeared
<jasom> the larger offices go to new hires and those weird people who like sharing an office.
__jrjsmrtn__ has quit [Quit: ZZZzzz…]
<Josh_2> People like sharing an office?
<Josh_2> oof imagine being around all those people all the time, how annoying
<jasom> No more than 3 to an office...
<grewal> jasom: That drywall thing is good to know, for when I go back to an office
<jasom> It's like 2x more than midrange 5' cubes as long as you are doing a lot of it. And the 5' cubes suck because of the "gopher effect"
<grewal> I know some people like that, most of them aren't developers
<Josh_2> oof
<grewal> "gopher effect"?
<Josh_2> Everyone turns into gophers
<grewal> I've only had the pleasure of open office
<Josh_2> gophers with lisps xD
<grewal> s/office/floor plan
<jasom> I'm fortunate enught to be able to turn down work, and I ask about open office before doing an onsite
<jasom> I have this weird tick where if someone walks behind me it completely disrupts my train of thoughts.
<Josh_2> That is pretty weird
<jasom> I could probably do an open office if I sat in a corner with my back to the corner.
<Josh_2> Put something offensive on the back of ur shirt and no one will want to walk behind you
<Josh_2> or smell bad
<jasom> but even then the noise would bug me.
<_death> jasom: yes.. during experiments they set up a gazebo, a table, a battery, a screen and a keyboard for me to connect my laptop to.. and I had to operate stuff while people watched behind my back.. ugh
<Josh_2> Wear earplugs
<grewal> My only issue is that I know where everybody's schedule and everybody knows mine. I really don't like knowing about people's regularity
<Josh_2> _death: that sounds like a blast
<cryptopsy> how do i turn while line do ( into a do expression?
ym555 has joined #lisp
<cryptopsy> err
<cryptopsy> (loop for line = (read-line stream nil)
<Josh_2> (do ((line (read-line stream nil) (read-line stream nil))).. ) I think
<Josh_2> I actually like do but it gets a bit messy xD
<cryptopsy> yes
<cryptopsy> but write(get-indent line) inside the body looks confusing too
Essadon has joined #lisp
terpri has joined #lisp
<cryptopsy> as in while line do ( write(get-indent line)
<Josh_2> (do ((line (read-line stream nil) (read-line stream nil)))
<Josh_2> oof
* jasom uses loop over do whenever possible
<gilberth> cryptopsy: Keep your LOOP, it's fine.
<jasom> while line\ndo (write ...)
<_death> (do ((line (read-line ...) (read-line ...))) ((null line)) (write ...))
<gilberth> cryptopsy: There are no "expressions" in Lisp. The is not this distinction between statements and expressions like in many other languages. Everything is a FORM and evaluates to some value.
<Josh_2> (do ((line (read-line stream nil) (read-line stream nil)))
<Josh_2> (null line)
<Josh_2> (write (get-indent line)))
<Josh_2> oof
<gilberth> Josh_2: And how is that more an expression as the other? And is it better? For a start you spell READ-LINE twice.
<Josh_2> wat
<Josh_2> that's how do works
comborico1611 has joined #lisp
<cryptopsy> do i need to init local vars in let if i dont assign any value to them?
<cryptopsy> (let ((var1 init-form-1)
* jasom has always used the terms "form" and "expression" interchangeably. statements are different though.
<cryptopsy> i am just trying to reserve a prev and next var for lines read
<gilberth> Right. But do you believe that is good advice for cryptopsy? /me must be the only person who still uses DO.
<jasom> cryptopsy: (let (var) ...) will bind "var" to nil.
<Josh_2> I like Do, it certainly more "lispy" than Loop but then there is iterate oof
<jasom> how do you get more lispy than an embedded DSL implemented as a macro?
<Josh_2> okay sorry
<jasom> :P
<Josh_2> it looks more lispy xD
<jasom> yeah, I knew what you meant, but was being a pain.
<grewal> DO frequently feels like C to me
<jasom> I only use DO for code-golf.
<Josh_2> What is code-golf
<grewal> hmm... I would figure loop is usually terser
<gilberth> Josh_2: DO is fine at times. I do not use it that much anymore. And LOOP, once it arrived was heaven. All I was saying was that I believe it not good advice in this case.
<Josh_2> wat
<Josh_2> I didn't advise anyone, the peep asked how to change a loop form to a do form
<jasom> Josh_2: code-golf is solvinga problem in the fewest number of characters
<gilberth> Nobody asked that tonight.
<jasom> 3:44:49 cryptopsy | how do i turn while line do ( into a do expression?
<Josh_2> ^
<gilberth> Yes, and a line later he corrected himself and was refering to the LOOP form. This is how I understood that. Maybe I misinterpretated that.
<_death> gilberth: I believe it's a good idea to experiment with different styles.. LOOP has its affordances but also inhibits certain ideas.. so I think as a person progresses in learning CL, at some point there should be a phase w/o LOOP, a phase with heavy recursion, a phase with over-use of LOOP, etc.
<jasom> gilberth: I read it as they meant "for" rather than "while"
<Josh_2> gilberth: he clarified what form he wanted to change to do
<gilberth> _death: Sure.
<sjl_> I often end up writing my own iteration construct (with do/loop/iterate/whatever) and then using that
__jrjsmrtn__ has joined #lisp
<_death> sjl: yes, that's another phase ;)
__jrjsmrtn__ has quit [Client Quit]
<sjl_> use lisp to build the language you need to draw the owl, then just draw the owl
<polezaivsani> also owl-lisp is a thing)
<Josh_2> ^
<polezaivsani> ops, sorry, it might be owl-scheme
skelic2 has quit [Quit: Leaving]
xkapastel has quit [Quit: Connection closed for inactivity]
<grewal> On the topic of games, why isn't there an obfuscate lisp contest?
<grewal> I feel like there's a lot of fun to be had with abusing macros
<_death> sjl: but the code you pasted has an issue.. a pitfall that often comes from using LOOP in a macroexpansion
<Josh_2> xD its in all cl code XD
<sjl_> _death: using alexandria:parse-body and adding a docstring to mention nil block left as an exercise for the reader :)
<jasom> grewal: it's too easy
<_death> sjl: not (just) that.. think LOOP-FINISH
<sjl_> huh, I have never seen loop-finish before.
<sjl_> Could rewrite that loop with a DO, of course.
angavrilov_ has quit [Remote host closed the connection]
comborico1611 has quit [Quit: Konnection terminated!]
longshi has joined #lisp
<cryptopsy> can a case be a form in let?
<cryptopsy> or, should it?
<_death> why not?
<cryptopsy> wondering if its the best way to do things using local vars
<cryptopsy> maybe i should be using if
<sjl_> You mean as the thing you're binding to a local var? like (let ((foo (case ...))) ...)? Sure. It's hard to say whether it's the "best way" without an actual example.
<cryptopsy> im using 2 local vars to compare the prev and cur string in a read-line loop
shka_ has quit [Ping timeout: 245 seconds]
<_death> doesn't sound like a case for CASE then
<cryptopsy> not sure how to give bvalues to prev and next
<cryptopsy> err, prev and current
<sjl_> If you pastebin the code you already have somewhere, it would make it easier for us to give you advice.
<cryptopsy> don't really have any working code just fragments
<jasom> for current = (read-line) for prev = first-line then current
<cryptopsy> if prev and current are nil, then its the start of the file, so i need to give lines to those vars
<cryptopsy> each iteration gives one line, but i need to look behind or look ahead
andrei-n has quit [Remote host closed the connection]
<cryptopsy> case is a macro interesting
<pjb> White_Flame: Yes, you can optimize run-time format strings: (let ((fmt (formatter (read-line)))) (loop repeat 1000 do (format t fmt args)))
<pjb> Also, remember that the format control can be a function: format control n. a format string, or a function that obeys the argument conventions for a function returned by the formatter macro. See Section 22.2.1.3 (Compiling Format Strings).
<cryptopsy> i feel like im forced to use if , if i want to compare if both prev and cur line are NIL
<_death> use the father of IF, a.k.a. COND
<cryptopsy> i was thinking of that
<sjl_> you might start with something like https://plaster.tymoon.eu/view/1281#1281 but again, I don't know what you're actually trying to do
<cryptopsy> comparing combinations of prev and cur line
<_death> (loop (shiftf previous current (read-line ...)) (cond ((null current) (return)) ((null previous) first) (t rest)))
<cryptopsy> don't see how i can compare two things if the keyform is just one variable
<cryptopsy> prob should be using cond
<cryptopsy> cond is also a macro (not a func)
<cryptopsy> how do you interpret this ? condvariants => an object
<cryptopsy> this is my attempt for checking if line-prev and line-cur are both NIL (cond ((= (line-prev line-cur)) NIL)
<cryptopsy> correction: (cond ((= (line-prev line-cur) NIL))
<cryptopsy> i know that's not quite right
<sjl_> (line-prev line-cur) is calling a function named line-prev on the variable line-cur
<sjl_> which is not what you want
<sjl_> = is the equality predicate for numbers, you probably want string=
<sjl_> well
<cryptopsy> i know that ( starts a function, but i also thought ( ... ) is a list
<sjl_> no, because you're comparing against nil
cryptopsy has left #lisp [#lisp]
cryptopsy has joined #lisp
<sjl_> You probably want something like (eql prev cur NIL) or (and (null prev) (null cur)).
<sjl_> wait, does eql not take &rest?
<sjl_> huh. that's annoying. = is n-ary.
<cryptopsy> eql takes 2 objects not 3
<_death> (null (or prev cur)) ;)
<cryptopsy> (eql (cons prev next) NIL) maybe?
<sjl_> that will never be true
<_death> cryptopsy: programming is not magic
<jackdaniel> actually it is. you say magic words and things happen
amerlyq has quit [Quit: amerlyq]
<jackdaniel> who said magic is not logical?
<_death> at least, not until you're a wizard..
<jackdaniel> how about wizard apprentice who put broom in a loop? ,)
<gilberth> But then it isn't magic anymore. At least not to you.
<jackdaniel> (loop (sweep-floor))
<cryptopsy> so as i understand it i need to construct a predicate that compares multiple things
<gilberth> And what about the dishes? Who does the dishes?
<jackdaniel> that depends on the perceiver. I feel like a magician even after I came to a solid conclusion that I have an impression that I understood what I did ;)
LiamH has quit [Quit: Leaving.]
<cryptopsy> (cond ((and (prev NIL) (next NIL) ...
<cryptopsy> but, would be nicer if i didnt have to specify NIL twice
<_death> cryptopsy: what is the meaning of (prev NIL)?
<gilberth> cryptopsy: Say are 'prev' and 'next' functions?
<cryptopsy> _death: prev obj being nil
<cryptopsy> gilberth: they're objects which contain lines read from file. if no line is read i expected them to be nil
<_death> cryptopsy: how did you come to this conclusion?
<cryptopsy> i defined them as let ((line-prev) (line-cur))
<cryptopsy> call it prev and cur for short
<cryptopsy> hmm
<gilberth> Yes, but you apply them like functions. Would that work?
<cryptopsy> i can see that you're telling me my statement is calling a function prev
<phoe> yes
<cryptopsy> le tme try again
<phoe> you seem to want (and (null prev) (null next)))
<phoe> this calls the function NULL which checks if its argument is a NIL
<pjb> For lists it would be better to use endp than null.
<cryptopsy> in pseudo code i want to compare (prev and next) to (nil)
<pjb> (and (endp prev) (endp next))
<sjl_> pjb: they're not lists, they're strings.
<sjl_> in this example
<pjb> ok
* gilberth never used ENDP
<sjl_> and both phoe and I have given them their answer of (and (null prev) (null cur)) so I'm not sure what else to say here
<cryptopsy> >>>>>>> (and form1 form2 ... ) evaluates each form, one at a time, from left to right.
<phoe> neither do I, it feels weird to use it
<phoe> it is undefined for (endp 42) for example
<cryptopsy> what does and return?
<phoe> clhs and
<_death> phoe: not undefined, should signal an error
<phoe> _death: oh right
<gilberth> phoe: It is pointless IMHO. When you were passed a dotted list the subsequent CAR would catch that anyway. Fine with me.
<phoe> _death: but, well, "(...) a situation that has undefined consequences will eventually result when the non-nil atom (which is not in fact a list) finally becomes the argument to endp. (...)"
<phoe> that's what CLHS says
<gilberth> phoe: Supposing you CDR down a list and test with NULL for its end and do something with the CAR.
<phoe> gilberth: that's what I do, yes
<_death> phoe: yeah.. so it's poor man's defensive programming operator
<phoe> _death: that man must be really poor
<_death> phoe: well, he may be lacking #1=(money . #1#) ;)
<_death> phoe: endp by itself has no undefined consequences.. the poor man may misinterpret its answer though
Younder has joined #lisp
<_death> phoe: I guess another use for it is to show intention.. "look, I'm supposed to be working on proper lists"
<cryptopsy> if i want to assign a value to a var in an s-sexp in a let do i use setq ?
<Josh_2> setf
<Josh_2> (setf *im-globalish* "hey look at me")
<cryptopsy> how do i escape a predicate in cond so that the further ones are not evaluated?
<Josh_2> Cond does that automatically
<cryptopsy> this is starting to look ugly maybe i should have used a case
<cryptopsy> ah ok
<Josh_2> So you should add a (t (<do this when none of your conditions are true>)) form
<cryptopsy> can i do (!null ...) to check if something is not null?
<Josh_2> (not (null ..))
<Josh_2> Or
<sjl_> it will be faster than round-tripping a question over IRC every few seconds
<cryptopsy> i make sure to look things up before asking https://i.imgur.com/4Cr7XxH.png
<_death> cryptopsy: all but NIL is true..
<Josh_2> ^
<Josh_2> so if (setf x 1) (null x) => nil
<Josh_2> so u can just use x in place of (not (null x))
<sjl_> Sure, but thinking !null might work is a sign that you should probably start by learning the basics in a structured way, rather than just throwing everything at the wall until something sticks.
<Josh_2> But yeh you should work through a CL book cos its quite the change in thinking
<sjl_> Common Lisp is a big language that's very different than many other languages. It's worth spending some time learning the basics.
<cryptopsy> here is my cond https://i.imgur.com/nrStfeY.png
<cryptopsy> i think i need to change ((and prev cur) to ((and (not(null prev)) (not(null cur)))
<cryptopsy> because prev and cur are not identical
<nirved> in this case (not (null X)) is equivalent to X
<cryptopsy> so my attempt was correct
<nirved> you should read an introduction book, trying to learn CL this way would be very counter-productive
<cryptopsy> i have various tutorial books open
<nirved> back in 2001 it took me a whole year to bend my mind
<Josh_2> nirved: oof you should have been a pure breed like me xD
<Josh_2> bending my mind to the dirty tricks of languages like Java after having learned CL first :O
<Josh_2> xD
<nirved> Josh_2: I was coming from the other side, by starting with assembler
sjl_ has quit [Ping timeout: 250 seconds]
<Josh_2> oof
<cryptopsy> i presume ((and (not (null prev)) (null cur)) is equivalent to ((and prev (null cur)) ?
<Josh_2> Yeh
<Josh_2> also a lot of thoose tutorialspoint.com CL guides drop trailing )) onto newlines, ples don't do this :(
<cryptopsy> my examples keep trailing ) on their own lines so vim can fold them into blocks
<cryptopsy> check it out https://i.imgur.com/n4HaRHw.png
<cryptopsy> this is useful for me because sometimes i find myself solving a problem backwards , so i have to do a lot of moving blocks around to get it to work
<Josh_2> i don't use vim, someone else can comment on that
<sjl> Vim can fold blocks without mangling your source code
<cryptopsy> that's a different fold method which breaks other things
<cryptopsy> one of the side effects is it folds a block onto two lines
<gilberth> cryptopsy: However, why do you test 'prev' and 'cur' anyway? Why don't you always make 'prev' being 'cur', 'cur' being 'next' and 'next' being 'line'?
<Josh_2> it breaks my heart to see trailing )) cryptopsy :'(
<cryptopsy> so a 2-line block folds into a 2-line block, achieving nothing
<cryptopsy> there's no point counting trailing )'s now, i haven't even finished
<cryptopsy> Josh_2: the goal of this program is to produce valid lisp from block-notation code so it should produce nice code once its done :D
<cryptopsy> parse-ident tells me the indentation level of a line, now i will compare lines to place ()'s around
<cryptopsy> for example, if prev is indented 3 and cur is indented 4 we know cur is a child of prev
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
<cryptopsy> having read the gigamonkeys page for loop macro, is my placement of brackets acceptable? https://i.imgur.com/KFu34ya.png
<cryptopsy> i am confused because previous to adding let, i did not have "do (" at the end there and the program ran
<Josh_2> eew
<Josh_2> don't drop them on new lines reeeeeeee
<cryptopsy> its just temporary ..
gxt has joined #lisp
<Josh_2> I broke my usocket somehow so now it won't accept any incoming connections
<Josh_2> is there a way to fix? I tried a new port number
<cryptopsy> in (loop there is do (something)) and the syntax for let is (let ... ) , so does that become (loop ... do ( (let ...)) ?
<Josh_2> There are keyword arguments to have local variables inside a loop
<Josh_2> like with I believe
<cryptopsy> loop syntax is confusing the shit out of me
<cryptopsy> some (loop ...) use do and some dont
<Josh_2> I am not a fan either but it sure is useful
<Josh_2> There is also dotimes, dolist do* xD
<Josh_2> or iterate
<Josh_2> restarted my image and that fixed my problem :D
<cryptopsy> do i need a do () around let ? https://i.imgur.com/fxQ5oNY.png
<cryptopsy> from the docs i thing yes
<_death> what docs
Jesin has quit [Quit: Leaving]
<_death> this does not show loop's grammar.. try http://www.lispworks.com/documentation/HyperSpec/Body/m_loop.htm
<nirved> cryptopsy: these are not docs
<nirved> cryptopsy: the docs is hyperspec only
<Josh_2> There are a few other docs that take the hyperspec a lil further but they are not complete yet
<cryptopsy> loop compound-form* => result*
<cryptopsy> dont understand that
<Josh_2> cryptopsy: I also do not understand the manpage for loop
<Josh_2> the docpage*
<nirved> it's good to read the whole hyperspec once
Jesin has joined #lisp
<Josh_2> I would rather read a physical book
<cryptopsy> i think i can piece it together from the example
<Josh_2> like cltl2 :O
<cryptopsy> if multiple things need to be done they need to be in do ()
<cryptopsy> so now i go to the link to the do hyperspec
<Josh_2> depends on what u r doing
<cryptopsy> i have a let and a while that need to go in this do, i imagine the syntax is (let ...) and (while ...) ?
<Josh_2> while is a keyword
<Josh_2> so :while
<cryptopsy> fuuuuuuuuuuuuuuuuck
<Josh_2> or just while sorry
<_death> cryptopsy: there you can see the "unconditional" rule: {do | doing} compound-form+ .. i.e. do should be followed by one or more compound forms.. for compound-form there is a link to the glossary, which says that it's a non-empty list which is a form.. (let ...) is an example of a compound-form
<nirved> Josh_2: you could print the latest ANSI draft
<cryptopsy> oh god maybe scheme is easier
<cryptopsy> i'm going to pastebin what i have , don't know how to attack this problem
<nirved> scheme is easier to learn and harder to use
<cryptopsy> so i have a cond and a while that need to go in this loop, i added do () around them both since there are two things that need to be done
<cryptopsy> while is a keyword so i didnt place () around it
<cryptopsy> cond i assumed was a function, but i think i read somewhere its a macro? not sure what im doing really
<cryptopsy> let is a keyword
<nirved> let is a special operator
<cryptopsy> the only thing holding this bastardization together is the indentation in this pseudocode
<cryptopsy> the hyperdoc form for let is here https://i.imgur.com/JPcXBNL.png
<cryptopsy> it hs () around it
<cryptopsy> in my attempt i didn't put this becasue the one just above after do is there, i thought it was sufficient
ltriant has joined #lisp
<cryptopsy> should in retrospec i think it should be there because the hyperdoc is showing that as the form
<cryptopsy> it should *
<_death> cryptopsy: there are several issues with this code.. for starters, aside from bad indentation, while line should be done right after the for clause, and the let (but not its body) should be pulled out of the loop
akater has joined #lisp
<cryptopsy> if the let is pulled out of the loop for line, then it can't assign values to its locals prev and cur
<_death> (let (prev cur) (loop ... do (cond ((and (null prev) (null cur)) ...) ...) ...))
troydm has quit [Ping timeout: 250 seconds]
<nirved> cryptopsy: maybe you meant something like this https://pastebin.com/ebr5YCcD
<cryptopsy> how does the symbol : modify for, do, while ?
<Josh_2> it doesn't
<cryptopsy> i'm not exactly sure what that code does
<Josh_2> its voluntary
<nirved> cryptopsy: or even better like this https://pastebin.com/Dv3HGugy
<Josh_2> I do it because it highlights that it is a keyword
<cryptopsy> does each iteration set prev and cur to nil?
<cryptopsy> because that is not what i want
<_death> with your LET form inside loop, it does
<_death> with WITH clauses, it doesn't
<cryptopsy> _death: yes that is definitly wrong
<cryptopsy> 00:55:26 _death | with your LET form inside loop, it does
zotan has quit [Ping timeout: 244 seconds]
<cryptopsy> i will attempt to pull let out
<cryptopsy> in the spirit of taking one suggestion at a time
<cryptopsy> 00:52:00 _death | (let (prev cur) (loop ... do (cond ((and (null prev) (null cur)) ...) ...) ...))
<cryptopsy> does this mean i just get rid of the while line do ( ?
zotan has joined #lisp
<_death> no
moei has joined #lisp
wxie has joined #lisp
rumbler31 has joined #lisp
<cryptopsy> (loop ... do ( while line do ( ... )) i don't understand why there are two do's
<cryptopsy> to me it looks like four loops
troydm has joined #lisp
<_death> since you've been shown loop's grammar, it's time to try to formulate a sentence according to it.. good luck.. sleepytime
<cryptopsy> damn
polezaivsani has quit [Remote host closed the connection]
borodust has quit [Quit: Leavin']
Bike has joined #lisp
pjb has quit [Remote host closed the connection]
Lord_of_Life has quit [Excess Flood]
pjb has joined #lisp
<cryptopsy> loop while and do are all iteration statement why do they go inside each other?
hiroaki has quit [Ping timeout: 246 seconds]
Lord_of_Life has joined #lisp
torbo has joined #lisp
ym555_ has joined #lisp
<cryptopsy> how does lisp iterate through these two lists in parallel internally? Does it iterate the first for, and then append the 2nd for? https://i.imgur.com/QIUnelm.png
<no-defun-allowed> they're stepped in parallel
<cryptopsy> how is that even possible?
<White_Flame> a single LOOP describes a single iteration. If you nest LOOPs, then you'll have nested iteration
<no-defun-allowed> so, it'll check if either list is null, then pop the X list, pop the Y list and use those to bind X and Y, then repeat
ym555 has quit [Ping timeout: 272 seconds]
<cryptopsy> so it goes x1 y1, x2 y2 ...
<no-defun-allowed> yes, both lists are iterated over in parallel
longshi has quit [Ping timeout: 250 seconds]
<White_Flame> FOR ends up being a red herring when coming from other languages, where multiple FORs imply multiple iterations
<no-defun-allowed> imagine it like (let ((x-list ...) (y-list ...)) (block nil (tagbody step (when (or (null x-list) (null y-list)) (return) (do-body (pop x) (pop y)) (go step)))
<cryptopsy> so in this case https://i.imgur.com/JN9szr9.png , for for while are all 3 in parallel ?
<White_Flame> yes, within the single iteration loop, x=x+1, y=x*10, if(y< 100) break
<no-defun-allowed> in that case with the =, X is evaluated first, then Y uses that binding, then WHILE uses both values
<no-defun-allowed> but iteration constructs are done in parallel, i think computations like = and while are set up like let*
<cryptopsy> so for and while are like conditions that have to be met
<cryptopsy> and all the action happens in do ()
<no-defun-allowed> sure
<no-defun-allowed> FOR doesn't create any conditions though, only WHILE does
<cryptopsy> why don't they do :for and :while there?
<Josh_2> personal choice
<cryptopsy> why isn't for a conditional here?
dimpase_ has joined #lisp
<no-defun-allowed> FOR ... IN only stops when the whole list has been stepped through, which is how you'd expect list iteration to work
<pjb> I already explained why :for !
<cryptopsy> i've updated my form as follows for better understanding https://i.imgur.com/v9V5k1S.png
<pjb> truncated paste.
<pjb> cryptopsy: you should use http://sprunge.us instead.
<cryptopsy> i pastebin occasionally when i have a semi-complete solution
<phoe> don't take screenshots of code
<phoe> it's wrong on all possible levels unless you want us to admire your editor config
<cryptopsy> err
<cryptopsy> i have a do () block here, i'm not going to delete lines just to produce a concise paste
<Bike> can this be moved to clnoobs or something
<no-defun-allowed> ew, default xterm font
<pjb> To #idiots would be more indicated IMO.
lumm has quit [Remote host closed the connection]
<cryptopsy> fine just ban me
<Josh_2> oof
<pjb> See!?
<Josh_2> cryptopsy: go to #clschool
<Bike> i don't want to ban you, i just don't want this slow walkthrough of loop semantics to dominate the channel
<cryptopsy> if you ban me it would be the best outcome overall for everyone
<pjb> cryptopsy: can't you understand that #clnoobs would be more tolerant of your newbie questions?
<Bike> man, what the heck.
<Josh_2> it's #clschool oof
<pjb> Well, #clschool would be for learners…
<Josh_2> xD
<LdBeth> Can’t blame, I’ve never seen any proper tutorial on LOOP
<Josh_2> There is PCL loop tutorial
<Josh_2> pretty good
<LdBeth> Except the one from lisp machine manual
<LdBeth> Both of the two don’t cover all keywords
<Josh_2> The lisp machine manual :O
<Bike> well not all keyword are relevant here
<cryptopsy> doesn't describe what something is
<Bike> yeah it's an example
<cryptopsy> is it one thing?
tsizz has joined #lisp
<Bike> it's just... it's just saying you put some lisp form there
<cryptopsy> only one?
<phoe> or more
<cryptopsy> i have a (cond ...) and a write ()
* LdBeth BNF
<White_Flame> PROGN as in (progn (form1) (form2) (form3)) is also a lisp form
<White_Flame> it's very basic Lisp stuff, and yeah #clschool is way more appropriate
<White_Flame> CL has a lot of very specific terminology and complex cases which normally foil people trying to learn the basics, which is why it's split off
<moldybits> i think :do takes a compound form
<White_Flame> of course, the basics are still easy to learn
<LdBeth> For beginners might be better stick with more primary DOLIST, MAPCAR, things
wxie has quit [Ping timeout: 250 seconds]
caltelt_ has joined #lisp
<LdBeth> Yes, compound-form+
<pjb> to avoid confusion with loop keywords.
<pjb> (loop for item in '(a b c) for i from 1 to 3 collect (list item i)) #| --> ((a 1) (b 2) (c 3)) |#
tharugrim has quit [Quit: WeeChat 2.4]
Essadon has quit [Quit: Qutting]
Oladon has joined #lisp
rumbler31 has quit [Remote host closed the connection]
<tsizz> hi im just learning lisp in class... i was curious what lisp is used mostly to make nowadays
<tsizz> i was just reading that which was interesting
<Josh_2> Anything fun xD
<Josh_2> Grammarly uses CL :O
<Josh_2> CL Is good for prototyping and very complicated problems
<Josh_2> And for having fun :D
<pjb> tsizz: Common Lisp = CL; you may fetch ccl or sbcl to begin with.
<tsizz> what are those
<tsizz> we used racket a little
<Josh_2> oof
<Josh_2> Racket is a scheme, common lisp is another (better) lisp
<pjb> tsizz: racket implements several languages include scheme, but not Common Lisp.
<pjb> tsizz: type /topic
<tsizz> oh we are just going over functional programming and hardly touched on lisp
<tsizz> hm i wonder why
<Josh_2> So you can be deprived on information?
<tsizz> haha guess so
<tsizz> i mean wonder why they chose to talk about scheme more idk
<moldybits> scheme is a much simpler language
<tsizz> i assume lisp uses lot of recursion like scheme..?
<Josh_2> You can
<Josh_2> or you can iterate, its your choice
<tsizz> is that not common practice?
<moldybits> it's not fanatical about recursion, like scheme
<tsizz> i thought that's big part of functional programming
<Josh_2> tsizz: no
<gilberth> tsizz: And perhaps they want to teach you functional programming.
<Josh_2> Common lisp is multi paradigm, it is not purely functional but has support for functional if you want to write code that way
<gilberth> Real doesn't implement iteration through recursion.
<gilberth> Real code, even.
<tsizz> whats pure functional language then
<pjb> tsizz: don't wonder. The pedagogical goals can be very different from your goals and may be strange.