The first two are obvious and common: WITH-FOO and DEF-FOO. What are some other common idioms for abstractions where it is often advantageous to express them using macros?
The first two are obvious and common: WITH-FOO and DEF-FOO. What are some other common idioms for abstractions where it is often advantageous to express them using macros?
FOO* indicates sequential evaluation instead of parallel. It's normally applied to binding forms, but when I made an Elisp-style IF macro that puts a progn in the else form, I called it IF*. -- Dan www.prairienet.org/~dsb/
On Mon, 04 Jun 2007 20:00:37 +0200, Dan Bensen < XXXX@XXXXX.COM > Are you aware that ACL already has a IF* macro? They have it available (somewhere) on their website. -- Using Opera's revolutionary e-mail client: http://www.**--****.com/
Looks like another LOOPish abomination. :) :) -- Dan www.prairienet.org/~dsb/
In article < XXXX@XXXXX.COM >, FOOLET, as in FLET, MACROLET, SYMBOL-MACROLET, etc. All the built-in ones are actually special forms, but I suppose there's a possibility of user-defined operators in a similar style. -- Barry Margolin, XXXX@XXXXX.COM Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group ***
In article < XXXX@XXXXX.COM >, There is also * WITHOUT-FOO * USING-FOO * BIND-FOO -- http://www.**--****.com/
1.Other common macro [naming] idioms
On Mon, 04 Jun 2007 06:34:33 -0700, jmckitrick < XXXX@XXXXX.COM > said: | The first two are obvious and common: WITH-FOO and DEF-FOO. What are | some other common idioms for abstractions where it is often | advantageous to express them using macros? Just looking at standard Common Lisp names: * DOFOO and DO-FOO for iteration; * FOO-BIND for, well, binding; * FOOCASE and FOO-CASE for dispatch; (opening CLtL's index of macro names) * FOOF for place manipulation (by the way, I believe it would be either DEFFOO or DEFINE-FOO, but not DEF-FOO). ---Vassil. -- The truly good code is the obviously correct code.
2.Shortening common idioms: bus assignment and 'prev' generation
Hello all, In high level programming languages it's possible to shorten common programming idioms by encapsulating them into functions / modules / classes. It is similarly possible in simulation-aimed VHDL, but is much more difficult in synthesis-aimed VHDL. Here is one: some_bus(31 downto 27) <= (others => '0'); some_bus(26) <= my_sig_3; some_bus(25) <= my_sig_4; some_bus(24 downto 20) <= (others => '0'); some_bus(19) <= my_sig_11; some_bus(18 downto 2) <= (others => '0'); some_bus(1 downto 0) <= another_bus(1 downto 0); I wish there sould be a way to just assign 'all zeros' to some_bus and then the signals to relevant bits: some_bus(31 downto 0) <= (others => '0'); some_bus(26) <= my_sig_3; some_bus(25) <= my_sig_4; some_bus(19) <= my_sig_11; some_bus(1 downto 0) <= another_bus(1 downto 0); This, unfortunately, doesn't work. Setting some_bus to 'L' also doesn't work for synthesis (only simulation). Another common idiom is seeing when a signal changed: signal my_sig, my_sig_prev: std_logic; ... ... process (clk, reset_n) begin if reset_n = '0' then my_sig_prev <= '0'; elsif rising_edge(clk) then my_sig_prev <= my_sig; end if; end process; And then: some process: ... if rising_edge(clk) then if my_sig_prev /= my_sig then ... ... How can this be shortened, in synthesis ? I find myself writing this or similar code (checking for a rise, or fall, of my_sig, for instance, by (my_sig = '0' and my_sig_prev = '1') for fall) too many times ! Eli ...
3.semi-urgent request for common-idioms
Does anyone have a reasonably current version of Brian Mastenbrook's common-idioms package lying around that they'd be willing to email me or put on a web server or something? I have a bunch of software that depends on it, that I'm trying to install on a new machine, and I can't seem to get it on the internet, and all my copies are in the office which I can't get to today. Cheers, rif
4.SETF and MACRO idiom & archive wisdom...
Douglas Philips < XXXX@XXXXX.COM > writes: > After numbing myself searching through decades of c.l.l archives, I'm > not sure if in my stupor I've just passed over what I'm looking for, > or if the needle I want is on a completely different farm from the > haystacks I was looking in. > > Is there a way to write a SETF like thing, which does the evaluation > of place only once, but which returns the _old_ value instead of the > new? From what I unearthed about SETF (DEFUN (SETF FOO)) (DEF-SETF.... > PUSH isn't a SETy thing because it doesn't return the right thing, etc. > ... that the answer is 'No'. Look at DEFINE-SETF-EXPANDER.
5.[Clax86list] using common macros in NASM and C
On 25 Jul 2006 17:21:02 -0700 " XXXX@XXXXX.COM " < XXXX@XXXXX.COM > wrote: :Of course, the problem with the ".h"->".inc" translators is that they :only work with a tiny subset of the stuff that normally appears in an :.h file. This may be true for specific translators which you have looked at, but my experience is that the only thing which is particularly intractable is the macro definitions. -- Chuck
6. using common macros in NASM and C
Users browsing this forum: No registered users and 12 guest