freenode/#lisp - IRC Chatlog
Search
5:21:40
pjb
and assuming by quote you mean COMMON-LISP:QUOTE and by function you mean COMMON-LISP:FUNCTION
5:28:21
pjb
iqubic: first it should be noted that APPLY and FUNCALL take function designators, so if the symbol and the function designate the same function, quote and function will be equivalent in the sense that the same function will be called.
5:28:42
pjb
iqubic: and in the case of functions from the CL package, they will always designate the same function!
5:29:01
pjb
iqubic: however, for other symbols, (not from CL), they may deisgnate different functions!
5:29:33
pjb
iqubic: a symbol will always designate the global function binding, ie. the function obtained by (symbol-function symbol).
5:30:07
pjb
iqubic: however, the function special operator is the (only) closure creator operator, and it may create closures of locally bound functions.
5:30:41
pjb
iqubic: therefore: (defun foo () 'global) (mapcar 'funcall (flet ((foo () 'local)) (list (quote foo) (function foo)))) #| --> (global local) |#
5:31:24
pjb
and also: (flet ((foo () 'local)) (mapcar 'funcall (list (quote foo) (function foo)))) #| --> (global local) |#
5:31:38
pjb
In such cases, you would have to choose between quote and function depending on WHAT YOU MEAN!
5:33:31
pjb
iqubic: other characteristic properties of symbols and functions, is that since symbols, as function designators, are resolved only when used, when the function needs to be called, if the function is redefined (at run-time), then the symbol will designate the new version. While function returns the actual closure object, if the fbinding is redefined, the function object will still be the old one.
5:34:20
pjb
(let ((funs (list (quote foo) (function foo)))) (list (mapcar 'funcall funs) (setf (symbol-function 'foo) (lambda () 'redefined)) (mapcar 'funcall funs) )) #| --> ((global global) #<Anonymous Function #x30200499B92F> (redefined global)) |#
5:34:37
pjb
So again, choose between the symbol and the function, depending on the meaning you mean!
6:02:48
iqubic
Isn't there a difference between the literal value of a symbol, and the function-value?
6:05:05
beach
iqubic: Try it out at the REPL. I don't know what you mean by "literal value", so I can't try it out for you, but you must know what you mean yourself, so just type the form (EQ ? ?) and see the result.
6:08:17
emaczen`
(sb-ext:run-program "prog-name" (list "name" "--dynamic-space-size" "4096")) -- is this the correct way to pass command line arguments?
6:18:39
emaczen`
I'm printing out the dynamic-space-size from the external program and it is the default 1 GB...
6:25:37
jackdaniel
emaczen`: compare `sbcl --dynamic-space-size 4096 --eval "(print (sb-ext:dynamic-space-size))"` in the repl with `sbcl foo --dynamic-space-size 4096 --eval "(print (sb-ext:dynamic-space-size))"` (likewise)
6:26:25
jackdaniel
`sbcl --dynamic-space-size 4096 --eval "(print (sb-ext:dynamic-space-size))" program-name ` should work though
6:27:26
jackdaniel
http://www.lispworks.com/documentation/HyperSpec/Body/f_set.htm, http://www.lispworks.com/documentation/HyperSpec/Body/a_setf.htm
6:28:36
emaczen`
jackdaniel: I see... that is kinda lame, I would have never figured that out myself
6:31:53
jackdaniel
iqubic: if it is qouted in the linked example, then why not? I highly recommend reading both linked pages and if you still have questions *after that* asking them here :)
6:39:41
beach
iqubic: Do you know what the quote character means? If not, you definitely need to take a break and go read a book.
6:41:26
iqubic
('symbol) is the syntax. ' is a reader macro that expands to the function (quote symbol) which returns the symbol exactly as it is, with out evaluation
6:42:54
iqubic
It returns symbol, exactly as it is. No evaluation is done at all. ('symbol) => symbol.
6:44:29
emaczen`
I'm running (sb-ext:run-program ...) but when the external sbcl program's heap becomes exhausted I am dropped into ldb. I just want to exit from this and for my main program to continue.
6:44:45
beach
iqubic: If the reader return (quote <something>) when it sees '<something>, then what does it return when it sees ('<something>)?
6:45:47
iqubic
Or wait, I was reading the input as if it were the output. When the reader sees ('symbol) it returns ((quote symbol))
6:47:43
jackdaniel
maybe wrapping your program in handler-case and catchin heap exhausted (and exitting application) would do what you want
6:49:33
minion
iqubic: direct your attention towards pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
6:49:34
beach
That I have figured out. What I haven't figured out is why you prefer asking trivial questions in #lisp (which is not a Common Lisp support channel) rather than reading a book.
6:51:50
beach
emaczen`: Such a condition would be hard to implement. I mean, if the heap is exhausted, how does it allocate space for the condition instance? And what would you do when it is signaled? Examine the stack? That requires form evaluation, taking up even more heap space.
6:55:56
emaczen`
jackdaniel: Yep! thanks, now I can go to bed and my program should run all night, and I don't have to be here to restart it when it drops into ldb!
7:01:26
pjb
iqubic: if the symbol designates a lexical variable, then its value will be different from (symbol-value symbol).
7:01:51
pjb
iqubic: on the other hand, if it designates a dynamic variable, then its value will be that of (symbol-value symbol).
7:02:31
pjb
(let ((foo 42)) (declare (special foo)) (list foo (and (boundp 'foo) (symbol-value 'foo)))) #| --> (42 42) |#
7:05:33
z3t0
I have some code and am wondering what is the best way to return the object at data from this function
7:05:56
z3t0
I understand that let returns the value of its final form, except the final form in this case must be closing the file
8:57:42
jackdaniel
johnnymacs: if there is gcc which can produce webassembly binaries, you could compile ecl or clisp
8:58:48
Shinmera
Anyway, good luck shipping like 10-20mb of wasm CL runtime or whatnot to run your few kilobytes of actual CL code.
8:58:55
jackdaniel
for instance there were builds of ECL to NaCL and pNaCL (obsolete chrome runtimes)
8:59:41
Shinmera
didi: (or symbol function), if you're talking about any function, and not specifically eq.
8:59:45
jackdaniel
Shinmera: given wasm binaries are not much bigger than linux ones, ecl should fit in around 1mb, what is comparable to some js scripts I saw in production
8:59:50
lerax
If someone have interest in Propositional Logic, I've been written this library with some efforts: https://github.com/ryukinix/lisp-inference
9:00:26
didi
Shinmera: Thanks, but I'm specifically talking about eq. Actually, eq, eql, equal, and equalp.
9:02:46
jackdaniel
then if you have time and resolve try compiling ecl and clisp and see how far you can get ;)
9:05:19
Shinmera
Anyway, checking a value for a certain... well, value, with a type, seems just plain wrong to me
9:05:52
didi
Shinmera: Use case: I have a data structure that uses only eq, eql, equal, or equalp as a test.
9:10:11
heisig
lerax: This is a nice little project. Since you decided to represent statements as lists, have you considered using DEFSTRUCT with (:type list)? Then you get accessors and predicates for free.
9:12:15
lerax
This a old project that I'm re-touching this again now. Probably I'll define later better data-structures for this. On those days, I just was trying getting fun with propositional logic and Lisp. Later that I read some books... well, things changed. Yes, I need review that.
9:13:11
beach
johnnymacs: Even if you manage to translate Common Lisp to webassembly, you still need a complete Common Lisp system in the target (I assume a browswer), including all the "library" functions, the memory manager, etc.
9:13:49
lerax
But I don't have sure if defstruct for this specific problem is a good idea because in general manipulating lists sometimes is basic always I need to parsing logic statements... but well, maybe with defstruct I can reduce the verbosity.
9:15:29
heisig
lerax: Unless you are under severe performance constraints and know what you are doing, represent your data with CLOS.
12:19:21
beach
"fruit flies like a banana", but there are actually many more ways of parsing that sentence. It could mean "please measure the time that flies take, just the way that you would measure the time an arrow takes".
12:19:48
beach
Or "please measure the time that flies take, just the way an arrow would measure the time that flies take".
13:06:43
flip214
perhaps that call wasn't inlined because the function definition wasn't available yet.
13:13:01
|3b|
well, can't be much more specific than that, somewhere in the inlined code it didn't know the type of the first argument of something
13:13:39
|3b|
(there could be multiple calls to same inlined function with different notes, do it can't really point you at the original source either)
13:20:13
shrdlu68
|3b|: I would expect it to issue the compiler note when I compile the inlined function itself in that case.
13:21:13
Shinmera
When it inlines it, well, inlines the code, which will lead to different inferences.
13:22:25
Shinmera
For instance (defun foo (a) (typecase a (integer 1) (character 2))) (defun bar () (foo 0)) is going to eliminate the useless branch if foo is inlined.
13:23:41
Shinmera
The optimisation constraints of the inliner are also going to affect the inlinee code.
13:26:32
Shinmera
In the most basic sense think of inlining as copy-pasting the code before compiling for real.
13:52:18
shrdlu68
How do I fix "Unable to optimize because Upgraded element type of array is not known at compile time"
13:53:51
Bike
i don't know what your code looks like, but sbcl might not be smart enough to guess the element type at the access point based on that
13:56:06
Bike
a form being underlined just means that there's a note or warning or whatever about it, btw
13:56:32
Shinmera
you can also hover over the underlining with your mouse and it should display the note
16:29:12
Shinmera
flip214: You can follow development here https://github.com/european-lisp-symposium/els-web
16:32:36
Shinmera
The latter being preferable because it means all your data will be automatically recorded with the transaction.
16:33:32
Shinmera
The bank transfer stuff is annoying because it means someone has to manually confirm that you are you and that you paid your registration.
16:34:42
Shinmera
I don't know what Didier does with his bank stuff and don't think it's my business either.
16:35:04
Shinmera
What I can do is offer CC payment which should be more convenient for both payer and payee.
16:35:44
flip214
is there some easy way to tag strings as different classes? like firstname, surname, street, etc.
16:37:15
Shinmera
Whether a string is a name, street, or whatever depends on who looks at it, so that information should be encoded in the container.
16:39:02
flip214
well, currently I'm storing a list of strings (just to print them out in the same order again)
16:47:09
Shinmera
Or don't store a list of strings, but a list of compund objects that carry that associated information