Search found 5 matches
- Wed Aug 17, 2011 5:24 pm
- Forum: Emacs Lisp
- Topic: Operator Overloading
- Replies: 2
- Views: 25150
Operator Overloading
Is there an easy way to overload operators/functions in Emacs Lisp? I'd like to overload + to handle custom-defined data types, other than "normal" numerics. What I'd like to do is write a procedure that checks the types of the arguments, and if they're my custom-defined types, then perfor...
- Sun Jun 19, 2011 12:05 am
- Forum: Emacs Lisp
- Topic: Passing Functions as Arguments
- Replies: 3
- Views: 19648
Re: Passing Functions as Arguments
Anyway, I hope you found this informative. I certainly did. Not all Lisps are created equal, and there are certainly arguments to be made for an Emacs implemented in CL or Scheme. Something with support for threads. I think there's an editor called "Hemlock" which purports to be an Emacs ...
- Tue Jun 14, 2011 9:28 am
- Forum: Emacs Lisp
- Topic: Passing Functions as Arguments
- Replies: 3
- Views: 19648
Passing Functions as Arguments
How does one go about doing functional programming in Emacs Lisp? They say that Lisp is a "functional" language, so you'd think it should be straightforward, but after googling around I've found comments from people to the effect that "functional programming in elisp is difficult to i...
- Tue May 10, 2011 6:36 pm
- Forum: Emacs Lisp
- Topic: Seeding PRNG
- Replies: 3
- Views: 11227
Seeding PRNG
How do I seed the Emacs random number generator w/ an arbitrary seed? If I just call (random) it uses the same seed w/ each run. I know that I can call (random t) first, to get a "random" seed.. But I want to seed the PRNG w/ my own, pre-determined seed... For instance, make a call (set-ra...
- Sun May 01, 2011 1:45 pm
- Forum: Emacs Lisp
- Topic: Lisp Evaluation
- Replies: 4
- Views: 29686
Lisp Evaluation
I can use the following code in Scheme: (define (a-plus-abs-b a b) ((if (> b 0) + -) a b)) It basically looks at whether b is positive or not, and accordingly selects the "+" or "-" operation to apply to the arguments a and b. It runs fine in Scheme: (a-plus-abs-b 1 1) ;; 2 (a-pl...