Search
Monday, 1st of January 2018, 2:12:12 UTC
5:00:24
beach
Good morning everyone!
5:01:04
beach
And a happy new year 2018.
5:12:49
wxie
(macroexpand-1 (with-gensyms (result)
5:12:49
wxie
(format t "~a ~%" ,result))))
5:13:29
wxie
why do I get an error: LET: variable RESULT has no value?
5:14:06
beach
Maybe because you didn't quote the form that you submitted to macroexpand-1?
5:16:33
wxie
It becomes: (LET NIL ...)?
5:17:23
Bike
(let () ...)? that's ok
5:17:31
wxie
This causes that result is not bound.
5:17:39
Bike
no, something in the ... does
5:17:56
beach
Well, I don't know where you got your with-gensyms from.
5:18:00
wxie
(LET NIL `(LET ((,RESULT T)) (FORMAT T "~a ~%" ,RESULT)))
5:18:36
Bike
that's from what, (macroexpand-1 (with-gensyms ...))? or (macroexpand-1 '(with-gensyms ...))?
5:19:00
wxie
The second (with quote).
5:20:04
Bike
your with-gensyms is messed up, i guess
5:20:20
Bike
with alexandria's, i get (let ((result (gensym "RESULT"))) ...)
5:20:51
krwq
wxie: use quote before expression in macroexpand
5:30:26
wxie
(defmacro with-gensyms ((&rest names) &body body)
5:30:26
wxie
`(let ,(loop for n in names collect `(,n (gensym)))
5:34:27
Bike
if i use that with-gensyms i don't get any let nil.
5:34:38
Bike
are you sure that that is the definition in force?
5:36:17
krwq
i find using literals inside the loop problematic - try using `(list ,n (gensym))
5:36:49
Bike
you mean (list n '(gensym))
5:40:04
wxie
I do not need rewrite the with-gensyms anyway. The problem remains.
5:40:24
Bike
i can't reproduce. your definition works fine here.
5:41:44
krwq
what does (symbol-package 'loop) and *package* return?
5:42:25
wxie
#<PACKAGE COMMON-LISP>
5:43:15
krwq
what about (with-gensyms (foo) foo)?
5:47:30
wxie
- LET: variable FOO has no value
5:48:01
krwq
ok, did you use alexandria?
5:48:13
krwq
(ql:quickload :alexandria) (use-package :alexandria)
5:48:16
Bike
they pasted the definition right there
5:48:28
krwq
take-new when it asks to override with-genyms
5:49:08
Bike
or just run your defmacro again. the point is whatever macro you have bound to with-gensyms ain't that one
5:49:48
krwq
but i guess only in source code
5:52:55
wxie
Ok, it works with alwxandria. Thanks. Is that standard Common Lisp?
5:53:11
pjb
(ql:quickload :alexandria)
5:53:17
krwq
wxie: it is one of the most popular libs though
5:53:41
Bike
i mean, the library is written in standard cl
5:53:41
wxie
It overrides several CL functions.
5:53:52
Bike
alexandria? no it does not.
5:54:33
wxie
I was asked to take a few.
5:55:10
Bike
your image is in a strange state.
5:58:33
wxie
It's clisp-2.49, and very stable so far.
6:00:15
Bike
no, i mean you did some definingn or undefining or package imports or something.
6:00:24
Bike
if you start a fresh clisp and load alexandria there should be no conflicts.
6:07:52
krwq
wxie - when you use symbol in your image which doesn't exist it will be interned - after you use alexandria and add the symbol which didn't exist before it will see conflict because you already have it
6:08:26
krwq
so the symbol is interned but it is not bound to any function to variable
6:08:45
wxie
Thanks for helping. Glad that it is solved.
6:54:25
shrdlu68
Good morning, fellow earthlings!
7:07:09
shrdlu68
What's the way to wait till a thread exits in bordeaux-threads? The docs advise against #'join-thread
7:09:07
shrdlu68
Hmm, I could use condition variables...
8:56:13
shrdlu68
This function counts from 0 past 7 and errors. However, changing "*standard-output*" to "t" in line 8 changes that. How is this happening? https://paste.pound-python.org/show/kNpHapRGwKjykU7YFXSX/
8:58:04
shrdlu68
i.e if I change *standard-output* to t it runs perfectly and counts only from 0 to 7 as it should.
9:02:21
whoman
hm, try to flush stdio ?
9:03:00
whoman
or .. https://stackoverflow.com/questions/27178642/sbcl-multiple-threads-write-to-standard-output ?
9:04:42
shrdlu68
Further investigation shows that it happens either way, just not predictably.
9:05:48
shrdlu68
Even without printing, why would it count past 7?
9:09:15
beach
It is not specified whether the final value of a loop counter is the last value you specified or one greater.
9:09:27
beach
I believe in SBCL it is one greater.
9:09:51
beach
Or, maybe it's specified to be wrong. I forget
9:09:59
beach
SICL LOOP doesn't have this problem, of course. :)
9:13:30
shrdlu68
But (loop for i from 0 to 7 collecting i) always results in '(0 1 2 3 4 5 6 7) in SBCL under normal circumstances.
9:13:59
Shinmera
shrdlu68: The problem is that the thread might start after the loop has finished.
9:15:13
Shinmera
If you want to avoid this you need to create a new binding for the index around each thread creation.
9:16:19
shrdlu68
I see. I'm currently creating a new binding _inside_ each thread.
12:09:19
phoe
How can I tell DRAKMA to error if it encounters a response code like 4xx or 5xx?
12:16:02
JuanDaugherty
it will have already done, you just need to hook, it's your job
12:16:29
JuanDaugherty
because programmer
12:20:37
Xach
phoe: I generally wrap raw drakma to do things like that when working with apis.
12:21:20
Xach
I'll glom all the separate bits into a single response object, then specialize that object, then have a gf that finds an error condition for that object based on all its parts (response code, headers, body)
12:21:47
Xach
For some APIs 4xx isn't an error, for example.
12:51:01
Shinmera
if I remember correctly dexador errors on non-200 codes.
12:53:29
phoe
Shinmera: dexador "is still BETA quality. The APIs will be likely to change."
12:53:33
phoe
but I'm nitpicking now. (:
12:53:55
Shinmera
Sure, I can't recommend it myself either as I've had it fail on some sites.
12:54:03
Shinmera
It is much faster than drakma when it works
12:54:17
Shinmera
Which can be important
13:06:16
Xach
What's the difference between Shinmera and Shirakumo?
13:07:42
Shinmera
There's other people in shirakumo. http://shirakumo.org/
13:07:57
Shinmera
But it's still 99.9% me, so
13:09:16
Xach
Shinmera: If I made a feed for build failures, should I lump them together?
13:09:25
Xach
I am doing some pattern-matching heuristics
13:09:47
Shinmera
I don't know if grouping things into a single feed per author is a good idea. Some people might individually care about failures of a particular project.
13:09:53
Shinmera
Unless you're going to offer both.
13:10:25
Shinmera
And no, I'm fine with subscribing to multiple feeds, so just doing per-github-account or something is fine by me.
13:10:41
Shinmera
No need to put them together.
13:11:20
Shinmera
And who knows, maybe some day I'll get lucky and someone else will finally contribute significantly to Shirakumo projects.
13:56:53
phoe
I have a list (A B C D E F ... P Q R ... X Y Z). Is there a function that will get me a subsequence of this list, starting from the beginning, and ending at Q?
13:57:08
phoe
Where Q can be any object.
13:57:59
phoe
Or should I just use SUBSEQ with POSITION?
13:58:02
beach
(subseq list 0 1+ (position 'Q list)))
13:59:37
Shinmera
(loop for c in list until (eq c thing) collect c)
14:00:31
Shinmera
move the until after the collect if you want the q
14:08:05
Xach
phoe: i have a weird variation
14:08:52
Xach
(ldiff list (cdr (member 'q list)))
14:09:20
Xach
i don't see ldiff used a lot.
14:09:21
_death
I was just about to say.. but why CDR?
14:09:37
beach
So that Q is in the result?
14:10:06
Xach
if you want Q as the final object.
14:10:08
_death
right, guess I expected a closed interval
14:10:46
Xach
hi sabrac. thanks for making your library comparison pages. they are great.
14:12:06
sabrac
Thank you. I wish I had more time to work on them because I learn so much doing them.
Monday, 1st of January 2018, 14:12:12 UTC