freenode/#lisp - IRC Chatlog
Search
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
4:32:23
desvox
also the first comment is "it looks like lisp!" and HAAAAAAAAA anyone who writes lisp anywhere near that needs to have their computers taken away
5:01:24
no-defun-allowed
in lisp at least that kinda thing doesn't look like a cat sat on your keyboard though
5:01:39
no-defun-allowed
it's almost as if...lambdas are half important and aren't munted to hell in cl
5:03:25
no-defun-allowed
then again if you want to do fp in python you may as well mow your lawn with your teeth