Load package in Scheme48, how to get first, word variable, etc - scheme

I just installed the scheme48 package from macports and have started experiencing. I was watching this youtube video, link here and was attempting to perform some of the examples. In the lecture the professor is running scheme on a Sun terminal. For example, I attempt to do '(first 473)' and get 'Error: undefined variable first'. Now, I'm assuming I haven't loaded the correct package / library or what ever it is called in scheme but am not sure what the syntax and library is. I believe that scheme48 and the scheme version on that sun terminal in the video are not the same and could be part of the problem.
So, what library do I need to use and how do I load it?

Those lecture notes are based on a book called Simply Scheme, and you can find the library code that is used in the book here. Specifically, you need simply.scm.
(But whether it is a good idea to have these kind of overloading functions is debatable. Specifically, note that first is used in a way that is different from many other languages.)

Related

Synthesisable Fixed/Floating points in VHDL's IEEE Library

I'm creating a VHDL project (Xilinx ISE for Spartan-6) that will be required to use decimal "real-style" numbers in either fixed/floating point (I'm hoping fixed point will be sufficient).
Being quite new to VHDL, I found out the hard way that the non-constant real types are not supported for synthesis, so I set about searching for a IP core or library to redress this.
So far I've found 3 options;
1) A floating point IP core provided by Xilinx
2) A downloadable "ieee_proposed" library written by a David Bishop found here
3) After spending a fair while attempting to work out how to "create" a new library with David Bishops files in, I took a quick look through the default IEEE library and saw it contains ieee.fixed_generic_pkg and ieee.fixed_pkg packages.
My question is - of the two libraries - which one would be sensible to use? Is one adapted for synthesis and one not, or one older than the other? And then if floating point is provided, is there any real point to the floating point IP core provided by Xilinx?
I've trawled through many questions of people attempting to add the ieee_proposed libraries, but none seem to have referenced the fact they they already seem to exist in the existing IEEE.
Thanks very much for any help!
============UPDATE (Essentially my own efforts to resolve)==================
I can't actually use the ieee.fixed_pkg - and attempting to do so gives me the error Cannot find <fixed_pkg> in library <ieee>.
After finding the ieee library at C:\Xilinx\14.7\ISE_DS\ISE\vhdl\xst\nt I've found that the fixed_pkg actually resides in ieee_proposed. However, this still throws up the same errors!
Dumb question, but when you downloaded the ieee_proposed did you also remember to compile it?
edit: And also remember to map the library to you simulation as well. Maybe you did all this already but these are the mistakes I make often.
I've been battling with the same problems for days.
The way I solved it is:
1. Add fixed_float_types_c, fixed_pkg_c and float_pkg_c vhdl files to project.
2. Declare them as belonging to work library (Properties in Quartus files window)
3. Compile project and call library using:
Library work;
use work.fixed_pkg.all;
To my annoyance, they don't come up in the nice red writing I want them to but it works!

Ctags - Find where a function is used in a project

Is there any good way to find where is a function being called in our codebase ?
There is a gem called Starscope (disclaimer: I am the author) which can list function calls in ruby code, among other things. It isn't perfect, since it can't handle crazy meta-programming, but it will find all the normal calls to a given function.
gem: https://rubygems.org/gems/starscope
github: https://github.com/eapache/starscope
user guide: https://github.com/eapache/starscope/blob/master/doc/USER_GUIDE.md
edit: Luc's answer is entirely accurate as far as it goes; I wrote Starscope specifically to be "Cscope for Ruby".
With ctags, no. It references functions declarations and definitions, not their uses.
Then it depends on the language.
cscope can help with C, but not with C++. With C++, you should have a look at clang based solutions : there is clang_indexer (and its many forks) (see vim-clang to integrate it in vim), but I did found a few quirks ; it seems YouCompleteMe does a few things related to code indexation (as it provides GotoImplementation/Declaration commands).
For other languages, you may have dedicated plugins. But for sure, there is always grep (and many plugins that integrates it)

