freenode/#lisp - IRC Chatlog
Search
13:23:34
schweers
Does Common Lisp specify in which order the expressions of a let clause are evaluated?
13:25:16
neirac
schweers my common lisp book just says let* evaluates each expression sequentially not as let. schweers is there any formatter for common lisp, I'm just using emacs
13:31:12
xificurC
use tabs *and* spaces, to confuse even more people :) https://www.emacswiki.org/emacs/SmartTabs
13:49:31
neirac
slime is just stuck evaluating, slime-interrupt does not work. it should work with let/let* . it seems is a network issue
14:32:55
neirac
I'm trying to use mapcar on vectors but it requires a list. I thought mapcar used any sequence.
14:45:13
White__Flame
neirac: btw, as per its name, mapcar uses car which is a list operation, not a vector operation
14:49:35
_death
neirac: LET evaluates the init forms from left to right, like LET*.. only the binding is parallel
14:54:03
neirac
beach thanks!, I'm trying this but fails. (map #'(lambda (x y) (cons x y )) names prices) ; names and prices are vectors
14:58:11
neirac
White_Flame oh, I'm so sorry now it's working. I'll recheck my lisp book again I'm too rusty
15:10:26
ogamita
beach: loop cannot be used on sequences. Only either on list or on vectors. loop for in vs. loop for across
15:14:18
White__Flame
things like MAP say they'll error out if the result type is not a list or vector subtype
15:14:23
ogamita
You can do: (defgeneric iterator (seq) (:method ((seq list)) (lambda () (when seq (values (pop seq) t)))) (:method ((seq vector)) (let ((i -1)) (lambda () (when (< (incf i) (length seq)) (values (aref seq i) t)))))) (loop :with it := (iterator seq) :for (val gotit) := (multiple-value-list (funcall it)) :while gotit :do (process val))
15:15:22
ogamita
White__Flame: Good point! However, I guess language extensions will allow it, despite the covariant/contravariant problem.
15:16:01
ogamita
but (map type (lambda (val) (process val)) seq) is just simplier, no need to reinvent the wheel.
17:35:35
shka_
beach: sorry to disturb you, but some time ago you were referring to article with comparative analysis of different allocators
17:40:51
beach
He takes an entire domain and shows how decades of research by the theoreticians was all based on false premises, so all their results are wrong.
17:44:43
beach
Paul was (is?) a very smart man. I enjoyed several complete afternoons at the little pub right outside the Austin campus drinking beer from micro breweries and discussing language implementation strategies.
17:45:07
shka_
beach: pathogen as a concept was largely rejected by mainstream medicine by most of the modern era
17:46:39
beach
Then his work is very different, because people still say "but what about fragmentation" when I show them what I suggest, despite the fact that Paul showed that only programs that do nothing useful would fragment the memory.
17:50:47
beach
shka_: But you are right in some respects. Most medical doctors still prescribe cholesterol-lowering drugs despite the fact that it was shown decades ago that this is some very dangerous practice, and it is based on falsified research.
17:53:28
pfdietz
One of my inlaws had permanent muscle damage from statins. He has trouble climbing stairs now.
18:38:15
shangul
Hello. Is my code Lispy? https://apaste.info/gUSn https://adriann.github.io/programming_problems.html => problem #4
18:40:54
jackdaniel
shangul: put first binding of let in the same line, remove incf in favor of (dotimes (i (1+ n)) …), put dotimes body in a new line, replace (setf (sum (+ i sum))) with (incf sum i)
18:42:57
jackdaniel
also, many people considers using loop more lispy (and some consider it less lispy) - it is up to you. That would be (loop for i from 0 upto (parse-integer …) sum i)
18:46:16
jackdaniel
if you write it (dotimes (i (1+ n)) …), then you have the same result, you iterate from 0 to n inclusive (thanks to 1+ function)
18:46:41
jackdaniel
regarding loop above, you may of course start from 1, it doesn't make sense to start from 0 in this case (I've just translated your code)
18:50:40
jackdaniel
it's better. still you should keep ((n (parse-integer…))) in the same line as let, and have (sum 0)) be in the second line
18:52:59
jackdaniel
according to my research which I have executed on your demand: yes, it is (https://en.wikipedia.org/wiki/Nota_bene)
19:37:02
diegorq
Help, please! I'm a newbie and I made the mistake of trying to use the loop macro. I can't figure out why this (https://apaste.info/lw1q) code repeats the first element of the string while this other (https://apaste.info/g9oC) works fine.
19:40:36
diegorq
this is a simplification of what I was trying to do. At the same time I was setting another variable "c2" and using "when" "while" and "collecting"
19:41:51
White_Flame
c1 is not strictly an iteration variable in this usage. It's in the inner loop body, calculated using the actual iteration variable I
19:42:17
sjl
> The and construct can be used to connect two or more iteration clauses when sequential binding and stepping[1] are not necessary.
19:42:47
sjl
using `and` with `for` is fine, but not if you need sequential binding (which you do here, because c1 is calculated from i)
19:48:19
diegorq
Eventhough I solved my exercise using 'across' I'll try these suggestions. Thanks a lot.
21:29:40
desvox
so ive been fiddling lots with hunchentoot, one issue ive had with it is spitting out very long objects in its logs when serving large files
21:32:06
desvox
thats not how it works no? i mean if i were to do (let ((*print-length* whatever)) (handle-static-file *)) that wouldnt actually work would it?
21:33:01
desvox
and im honestly not sure what the rest of the message is, because it is dumping literal hundreds of mb over my ssh connection
21:34:37
desvox
really should spin up a test instance i can crash at will because having to start my irc bot up again every time is annoying
21:38:40
no-defun-allowed
Well yeah, if you're in prod you'll make things a bit faster serving static content with nginx and forwarding hunchentoot.
21:41:06
desvox
yeah back when i ran a video server, i had to send all the output to /dev/null because of this
21:54:11
no-defun-allowed
MAYBE-INVOKE-DEBUGGER looks like it could handle dumping to the log when something goes wrong.
21:58:36
pjb
(format nil "~4,'0b" (logandc2 #b1100 #b1010)) #| --> "0100" |# So I would say (defun contains-all-bits-of (container contained) (zerop (logandc2 container contained)))
21:59:29
desvox
no-defun-allowed: actually setting :message-log-destination and :access-log-destination did the trick
22:00:30
pjb
err, rather: (defun contains-all-bits-of (container contained) (zerop (logandc2 contained container))) (contains-all-bits-of #b1100 #b1010) #| --> nil |# (contains-all-bits-of #b1110 #b1010) #| --> t |#
22:06:59
trafaret1
anybody can explain me how to organize such sytem [PC[lisp-environemnt]] ~~~~~[Tablets(Show evaluations)]?
22:07:12
desvox
if its any help, what im doing to cause this is opening a video file thats stored in the path i gave to :document-root, in firefox, and when the video loads, i just skip around it until it breaks
22:14:33
desvox
a couple years ago i used to run a video server for me and my housemate, because we were only sattelite, we had a data limit during the daytime, and unlimited from 2AM-8AM
22:14:50
desvox
so i scheduled transmission and youtube-dl stuff to download to the server in the free hours
22:15:07
desvox
saving us out precious 15GB a month during the day while still letting us watch stuff
22:16:08
desvox
i didnt care about it enough and just dumped it all to /dev/null but now that im getting back into it, am thinking its kinda dumb and probably preventable
22:22:13
pjb
Otherwise, (defun contains-all-bits-of/masked (container contained mask) (zerop (logandc2 (logand mask contained) container)))
22:25:15
pjb
bit-vectors don't have an advantage here, because the bit-* functions don't take a :start :end range :-(
22:30:42
aeth
I don't think the line is even 64 in SBCL. In SBCL you can have (unsigned-byte 64) arrays and if you do a type declaration for the array it will know the size of the elements... So it's possible that for many uses of bits you could just have multiple ub 64s in parallel. This could work for 128, 256, etc.
22:31:56
aeth
Depending on what check you're doing, arrays of ub 64 might be better than bit arrays.
22:32:14
pjb
And on 64-bit processors, you often have 128-bit data buses with the RAM too! So this is effectively 128-bit words.
22:34:00
aeth
I'd say stylistically ub64s in parallel could work fine until 4 or so, so 256 elements. Macros, of course, means that you could do it based on what's optimal (which could change based on the implementation and even the version of the implementation)
22:35:27
aeth
This is, of course, assuming a 64-bit implementation that has specialized (unsigned-byte 64) arrays. It also requires you to do a type declaration if the creation of the object is done in a separate function (in which case type inference probably wouldn't work)
22:40:42
aeth
I personally wouldn't mix binary and base 10. I'd either use base 2 or base 16 when working with something that's supposed to be base 2 like integers-as-bits
22:54:22
ebrasca
Yea I can read from my 2 partitions: one ext2 and one ext3 in mezzano. ( for ext4 someting is missing )
23:00:59
no-defun-allowed
get the other x86 cores up, trampoline them into protected mode, then patch the scheduler and probably some more stuff