freenode/lisp - IRC Chatlog
Search
6:57:20
murftown
how can I turn a list (a b c d e) into one where each element is quoted, ('a 'b 'c 'd 'e) ?
7:00:07
loke
It prevents evaluation. If you have a list (a b c d e) there is no evaluation going on, unless you pass it to EVAL
7:08:28
murftown
Zhivago: whoa, really! I was looking for something like that but I can't wrap my mind around that yet
7:20:13
loke
I have a need to do basic source code highlighting in Coomon Lisp. Anyone know of any packages that can do this?
7:36:44
siwica
I am currently learning lisp. What would be a good programming project that I could do to learn it?
9:19:28
wasamasa
siwica: like, if you notice some day that there's not a single decent epub reader for linux desktops, you go ahead and write one
9:20:04
siwica
wasamasa: I have some experience with languages in other paradigms, so I wonderes if there are a few "canonical" beginners problems for functional languages.
9:20:11
wasamasa
siwica: because you've been bothered enough by it to turn it into a project for yourself
9:21:56
wasamasa
in fact, I'd call it the lisp dialect furthest away from FP, simply because you're forced to modify global states to get anything meaningful done :P
9:23:23
wasamasa
siwica: if you want to discuss other lisp dialects than common lisp, I encourage you to strike up a conversation on ##lisp or the respective channel of that lisp dialect (for elisp, that would be #emacs)
9:23:24
|3b|
siwica: this channel focuses on common lisp (and interprets 'lisp' on its own as common lisp), which supports lots of programming paradigms to varying extents
9:24:36
wasamasa
siwica: if you want to learn a language that's supporting FP only, take a look at haskell
9:29:40
|3b|
from what i've seen, people talking about function programming with "lisp" usually mean some subset of scheme
10:12:59
didi
Is there a convention for using comments on top of lisp libraries, specially single file ones?
10:45:14
Shinmera
Ah, I missed you, old friend. http://shinmera.tymoon.eu/public/screenshot-2014.11.19-11:44:48.png
11:16:18
pjb
minion: memo for Shinmera: since setting an undeclared variable is implementation dependant, an implementation could define automatically _lexical_ variables for them, so you may have fun at the REPL and keep your programs working. But this would need additionnal code in the implementation.
11:43:23
pjb
Zhivago: beach set up a lisp project list! http://metamodular.com/Common-Lisp/suggested-projects.html
12:13:30
Shinmera
pjb`: I'm still confused a bit. If I say define a function that uses some variable that is neither lexically bound nor declared special and then later use defvar, are the consequences implementation dependant?
12:13:30
minion
Shinmera, memo from pjb: since setting an undeclared variable is implementation dependant, an implementation could define automatically _lexical_ variables for them, so you may have fun at the REPL and keep your programs working. But this would need additionnal code in the implementation.
12:18:31
francogrex
hi, in a program some arguments are passed as keyword: for example (r% "rownames" NONRBIND :do.NULL nil) but the case of the keyword matters for example: ;R! Error in function (x, do.NULL = TRUE, prefix = "row") ;R! unused argument(s) (do.null = FALSE)
12:19:32
francogrex
as you can see I must pass do.NULL as it is and not do.null as it is being translated to be passed to the receiving app. Can it be done to "fix" the case of the keywords
12:20:30
|3b|
pjb: is accessing non-existent variables specified somewhere to be implementation dependent as opposed to undefined?
12:23:44
|3b|
other option is tricks with reader case, but unless you have a modern-mode lisp that would probably be annoying too
12:24:14
|3b|
(either you would have to type everything else in upper case, or you would have to type :DO.null to get "do.NULL")
12:27:38
|3b|
so if it prints as "do.null" you are discarding any case info in the symbol, and putting 'correct' case in the symbol name won't help
12:51:37
francogrex
Xach: I am passing args keywords and the app wants them in a specific case: (r% "rownames" NONRBIND :do.NULL nil) => ;R! Error in function (x, do.NULL = TRUE, prefix = "row"): unused argument(s) (do.null = FALSE)
12:52:29
alpha-
they propose tag filesystem instead of hierarchical - you can do thi in linux if you wanted
12:53:31
alpha-
they propose unified memory with ram ascache but the point us unclear since linux kernel already caching read data in ram
12:54:19
Shinmera
In that case it's your wrapper's job to translate the keywords into the proper case.
12:55:25
Shinmera
alpha-: If the three gazillion different file formats are not a good enough proof that serialization is a problem, I don't know what is.
12:57:14
|3b|
francogrex: either do (eql :|a| :A) => nil, or configure the reader to preserve or invert case
12:58:04
|3b|
francogrex: just keep in mind that preserving case means you need to type all CL symbols in upper case, and inverting case will invert case which you would need to undo when printing
13:00:58
Shinmera
Or you have to wrap it. (defun r-rownames (&key do.null) (r% "rownames" NONRBIND :|do.NULL| arg))
13:04:16
|3b|
'racket' implies a specific scheme implementation + extensions and extra libraries, so not quite as direct a comparison to CL as a language
13:21:25
francogrex
|3b|: you expected :do.Null to be transmitted as :DO.NULL but I think the programmer has placed a code that converts the cases to downcase before passing it on to R: this in his source: (string-downcase (substitute #\_ #\- (symbol-name arg)))
13:22:26
Shinmera
francogrex: in that case no matter what kind o symbol is read it's not going to end up being the right case.
13:24:50
francogrex
the programmer assumed all args are downcase because in general they are, except for that 0;1% situation
14:23:25
schjetne
I've been thinking of doing a toy Lisp 1.5 implementation as a bit of historical re-enactment
14:33:49
schjetne
The predecessors to Common Lisp, but I guess any legacy code still in use has been ported to CL
14:34:45
schjetne
That was one of the objectives of CL, to make transition from older dialects as smooth as possible
14:48:15
pjb
|3b|: it's undefined. Implementations are free to implement whatever they want in this case: signal an error, create a special variable, create a lexical variable, launch a ballistic missiles onto the programmer, whatever.
14:48:59
pjb
|3b|: most implementations seem to find useful to create a special variable. I would argue that it would be more newbie friendly, and otherwise REPL user friendly, to define a (global) lexical variable.
14:49:43
pjb
Shinmera: yes, if you define a function with a undefined free variable, and later define it, it is undefined, implementation dependant, what may happen.
14:52:13
pjb
alpha-: this is not htat crazy: http://wiki.osdev.org/Main_Page http://micropenguin.net/files/Other/OS/os-dev.pdf
14:54:31
pjb
minion memo for francogrex: you can restore normality with (|SETF| (|READTABLE-CASE| |*READTABLE*|) :|PRESERVE|) and thereafter, write the CL symbols in uppercase: (DEFUN myfun (&KEY do.NULL) (PRINT (LIST 'hi do.NULL))) (myfun :do.NULL 'Lo)
14:55:08
pjb
minion memo for francogrex: cf. also my emacs commands upcase-lisp and upcase-lisp-region.
14:59:57
pjb
schjetne: legacy code doesn't have to be converted to run in Common Lisp in a lot of cases. cf. eg. http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/wang.html.in
15:00:37
pjb
schjetne: but of course, if you want to make it evolve, you would better upgrade it to CL.
15:02:38
pjb
You store the element with (setf aref), or you adjust-array the array. You can't do both at the same time.
15:03:12
pjb
Of course you can wrap both operations in a single function of yours, but notice how adjusting a 2D array in general will not create a single new slot, but a whole column or a whole row!
15:05:20
pjb
schjetne: Notice however, that sometimes some porting may be needed. One thing is that in old lisps, bindings are always dynamic, so you often have to add special declaration (or thru some macrology, since they're expected to be implicit). Another problem is when you're dealing with an old lisp that is a lisp-1 (again solvable thru macrology).
15:06:18
pjb
schjetne: and finally, in some old lisps, some datatypes allow accessors reserved nowadays for different types. Notably, (CAR symbol) and (CDR symbol) (with the corresponding RPLACA/RPLACD) were meaningful in some lisps! (cdr symbol) would give the plist.
15:07:27
pjb
But I would say that such macrology is good as long as you only want to run a small legacy function. If you had a big legacy system using a lot of those dialect specific features, you'd want to go metalinguistic, and re-implement the old lisp (or indeed, port the code).
15:07:59
pjb
Notice how Norvig re-implemented the algorithms in Common Lisp in PAIP, instead of running directly the old code.
15:08:48
schjetne
When you say the cdr of a symbol gives a plist, is that a property list of things bound to the symbol?
15:09:23
pjb
But in old lisps, the symbol name, the symbol value, the symbol functions, etc, were stored on the plist too.
15:10:30
drmeister
Does anyone use "magit" on emacs? It opens COMMIT_EDITMSG to edit a message - how do I save/close that buffer to continue the commit? I'm committing Common Lisp code.
15:12:00
schjetne
pjb: I haven't really looked much into all the different symbol cells, I should probably do that.
15:18:51
axion
when vector-push-extend needs to resize the underlying storage, how does it do so? increase by 1, by initial storage length, or?
15:20:52
Shinmera
"vector-push-extend new-element vector &optional extension" "Extension is the minimum number of elements to be added to vector if it must be extended."
15:47:40
drmeister
oleo: When I C-x C-s and then C-c k to kill the window the *magit-process* says I aborted the commit - GRRRR
16:09:34
rhollor
does the irc time here changes with daylight savings too? this information is part of a logging program that I'm trying to make
16:13:37
rhollor
dlowe: then in the log files at http://ccl.clozure.com/irc-logs/lisp , does that use a daylight savings time? I never dealt with it, so I don't know how to tell
16:20:21
hardenedapple
Is there any way to do something like (step ...) on a macro expansion? I keep coming across macros in books that I know what they're supposed to do, and what they expand into, but I can't easily follow their logic.
16:27:05
drmeister
hardenedapple: One thing you can do is macroexpand-1 which will apply one expansion.
16:27:52
drmeister
You can also apply the macro expansion function to an S-expression using funcall.
16:29:34
hardenedapple
drmeister: Thanks, but it's mainly that first expansion I'm trying to understand
16:54:36
theseb
why in lisp if something can be done just as easily with recursion and iteration do i feel like a failure if i use iteration? somehow recursion got a rep as being more "proper" yes?
16:56:51
theseb
Xach: my impression is people that prefer recursion are trying to train us for some future utopia where were all doing 100% pure functional programming...just a guess
16:57:15
dlowe
Avoiding state can eliminate whole class of stateful bugs, replacing them with a whole class of stateless bugs.
16:57:32
rhollor
fe[nl]ix: that link at the top takes up the |contact part of it too, so when I click on it, it goes to an invalid url. It botheres the hell out of me
16:57:59
theseb
dlowe: well i'm not a functional weenie but i assume functional is less error prone or easier to debug..it is *at least* more amenable to multiprocessing
16:58:05
wasamasa
theseb: otherwise they could only encourage recursion when used with accumulators/trampolines
16:59:02
dlowe
theseb: it's easier to test. it's more amenable to multiprocessing. it's not easier to debug.
17:03:21
rhollor
well, for me it's like that on both the freenode webchat service and colloquy on two different computers. so I assumed it was a server problem
17:06:51
fe[nl]ix
rhollor: the channel banner is just a string, in which clients usually try to autodetect URLs
17:08:27
nyef
rhollor: Specifically, the brockets < and > are not valid URL syntax, and thus are often used to delimit URLs amongst other text.
17:34:28
beach
As an example of HIR, this form: (block a (ff (lambda (x) (if x (return-from a 234) (1+ x))))) generates this code: http://metamodular.com/hir-example.png
17:35:35
beach
Also notice the "unwind" instruction, and the F->M for conversion from a fixed number of values to multiple values.
17:36:50
nyef
... And by this point the block name A has been discarded, as the overall semantics are incorporated into the graph?
17:36:50
beach
Tail call optimization can be done when there is a FUNCALL followed by a RET connected by a blue variable.
17:41:04
beach
It is amazing to me how much the Graphviz representation helps in understanding what is going on.
17:49:12
beach
If the entire thing is in a function, then the UNWIND would refer to the ENTER instruction of that function.
17:49:45
|3b|
if FF called that function recursively and accumulated the closures, and eventually picked one to call, it would need to know which block to return from
17:50:57
nyef
Does it even make sense to discuss compiling a form outside of the context of a function?
17:53:44
|3b|
(block a (block b (block c (ff (lambda (x) (if x (return-from c 1) (return-from b 2)))) (side-effect)) (side-effect)) (side-effect))
17:54:52
|3b|
* guesses i should read the docs at some point, since i don't see how it works just from the pictures:)
17:55:52
|3b|
was just wondering how the nlx scoping problems i had with my last compiler translated
17:56:33
nyef
* shudders in memory of some of the NLX scoping and multi-value handling things he's dealt with.