On the use of of Internal`Bag, and any official documentation?

(Mathematica version: 8.0.4)
lst = Names["Internal`*"];
Length[lst]
Pick[lst, StringMatchQ[lst, "*Bag*"]]
gives
293
{"Internal`Bag", "Internal`BagLength", "Internal`BagPart", "Internal`StuffBag"}
The Mathematica guidebook for programming By Michael Trott, page 494 says on the Internal context
"But similar to Experimental` context, no guarantee exists that the behavior and syntax of the functions will still be available in later versions of Mathematica"
Also, here is a mention of Bag functions:
Implementing a Quadtree in Mathematica
But since I've seen number of Mathematica experts here suggest Internal`Bag functions and use them themselves, I am assuming it would be sort of safe to use them in actual code? and if so, I have the following question:
Where can I find a more official description of these functions (the API, etc..) like one finds in documenation center? There is nothing now about them now
??Internal`Bag
Internal`Bag
Attributes[Internal`Bag]={Protected}
If I am to start using them, I find it hard to learn about new functions by just looking at some examples and trial and error to see what they do. I wonder if someone here might have a more complete and self contained document on the use of these, describe the API and such more than what is out there already or a link to such place.
The Internal context is exactly what its name says: Meant for internal use by Wolfram developers.
This means, among other things, the following things hold about anything you might find in there:
You most likely won't be able to find any official documentation on it, as it's not meant to be used by the public.
It's not necessarily as robust about invalid arguments. (Crashing the kernel can easily happen on some of them.)
The API may change without notice.
The function may disappear completely without notice.
Now, in practice some of them may be reasonably stable, but I would strongly advise you to steer away from them. Using undocumented APIs can easily leave you in for a lot of pain and a nasty surprise in the future.

In What Windows Library is glCreateProgramObjectARB Defined?

I'm trying to do some shader programming on windows. All the code I've been able to find online says you have to use wglGetProcAddress to figure out where these functions are, but i'm not sure what library to link against.
Ben Voigt's answer is nearly correct, with two exceptions:
All OpenGL 1.0 and 1.1 functionality is inlcuded in opengl32.lib, only 1.3 and upwards and all extension must be loaded dynamically.
WGL guarantees that all contexts sharing the same pixel format share identical function pointers. This is an important detail, as otherwise any application using either OpenGL 3.x/4.x or multisampling would necessarily be malformed.
However, in short, forget all this blah blah. Download GLEW and be done in 5 minutes. It just works and you need not care about petty implementation details. Call one init function at program start, and everything is good.
You link against opengl32.lib to get wglGetProcAddress. All the rest must be dynamically obtained via wglGetProcAddress after you have made a context current, since different contexts can use different implementations of the various functions.
An extension loader such as GLee or GLEW can do the function-pointer details for you, but you still need to be linking opengl32.lib.

Standard Library Reference for Ruby

I need a good reference for how to use standard Libraries in Ruby. Current libraries do not describe or give examples like say Java's. Yet this is where examples are much more needed (in Ruby), because I am not familiar with what the called method will yield! I am left with having to look at the source files every time, which seems inefficient. What is a good standard library reference... or am I just not understanding blocks yet?
I find myself bouncing around between the ruby core API on ruby-doc.org, googling for answers on random blogs, and spending time testing ideas in the interactive interpreter (irb). I haven't seen any other core reference documentation that I liked, but I do have a copy of The Ruby Way and its pretty decent.
Betweeen these four sources I can almost always find out how to solve the problem I'm working on.
Best of luck - ruby is fun, frustrating, and powerful.
There is the Ruby Standard Library documentation and sites like apidock. The Pickaxe book has a great reference towards the end. There's even a free version online, but it's quite out of date; to find the reference there, click Standard Library in the top-left frame.
Try GotAPI You'll be able to find the Ruby standard documentation and a whole lot of api docs there
Understanding blocks is pretty important, especially if you want to understand the Enumerable module. ruby-doc.org is usually all I need, but if I need a little more explanation I grab the PickAxe. You need the PickAxe, no question.
I am sorry , but again, i have to recommend ruby cookbook. (Already two times today)

Resources