freenode/#lisp - IRC Chatlog
Search
3:25:22
Bike
if you have an &environment parameter, within the body of the macroexpander it will be bound to the environment the macro form is in. Let me give you an example.
3:26:23
dmiles
(ah, i had sorta assumed the &environment env was just so the body would have a convience var named 'env for the global env :P)
3:26:48
Bike
now say we have (defmacro pexpand (form &environment env) (print (macroexpand-1 form env)) nil)
3:28:12
Bike
In contrast, say you have (defmacro dumb-pexpand (form) (print (macroexpand-1 form)) nil)
3:29:11
Bike
then (dumb-pexpand (dumb)) => 4, but (macrolet ((dumb () 5)) (dumb-pexpand (dumb)) => 4. Because it doesn't use the local environment, it just uses the global one.
3:33:26
dmiles
FLET and MACROLET are scoped in a lexical enviroment.. the way they get decared is locally.. but that would place a limit on where they can be used
3:35:19
Bike
The environment accessible with &environment contains information about these lexical scopes.
3:35:25
dmiles
why i call it a limit.. is if you use them within the scope you dont need to think about passing env arround
3:35:55
Bike
If macroexpand doesn't receive an environment parameter, it uses the global environment, which has no information about lexical bindings as produced by flet or macrolet.
3:36:12
Bike
As such, macroexpanders that need to expand other macros would behave badly if there was no &environment available.
3:36:45
dmiles
i might have to set up a testcase in the next couple houirs once i fix my current trouble
3:37:28
dmiles
what i was wondering is if other macroexpansions still use just the global enviroment even inside the lexical scope
3:39:25
Bike
Is English not your first language? I have a hard time understanding what you try to convey.
3:43:50
dmiles
(the question about if macrolet can define macros that get used inside the same lexical scope but not actualyl defined in the same scope))
3:46:12
loke
dmiles: The answer is that the unexpanded macro is returned from the first macro call. Then the compiler looks at the result of that first macro, and repeats by expanding the second macro.
3:46:59
dmiles
Bike: yes.. so i am trying to confirm that wheter or not the macrolet should be invisible to other macros that get called by other macros
3:48:27
Bike
You have (defun eval (form env) ...). The first thing that ... does is macroexpand: just (macroexpand form env). macroexpand repeatedly calls macroexpand-1, as you probably know.
3:49:15
Bike
macroexpand-1 is something like (defun macroexpand-1 (form &optional env) (if (consp form) (let ((mf (macro-function (first form) env))) (if mf (funcall *macroexpand-hook* mf form env) ...
3:50:03
Bike
In other words, it looks up the macro definition in the environment it's passed, and if it's there, calls macroexpand-hook. macroexpand-hook is basically funcall, so the macroexpander function is called with two arguments, the form to expand, and the environment.
3:50:18
Bike
If the definition of the macro had an &environment, that's the environment it gets. if not it's ignored.
3:51:01
Bike
Now, if the form passed to eval is a macrolet form, like say (macrolet ((foo ...)) ...body...), all it does is recursively evaluate body in a new environment that includes the definition of foo.
3:51:41
Bike
like (defun eval (form env) ... (if (eq (first form) 'macrolet) ... (eval (cddr form) (augment-with-macros (second form) env)) ...
3:56:53
dmiles
i would have assumed that macrolet created a "special macro" with the meaning as "special" in "special vars" that as they are being (i'll stick with special vars (forget macros for the moment) as theire bindings are availbel shadowed in the global enviironment)
3:57:31
dmiles
i was thinking that macrolet would shadow any of its uses at the same level of its env
3:57:58
dmiles
(meaning it would not be usefull tp ass env to subsequent calls.. as the shadow macro would be present)
4:55:24
Josh_2
This is not really lisp related although it is something I did in lisp :P anyways Quicksort has an average performance of O(n log n) and I have a real time of 15ms, how do I check if my sorting algorithm is hitting it's ideal time or not?
4:55:52
Josh_2
There is the point that it is doing more than just sorting so that's going to cause some issues
4:58:14
beach
Josh_2: O(n log n) means that it is less than or equal to k*n*log(n) for some k, but you don't know the k.
4:58:57
beach
Josh_2: So no matter what your timing shows, you can always find a k that makes it true.
4:59:31
Josh_2
Ahh okay, well it is always sorting the same number of elements, but the variation in the elements change, causing quicksort to become faster than bucket sort
5:00:12
beach
Still, it is always going to be on the average O(n log n) for some k, no matter how many inputs you give it.
5:00:57
Josh_2
Alrighty, I'll mention that the average is correct, but that the change in bucketsort is obvious
5:02:12
beach
Mentioning that the average is correct is not going to give any information, because the average is always correct for any finite number of test cases.
5:05:39
Josh_2
I already dicked my grade by doing sorting algorithms. My own fault for wasting a load of time because I didn't read the spec properly..
10:30:22
knobo
I'd like to do patternmatching to get the most spesific result. Something like this: https://gist.github.com/knobo/adb1bfaa6756161d39b4f2b35fc89d5b
10:33:05
jackdaniel
your snippet doesn't clarify anything to me. to answer the question; optima may be used to do pattern matching from the most specific, if you arrange clauses in correct order (same as with cond really)
12:49:59
Xach
http://report.quicklisp.org/2017-12-04/failure-report/sb-cga.html#sb-cga is key to a number of them - I don't understand it, does anyone else?
12:51:28
jdz
ASDF has started issuing warnings about test system definitions that do not follow the ASDF's naming convention?
12:57:30
Xach
jdz: sb-cga makes use of madeira-port in a way that seems to fail for me. can you load sb-cga?
13:00:21
Xach
http://report.quicklisp.org/2017-12-04/failure-report/array-operations.html#array-operations also looks like a new sbcl-related problem
13:06:24
jdz
The problem with sb-cga could be due to madeira-port not being up-to-date with a recent ASDF.
13:18:44
jdz
And yes, array-operations on GitHub has an "abandoned" badge since Oct 29 (the only commmit in over 4 years).
14:06:44
jackdaniel
and since it introduces some rule operators, they would have to be implemented in this subset as well. if they are implemented in (say) Java, then valid program in Jess may simply not work on conforming CL implementation (unless you re-implement Jess in CL)
14:08:52
jackdaniel
yes, my point is that if it roots in java in it's core functionality, then it is not subset of CL
14:32:23
pjb
paule32: (there's not a lot of syntax in lisp, but there's still some syntax, and syntax matters!)
14:33:19
paule32
end of file on #<SB-INT:FORM-TRACKING-STREAM for "file /home/jens/Projekte/ai/test/kallup.lisp" {1004A40C53}>
14:33:19
Bike
maybe paule32 can find a nice community somewhere that uses a language they can understand and react to, rather than hanging out here for a year and still not knowing what an error is
14:34:47
pjb
paule32: could read clhs make-hash-table and notice that it's possible to use another test… But this may be over his IQ level.
14:36:02
whoman
sigh. humans can live in any conditions as long as we get used to it. Bike is very right we should be mindful. it doesnt pay anyone else to be strong, so we dont need to prove we can deal with things that arent even necessary. i do that often, i am very stubborn and lone wolf style. =P
14:39:04
whoman
oh i only feel smart when i am programming actually.. the rest of life is mostly thumbs down.
14:40:31
Bike
it's not about intelligence, it's about communication. specifically, none of us are able to communicate with paule32.
14:41:47
jackdaniel
that's not it. we understand him, he just doesn't understand us (nor listens to advices)
14:43:23
pjb
paule32: good. What about this error message: (print (gethash "you" *word-table")) #| ERROR: Unexpected end of file on #<string-input-stream :closed #x302003D7ECED> |#
14:44:05
pjb
paule32: or what about: *** - READ: input stream #<INPUT CONCATENATED-STREAM> ends within a string ?
14:44:30
pjb
paule32: the point here is that different implementations have different error messages, and some may be friendlier and more understandable than others.
14:44:58
pjb
paule32: what about: *** - READ: Eingabestream #<INPUT CONCATENATED-STREAM> endet innerhalb eines Strings.
14:45:00
ecraven
why is most of the code for the MIT CADR uppercased? wouldn't it have been easier to read if converted to lowercase?
14:45:32
pjb
paule32: what about: *** - READ: Eingabestream #<INPUT CONCATENATED-STREAM> endet innerhalb eines Strings.
14:46:51
paule32
the problem is, sometimes, i spent my time under terminal consoles text based, and sometimes under gui - where you can get eye cancer
14:46:56
pjb
paule32: but since this is something I told you to do last year, we don't have any hope.
14:48:24
whoman
tie yourself in a bag and roll off the docks -- like houdini, life is at stake -- you will find the way if the pressure is high enough. otherwise why get in the bag ?
14:49:42
ecraven
pjb: but all the docstrings are properly cased, so it can't be for printing. did the MIT CADR actually use a card reader?
14:51:14
warweasle
I'm sure someone else has mentioned it, but hackaday had a lisp article: https://hackaday.com/2017/12/02/lisp-in-200-lines/
14:51:56
ecraven
it might just be tradition, no deeper reason :-/ I find it harder to read than mixed or lower-case
14:52:05
pjb
ecraven: I would say it depend on the terminals they hard. Not all the early terminals (the first virtual teletypes) had lowercase, since teletypes had only uppercase.
14:52:35
pjb
ecraven: happily, you can use my downcase-lisp and downcase-lisp-region emacs commands.
14:52:40
ecraven
well, the actual *interface* (at least judging from running it with the usim simulator) supported lower-case characters alright
14:55:39
ecraven
yea, but the user interface of the CADR definitely supported lower case, so I'm just wondering why it's only used in the docstrings, not in the actual source code
14:57:43
pjb
Well, I would say that, plus we used to love uppercase. It gave a very computery style!
14:58:20
pjb
It's only those millenium youngster babygirls who can't stand uppercase, and who believe they're yelled at, which is not the case at all.
14:59:52
ecraven
hehe, I have fond memories of the C64, I don't remember there being a lower-case in the BASIC interpreter there either