lisp

Lisp chaining functions macro

Is there a ready made lisp macro that allows chaining (piping) of functions? I couldn't find one. I'll try to explain what I mean with this example. Instead of using let* with lots of unused intermediate variables like this: (let* ((var1 (f1 x y)) (var2 (f2 x var1)) (var3 (f1 var2 z))) var3) I would like to have it written l...

How to 'destroy/dispose' frame% in plt-scheme?

I want to destory my previously shown frame when a certain event is triggered. I can't find anything regarding this in the reference manual. ...

Is there an equivalent to Lisp's "runtime" primitive in Scheme?

According to SICP section 1.2.6, exercise 1.22: Most Lisp implementations include a primitive called runtime that returns an integer that specifies the amount of time the system has been running (measured, for example, in microseconds). I'm using DrScheme, where runtime doesn't seem to be available, so I'm looking for a good substi...

lisp nth function does not work on cons-cell

How to use nth function in lisp if my my variable is combination of list and cons-cell for eg: (setq aa '(1 2) ) (nconc aa (+ 1 2)) this return me (1 2 . 3) when i say (nth 1 aa) it returns 2 but when i use (nth 2 aa ) it throws error ...

Emacs/AUCTex: run command on file that is not currently open

I edit my LaTeX files in Emacs using AUCTeX. To compile, I press C-c C-c, which will run pdflatex root, if root.tex is the file in the current buffer. But what if I want it to run pdflatex on a file that is not in the current buffer? For example, I am editing an included .tex file chapter2.tex and press C-c C-c. The command I want it ...

emacs programmatically change window size

hi. I would like to implement automatic collapse of compilation buffer to small size (but not close at a delete windows), such that upon successful compilation to window is shrunk to minimum size. get-buffer-create returns a buffer. how can I shrink-window on window associated with that buffer? also, is there a way to store previous w...

What is so special about Lisp?

Possible Duplicate: Whats so great about Lisp? What is it that makes Lisp so special? Why is it repeatedly held up as an example of what a programming language should be? I've got a pretty deep CS background here, if you need to get technical, by all means do so. Still, I think what I'm asking is how does working with Lis...

Lisp Parentheses

Why do Lispers format their code like shown in sample 1 instead of as shown in sample 2? To me (and I guess, to most others coming from different programming backgrounds than Lisp), the formatting shown in sample 2 would be easier to read. Is there any particular reason why Lispers prefer the sample 1 style? Sample 1 (defun factorial ...

emacs how to tell window orientation?

hi. How do I tell in emacs window orientation, e.g. if it was created by vertical or horizontal split? alternatively, how can I tell if window can be resized vertically or horizontally? on a related note, is there a tutorial for programming emacs windows, e.g. size, buffers associated, properties, etc.? Thank you very much. was able ...

What are the prerequisites of reading 'The Little Schemer'?

From the reviews 'The Little Schemer' looks like the book to learn functional programming techniques and theory/reasoning. I wanted to ask if this book requires me to learn basic Scheme first? or I can get the hang of it in the middle? Some background about myself to give depth to my question: I'm planning to have a crack at this book, ...

emacs interactive function with optional numeric prefix

hello How do I specify a function which has optional numeric prefix, if not, it prompts for a number? basically how goto-line behaves? (defun my-function(&optional n) ; I have tried (interactive "N") ; reads string, no prompt (interactive "p") ; defaults to one (interactive (if (not n) (read-number "N: "))) ; runtime error ...

how to override functions in emacs lisp for specific mode?

hi How can I override emacs function with my own implementation for a specific mode? example/reference would be great Thanks ...

lisp filter out results from list not matching predicate

hey I am trying to learn lisp, using emacs dialect and I have a question. let us say list has some members, for which predicate evaluates to false. how do I create a new list without those members? something like { A in L: p(A) is true }. in python there is filter function, is there something equivalent in lisp? if not, how do I do i...

Common Lisp Exercises/Problems

I'm working through Practical Common Lisp presently http://www.gigamonkeys.com/book/ It's an excellent book with some practical assignments towards the end, but I'm looking for basic problems that explore the use of functions, variables and macros. Can anybody suggest a suitable resource to work through in order to reinforce the conce...

F# vs Haskell vs Lisp - which language to learn?

I've heard a lot about functional programming languages and I'm willing to learn one. I guess it will be mostly for fun, however, I hope it will improve my programming skills. I have mostly C#/.NET background, so my first choice is to learn F# (because of .NET and familiarity with Visual Studio). On the on other hand, I wonder if F# has...

How to write a recursive macro call on a &REST parameter in Lisp?

Hi, I've been writing some simple test cases for one of my assignments, and have built up a bit of a test suite using macros. I have run-test and run-test-section and so on. I'd like run-test-section to take a number of parameters which are run-test invocations and count up the number of PASSes and FAILs. run-test returns T on PASS, an...

emacs lisp, how to get buffer major mode?

hey guys I have tried to search Google and look in the manual, but still cannot find how to get major mode of a buffer object. Can you help me with an example or a reference. Thanks only solution I could find was to query major-mode after changing the buffer and then changing back to original buffer. Is there a better way to do it? ...

Lisp, a couple of questions about lists and recursion

Hey guys, sorry to overflow with so many questions. I have the following: (defun recursive-function (string) "returns list of strings" ;I am trying to return flat list ; create list L (append (mapcar 'recursive-function L))) But since recursive-function returns a list, I end up with a list of a list of a list..., whereas I want just ...

Change an editable-text value in Allegro CL

I'm trying to change the value of an Editable-Text control in Allegro CL (version 8.0.1) by clicking a Default-Button. I've read about (setf value) but haven't found any examples. The function I have ttached to the on-click event is the following (defun form1-default-button-2-on-click (dialog widget) (declare (ignorable dia...

can if be a proper function rather than a special form

hello I finally started learning functional languages (emacs lisp) and it makes explicit distinction between functions and special forms such as flow control , for example if. Is there a fundamental/theoretical reason why special forms are distinct from functions? do any languages provide functional if? Thanks ...