freenode/#lisp - IRC Chatlog
Search
11:01:19
no-defun-allowed
FUNCALL may also take a function obtained through some other method and calls that, unlike the usual `(fn arg ...)` syntax.
11:03:14
gabbiel
no-defun-allowed: so does my method, my method is better, I still don't see why funcall is needed at all
11:03:43
jackdaniel
gabbiel: imagine fn has no function associated with the symbol, so you evaluate it, and it evaluates to fn2
11:03:59
jackdaniel
now imagine fn2 symbol has no function associated with it, so it is evaluated to fn
11:04:17
jackdaniel
we already know, that fn has no function associated with the symbol, so it evaluates to fn2
11:04:37
jackdaniel
we already know, that fn2 has no function associated with the symbol, so it evaluates to fn
11:05:13
jackdaniel
etc. another reason to always require function in function position is performance, application is much faster because you know the function at compilation time
11:06:12
jackdaniel
by application I mean "function application", not "application in other words a program"
11:07:54
jackdaniel
you can't tell if foo will be called, you need to know if the symbol has function associated with it
11:08:11
gabbiel
LdBeth: what do you mean symbol-function cannot retrieve the dynamiccaly bound function
11:16:18
gabbiel
LdBeth: is that why sometimes I have to use #'symbol instead of 'symbol when using flet or labels?
11:18:16
gabbiel
oh yeah, can somebody explain inlining to me, somebody said I should inline this function
11:19:59
LdBeth
If a function is short or it is only defined for structuring program it worth to inline it
11:21:05
ck_
inlining means not placing the function call onto that stack, but (at compile time) 'inlining' the function into the procedure that calls it
11:21:05
no-defun-allowed
Basically, inlining substitutes the function body in where the function call goes.
11:21:58
no-defun-allowed
You lose some debugger information and the ability to update the function, but you avoid any function-calling overhead and possibly gain some more compiler optimisation, since it gets more context.
11:22:50
shrdlu68
gabbiel: Function calls have an overhead. Inlining functions eliminates that overhead.
11:23:19
no-defun-allowed
You could implement some kind of inlining with macros, but it's quite silly and function inlining gives you your usual function-call semantics without any headaches.
11:23:51
no-defun-allowed
Like how in C you'd write #define max(x, y) ((x) > (y) ? (x) : (y)) and then max(x++,y) would go horridly wrong.
11:24:49
no-defun-allowed
You could make a perfectly hygenic macro that does MAX correctly, but inlining is, again, less annoying, and you can use that function as an argument, too, eg (reduce #'max '(1 2 3 4 5))
11:25:45
ck_
shrdlu68: alignment as in lawful/evil/netral and so on? Ok, I understand. Thank you for replying.
11:26:28
no-defun-allowed
Fair enough, I just know CL's "do it yourself" macros and Scheme's "don't implement something more complex than substitution" safe macro system.
11:28:19
no-defun-allowed
If you evaluate another DEFUN form, or SETF FDEFINITION, that kind of thing, then where that function has been inlined won't get replaced with your new function.
11:29:58
no-defun-allowed
shrdlu68: please pick up a big red block, without hurting anyone, causing destruction to property, pissing off my cat, or booting Skynet
11:33:03
no-defun-allowed
I wouldn't count on it, I probably forgot something and shrdlu68 will kill everyone indirectly because they really want that big red block.
11:37:53
shrdlu68
no-defun-allowed: The odds of hurting someone, causing destruction to property, pissing off your cat, or booting skynet while picking up a big red block are non-zero.
11:39:06
no-defun-allowed
shrdlu68: What if I said the big red block can't be a brick, won't be underneath any cats, shouldn't be obtained by dismantling houses, and that one can be obtained from my little brother's wooden blocks container?
17:25:31
astronavt
does sbcl or any other implementation support unicode names? also would be curious if there is a library for "math mode" using infix notation for writing equations
17:40:58
pjb
astronavt: That said, I don't understand why you ask about unicode, since all the characters in (symbol-name '|"^"|) are in the ascii repertoire: (map 'list 'char-code (symbol-name '|"^"|)) #| --> (34 94 34) |#
18:54:32
dlowe
everything that isn't a parameter will have to be set up in your tests to avoid interfering with your other tests
18:56:01
dlowe
the easiest kind of testing is you call a function with some arguments and you compare against the return values
18:59:20
dlowe
ebrasca: I would set up an in-ram virtual disk and see if reads and writes to it behave like you would expect
19:00:16
dlowe
ebrasca: there's a difference between a mock and a fake now, where a fake is something you construct to behave like an external dependency, and a mock is a thing that a library constructs for you
19:01:16
dlowe
if you use syscalls, that may mean abstracting out the syscalls so they may be swapped out during testing
19:02:25
dlowe
ebrasca: does mezzano have the capability to mount RAM-backed storage? Because that would be the easiest, it seems to me
19:25:24
Ober
trafaret1: lexical-let is the newest generation of excellence in lisp. No other lisp has it because we're too old school
19:25:58
Harag
:dlowe ..with testing global state can also be your friend, if you design your tests to use global state you set up "scenarios" and then swap them out with out comping up with values having to change the actual tests, all your tests does is check the output then.
19:27:49
dlowe
ebrasca: (defun test-write-file () (fat32-write +test-data+) (check-to-see-if-write-happened))
19:56:16
White_Flame
gabbiel: inlining can work against interactive programming. If you redefine a function that's inlined somewhere else, it's best to restart your image and reload
19:57:28
White_Flame
you might get some compiler overflow errors if you explicitly declare a recursive function to be inline. But with tail call optimization, self-recursion can reduce down to a single jump so the point is moot
20:13:13
White_Flame
well, you could certainly develop something like that by changing the implementation
20:13:48
White_Flame
but a similar issue appears with macros as well. If you change the defmacro, that doesn't re-expand all its uses automatically, especially since macro expansions might perform side effects
20:58:47
vivit1
system-apropos lists nothing when I search for the names of packages that are right there on quickdocs, and when I try to quickload them I'm told that they're not found
21:07:51
paule32
ebrasca: the script have to find 2 fracts a/b, where the cube's result in a |N natural number
21:13:35
Oladon_work
paule32: You're essentially asking people to do your homework for you. I'm pretty sure that's not what whoever asked it of you had in mind.
21:15:40
Oladon_work
Regardless -- you're asking people to write code for you. You're much more likely to get a good answer if you show that you're actually trying to write it yourself.
21:19:52
White_Flame
paule32: also, look up the term "CAS" (computer algebra system). there should be lisp libs available